MSGEQ7 Periodic Noise

Yes, I "solved" the issue, but I don't know which of my solutions was the most important. I put a 1uF electrolytic and a 100nF ceramic capacitor on the reference voltage line going from my preamp to the mic power line to help make sure that was nice and stable, and I put a 10uF tantalum capacitor on the main power supply along with the 100nF ceramic. I should mention that I am using a 20dB fixed gain audio amplifier before the MSGEQ7 to try to help with noise, so I focused mostly on cleaning that side up to make sure there was a decent signal to the analysis chip. After that, checking it with an AC millivolt-scale fluke was sufficient to see significant changes in signal amplitude when speaking (5-50mV).

However, despite all of this fairly overkill analog stuff to clean things up, the MSGEQ7 did still report a quite high noise floor. On my system with the 1024 full scale 10-bit ADC or whatever (ATMEGA32U4/Leonardo), I was seeing typical DC amplitudes in all bands of around 50/1024. When I talked at the microphone, it would get in the 60-70 range, and yelling could get it over 100. But having a total signal to noise floor of only a factor of two is pretty odd, and I'm fairly sure it's internal to the MSGEQ7. I also personally found that the top two frequency bands were utterly useless; they were both too high to be interesting in most cases (i.e. music), and had so much random noise that I just ignored them in my code.

In order to make the MSGEQ7 do something useful, I basically implemented autogain and automatic noise floor detection. I haven't published the code formally yet since it's not well documented, but I have attached it here. It just takes the bottom band, allocates to red LED, next two go to green, and next two go to blue with the top two ignored. It also outputs the current values to the USB serial port for debugging, although I removed that in my more integrated version. This one was mostly just for testing the chip performance. It's all GPLv3, so feel free to borrow as you wish.

Honestly, I think that in my final version I will just get rid of the MSGEQ7 since it's an extra $3 part that doesn't really perform very well, sample the raw audio input, and use a FFT in software instead. I bet it will work way better, particularly if I just up the gain a bit on the input so that it's using closer to the full 5V ADC range. It will have finer resolution, better control, I don't think it's overwhelmingly computational intensive, and it will be cheaper (and probably higher quality). I haven't tried it yet though, so not entirely sure... I'll probably at least try bypassing the MSGEQ7 on my board first to see what happens when I use direct audio input.

audio_analysis_v2.ino (8.45 KB)