Posts | Comments

Planet Arduino

Archive for the ‘signal processing’ Category

An interesting aspect of time-varying waveforms is that by using a trick called a Fourier Transform (FT), they can be represented as the sum of their underlying frequencies. This mathematical insight is extremely helpful when processing signals digitally, and allows a simpler way to implement frequency-dependent filtration in a digital system. [klafyvel] needed this capability for a project, so started researching the best method that would fit into an Arduino Uno. In an effort to understand exactly what was going on they have significantly improved on the code size, execution time and accuracy of the previous crown-wearer.

A complete real-time Fourier Transform is a resource-heavy operation that needs more than an Arduino Uno can offer, so faster approximations have been developed over the years that exchange absolute precision for speed and size. These are known as Fast Fourier Transforms (FFTs). [klafyvel] set upon diving deep into the mathematics involved, as well as some low-level programming techniques to figure out if the trade-offs offered in the existing solutions had been optimized. The results are impressive.

Fastest FFT code benchmarking results in ms
Benchmarking results showing speed of implementation versus the competition (ApproxFFT)

Not content with producing one new award-winning algorithm, what is documented on the blog is a masterclass in really understanding a problem and there are no less than four algorithms to choose from depending on how you rank the importance of execution speed, accuracy, code size or array size.

Along the way, we are treated to some great diversions into how to approximate floats by their exponents (French text), how to control, program and gather data from an Arduino using Julia, how to massively improve the speed of the code by using trigonometric identities and how to deal with overflows when the variables get too large. There is a lot to digest in here, but the explanations are very clear and peppered with code snippets to make it easier and if you have the time to read through, you’re sure to learn a lot!  The code is on GitHub here.

If you’re interested in FFTs, we’ve seen them before around these parts. Fill your boots with this link of tagged projects.

Dic
16

DIY Hearing Aid

Hearing aids are expensive little devices, typically costing a few thousand dollars each. They need to be highly integrated to fit in the ear, while still providing signal processing to ensure good audio quality.

This DIY hearing aid does some intelligent signal processing. It uses an electret to capture audio, then uses a pre-amplifier to increase the gain 100 times. The next stage consists of four filters, dividing the input signal by frequency into four parts. These are passed into four LTC6910 programmable gain amplifiers, which allow an Arduino to control the gain of each channel. The LTC6910 takes 3 digital inputs that are used to set the gain value.

To determine which gain to use for each frequency band, the Arduino needs to know how much power is in each band. This could be done using a Fast Fourier Transform, but that would require quite a bit of processing power. Instead, an envelope detector averages the signal, which can be read by an analog input on the Arduino. Using this information, the hearing aid can boost specific frequencies when it detects conversation.

This hearing aid won’t quite fit in your ear, but there is a lot of interesting signal processing going on. The schematic, Arduino source code, and a MATLAB simulation are provided.


Filed under: Arduino Hacks, digital audio hacks


  • Newsletter

    Sign up for the PlanetArduino Newsletter, which delivers the most popular articles via e-mail to your inbox every week. Just fill in the information below and submit.

  • Like Us on Facebook