In this day and age where a megabyte of memory isn’t a big deal, it is hard to recall when you had to conserve every byte of memory. If you are a student of such things, you might enjoy an annotated view of the Apollo 11 DSKY sine and cosine routines. Want to guess how many lines of code that takes? Try 35 for both.
Figuring out how it works takes a little knowledge of how the DSKY works and the number formats involved. Luckily, the site has a feature where you can click on the instructions and see comments and questions from other reviewers.
Continue reading “Apollo 11 Trig Was Brief”
When it comes to mathematics, the average person can probably get through most of life well enough with just basic algebra. Some simple statistical concepts would be helpful, and a little calculus couldn’t hurt. But that leaves out a lot of interesting mathematical concepts that really do have applications in everyday life and are just plain fascinating in their own right.
Chief among these concepts is the Fourier transform, which is the key to understanding everything from how JPEGs work to how we can stream audio and video over the Internet. To help get your mind around the concept, [Jez Swanson] has this interactive Fourier transform visualizer that really drives home the important points. This is high-level stuff; it just covers the basic concepts of a Fourier transform, how they work, and what they’re good for in everyday life. There are no equations, just engaging animations that show how any function can be decomposed into a set of sine waves. One shows the approximation of a square wave with a slider to control to vary the number of component sine waves; a button lets you hear the resulting sound getting harsher as it approaches a true square wave. There’s also a great bit on epicycles and SVGs, and one of the best introductions to encoding images as JPEGs that we’ve seen. The best part: all the code behind the demos is available on GitHub.
In terms of making Fourier transform concepts accessible, we’d put [Jez]’s work right up there with such devices as the original Michelson harmonic analyzer, or even its more recent plywood reproduction. Plus the interactive demos were a lot of fun to play with.
[via the Adafruit blog]
It’s ridiculously easy to lay hands on a cheap DC-to-AC inverter these days. They’re in just about every discount or variety store and let you magically plug in mains powered devices where no outlets exist. Need 120- or 240-VAC in your car? No problem – a little unit that plugs into the lighter socket is available for a few bucks.
So are these commodity items worth building yourself? Probably not as [GreatScott!] explains, but learning how they work and what their limitations are will probably help your designs. The cheapest and most common inverters have modified square wave outputs, which yield a waveform that’s good enough for most electronics and avoids the extra expense of producing a pure sinusoidal output. He explains that the waveform is just a square wave with a slight delay at the zero-crossing points to achieve the stepped pattern, and shows a simple H-bridge circuit to produce it. He chose to drive the output section with an Arduino, to easily produce the zero-crossing delay. He uses this low-voltage inverter to demonstrate how much more complicated the design needs to get to overcome the spikes caused by inductive loads and the lack of feedback from the output.
Bottom line: it’s nice to know how inverters work, but some things are better bought than built. That won’t stop people from building them, of course, and knowing what you’re doing in this field has been worth big bucks in the past.
Continue reading “How To Build An Inverter, And Why Not To Bother”
We are always excited when we see [Hamster] post an FPGA project, because it is usually something good. His latest post doesn’t disappoint and shows how he uses the CORDIC algorithm to generate very precise sine and cosine waves in VHDL. CORDIC (Coordinate Rotation Digital Computer; sometimes known as Volder’s algorithm) is a standard way to compute hyperbolic and trigonometric functions. What’s nice is that the algorithm only requires addition, subtraction, bit shifts, and a lookup table with an entry for each bit of precision you want. Of course, if you have addition and negative numbers, you already have subtraction. This is perfect for simple CPUs and FPGAs.
[Hamster] not only has the VHDL code but also provides a C version if you find that easier to read. In either case, the angle is scaled so that 360 degrees is a full 24-bit word to allow the most precision. Although it is common to compute the result in a loop, with the FPGA, you can do all the math in parallel and generate a new sample on each clock cycle.
Continue reading “CORDIC Brings Math To FPGA Designs”
This might be an old trick, but it’s still cool to see a functional tool like the oscilloscope manipulated for an unrelated purpose such as this. [Jerobeam Fenderson] made a video explaining how to input stereo audio into an old digital scope in order to create of all things, dancing mushrooms… because why not?
In this case, [Jerobeam] used a Tektronix D11 5103N set in X Y mode and attached the left and right channels from his RME Fireface UC audio interface. One channel corresponds with X, and the other with Y. From here, he controls the wave forms discretely with the help of software like Pure Data (Pd) and Max (not free, but more powerful) which are visual programming environments made to enable musicians and artists to create software without writing lines of code. His video explains how to make a circle out of a sine wave, and then beat the crap out of it with math far beyond our comprehension. The outcome is pretty mesmerizing and leaves us wanting to try it out ourselves. Luckily, if you’re interested in experimenting with the voice of sine waves… [Jerobeam] has more information on his blog on how to do some scope play of your own whether your hardware is analog or digital.
You can see the dancing mushrooms in his video below:
Continue reading “Tripping On Oscilloshrooms With An Analog Scope”