Vote Charlie!

Starting to experiment with sound on Arduino Due

Posted at age 27.
Edited .

I’m just starting to get my feet wet with the Arduino Due, which apparently can read from analog input a hell of a lot faster than the FLORA I have been using for sound reactive projects.

After some research, I found there is much more to analogRead() than I previously knew about. Apparently it’s possible to have the analog to digital converter (ADC) collect readings in the background and trigger an interrupt when data is ready to be processed. Interrupts were already a new concept for me till recently, so this is a whole new level, and I’ll need to experiment more.

For a start, I took some basic readings while playing a 40Hz tone using the code in my sound_readings_due.ino file. When I read data at the fastest speed I could get (1.5 microseconds per reading, but apparently it can go down to 1), the graphed data looked quite jittery. Note I used my Adafruit Electret Microphone Amplifier with Adjustable Gain.

10hz_raw.png

10hz_raw.png" class="mt-image-none" height="1002

It got a little better when I placed the microphone a bit closer to the subwoofer.

10hz_raw2.png

10hz_raw2.png" class="mt-image-none" height="999

Next I tried averaging 10 readings at a time to see if I could clean this up.

10hz_averages.png

10hz_averages.png" class="mt-image-none" height="997

Then, desiring to see more of the waveform in my 10,000 readings, I decided to add an arbitrary 10 microsecond delay between each reading. To my surprise, the result was not jittery at all, and looked exactly like the previous example where each dot was 10 readings averaged.

10hz_spaced.png

10hz_spaced.png" class="mt-image-none" height="994

I’ll have to read more about this. I found a few very in depth documents and blogs about the Arduino ADCs, so this was just getting my feet wet!

Help get me elected by purchasing products mentioned in this entry!