Best Adafruit product for sound and light project

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Brindamour
 
Posts: 4
Joined: Mon Jul 20, 2020 6:13 pm

Best Adafruit product for sound and light project

Post by Brindamour »

Hi,

I am looking for a microcontroller for a projects using six Adafruit neopixels light strings. I would like to use a sensor that can detect sound tonalities, and depending of the tonality, light up a different neopixels light string. So far I feel that I could program the Adafruit feather nRF52840 to do that, but I am not sure if I would need to add a PDM MEMS. Or could I just use an Arduino with the PDM MEMS? The Circuit Playground also look like it could be programmed to do that, but I don't want to use it with a Lilypad. And I don't know if these two microcontrollers detect sound volume amplitude instead of tonalities.

Thank you!
Attachments
4062-02.jpg
4062-02.jpg (165.33 KiB) Viewed 78 times

User avatar
pneumatic
 
Posts: 186
Joined: Sun Jul 26, 2009 3:59 pm

Re: Best Adafruit product for sound and light project

Post by pneumatic »

Hi, I'm just another hobbiest, and don't represent Adafruit in any way.

I'm curious why you're thinking about the nRF52840. It specializes in BLE (Bluetooth Low Energy) communications, so it would be good to use to interface with a smartphone or similar. There are many basic microcontroller boards like a feather m0 that can take analog input and analyze it.

The circuit playground is probably a good choice, but you'll need to get the sounds into the microcontroller. You could use an electret microphone with amplifier and feed the output of that into one of the analog pins. Identifying tonality vs. volume is done in software. One of the advantages of the circuit playground is that it support CircuitPython, so you can code in python rather than C++, and in my humble opinion, that makes it easier to program. You don't need to have a complex IDE (integrated development environment) to write code, you can just use a text editor like Notepad or TextEdit (or emacs or vi if you're hard core.)

You'll probably want to read up on some basic DSP (digitial signal processing), and use something like a FFT (Fast Fourier Transform) to take the raw signal and convert it into frequencies so that you can detect tone and tonality (I'm a little unclear how you identify tonality, but I'm guessing it's ratios of primary frequency to overtones or something like that.)

User avatar
Brindamour
 
Posts: 4
Joined: Mon Jul 20, 2020 6:13 pm

Re: Best Adafruit product for sound and light project

Post by Brindamour »

Hi, thanks for your response, and sorry for my delay!

I thought of this particular feather, probably because it was used in a project similar to mine, but didn't get that its main feature was to be Bluetooth compatible. I am not new to electronics, but new to microcontroller. Thanks for suggesting the feather m0.

With the research I have done so far, I'll probably begin to experiment with the Circuit Playground, and thanks for suggesting the electret microphone with amplifier. In terms of tonality, I am just thinking of low and high musical notes, if it's possible.

Thanks for pointing me in the right directions!

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Best Adafruit product for sound and light project

Post by adafruit_support_mike »

Telling one frequency from another requires FFTs, or multiple external filters.

FFTs rely on an interesting quirk of math involving sine waves: if you multiply sine waves of two different frequencies together, the result is a more complicated wave that still spends equal amounts of time above and below the X axis. Over a sufficiently long period, its average value is 0:
different-frequencies.png
different-frequencies.png (231.91 KiB) Viewed 60 times
But if you multiply two sine waves of the same frequency, the result is a sine wave whose value is always positive:
same-frequency.png
same-frequency.png (170.36 KiB) Viewed 60 times
Its average value is half the amplitude of the original sine waves.

So to tell whether some frequency is present in a signal, you just multiply the signal by a sine wave of the frequency you want to check, then find the average. All the components of the signal at other frequencies will average to 0, and the frequency of interest will produce an average equal to half its amplitude.

Fourier transforms do that for a whole range of frequencies, and keep track of the average for each test frequency. As you might guess, that involves a whole lot of math. The FFT provides shortcuts that make it possible to get the same results in a computationally efficient way.

The Feather M0 is fast enough to do FFTs on real-time audio data, and code to do it already exists.

User avatar
Brindamour
 
Posts: 4
Joined: Mon Jul 20, 2020 6:13 pm

Re: Best Adafruit product for sound and light project

Post by Brindamour »

Thanks for your response!

Does the Feather M0 needs to be combined with an Arduino, or is it good on its own?

And would you combine it with Adafruit electret microphone with amplifier?

Thanks!

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Best Adafruit product for sound and light project

Post by adafruit_support_mike »

Brindamour wrote:Does the Feather M0 needs to be combined with an Arduino, or is it good on its own?
The Feather M0 is a microcontroller development board like the Arduino. You'd use it instead of an Arduino (and the Uno isn't fast enough to do FFTs of real-time audio).
Brindamour wrote:And would you combine it with Adafruit electret microphone with amplifier?
Yes. The MAX4466 electret amplifier breakout would be a good choice:

https://www.adafruit.com/product/1063

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”