Thanks for the update.

I am not sure what causes this. Probably some inaccuracies in the hardware module. But it doesn’t seem to be a big deal. Should have little effect on the spectral display.

You should not be seeing aliasing if you are sampling fast enough. Are you sampling at 38Khz? Try higher or lower just to test this theory.

Like this –> ADMUX = (3<<REFS0);

This reduces my total range from about 1011 to 980 but seems more stable.

The average still moves by maybe -5 +10 but can this be an uneven sine wave from the sound?

(I'm just using my voice to test not a pure tone 🙂 )

Anyway this is more than adequate for a simple spectral display, the display is just a fun visualiser option for what is primarily a Tetris/Breakout/Snake WS2812b display of 12×20.

Quiet: (Quiet PC in same room)

Time: 53 Min: 485 Max: 497 Avg: 490 Span: 12, 7, 5

Time: 54 Min: 484 Max: 497 Avg: 490 Span: 13, 7, 6

Time: 53 Min: 485 Max: 497 Avg: 490 Span: 12, 7, 5

Loud:

Time: 53 Min: 0 Max: 981 Avg: 489 Span: 981, 492, 489

Time: 53 Min: 0 Max: 981 Avg: 494 Span: 981, 487, 494

Time: 53 Min: 0 Max: 982 Avg: 491 Span: 982, 491, 491

Time: 54 Min: 0 Max: 982 Avg: 484 Span: 982, 498, 484

Time: 53 Min: 0 Max: 981 Avg: 486 Span: 981, 495, 486

Time: 53 Min: 0 Max: 981 Avg: 498 Span: 981, 483, 498

Time: 54 Min: 0 Max: 981 Avg: 497 Span: 981, 484, 497

Time: 53 Min: 0 Max: 982 Avg: 496 Span: 982, 486, 496

Time: 53 Min: 0 Max: 982 Avg: 488 Span: 982, 494, 488

There is still a fair bit of "noise" but I think for my purposes I will ignore this in code or consider a band pass filter. I wonder if I am seeing aliasing?

Thanks again Arik

]]>I know that sound is measured in db but I am willing to get the frequency out of it. I want to use it is for designing acoustic belt tension meter. It will be great if you can suggest any ways and ideas to get the frequency of belt using acoustic method?

Regards

]]>You don’t measure sound volume in Hz. You measure it in db. So it doesn’t make sense to “change db to Hz”. The frequency range allows you to look at only “some of the sound”, i.e. a specific range. Please read the article again to get some concepts in order.

What output are you expecting to get from the code?

You can use the code I posted on github. Should give good results.

The blog is really helpful Thank you for this.

It will be great if you can guide me,

I am trying to get frequency value of sound using db values in short i want to make a frequency meter using adafruit microphone, of the range 20hz to 800 hz and i’ll be using it in noisy environment So, how reliable you think the product or result can be? and How can i change db to Hz? I tried using FFT but all i am getting is same value irrespective of input at mic. Can I use your program code lines?

Thank you in advance

Regards,

Shruti ]]>

Thanks for the interesting update. Good thinking with changing the AREF, though I am not sure how it works in series. I would have used a voltage divider.

Results look much better now. Still, it is starange than the dc offset goes from 508 to 537 when the overall volume is louder. This is confusing to me. It should have stayed in the same place. Perhaps the module is not very accurate.

You have put me on the right track, instead of changing the code I have changed my AREF.

Instead of the 3.3v line I’m using a 10K resistor between 3.3v and AREF, this sets AREF at about 2.5v (AREF has 32K impedance.)

This is the analog output now:

Loudest noise:

Time: 54 Min: 0 Max: 1011 Avg: 540 Span: 1011, 471, 540

Time: 53 Min: 0 Max: 1011 Avg: 537 Span: 1011, 474, 537

Time: 53 Min: 0 Max: 1011 Avg: 537 Span: 1011, 474, 537

Time: 54 Min: 0 Max: 1011 Avg: 537 Span: 1011, 474, 537

Quiet Room:

Time: 54 Min: 476 Max: 543 Avg: 508 Span: 67, 35, 32

Time: 53 Min: 492 Max: 525 Avg: 504 Span: 33, 21, 12

Time: 53 Min: 470 Max: 529 Avg: 503 Span: 59, 26, 33

Time: 53 Min: 489 Max: 539 Avg: 509 Span: 50, 30, 20

A much better spread 🙂 🙂

Thanks

The sample was not written for the MAX9814 but for the MAX4466 which has a dc offset of vcc/2. So you will need to update the sample to use 1.25V as your offset. That would be around 387 in ADC units

The sample assumes that offset == max amplitude and that offset==512. So change here:

https://github.com/ayavilevich/ArduinoSoundLevelMeter/blob/master/ArduinoSoundLevelMeter.ino#L151

and here

https://github.com/ayavilevich/ArduinoSoundLevelMeter/blob/master/ArduinoSoundLevelMeter.ino#L201

The max is stuck at 765 because that is 1.25V*2 which is the max value you can get from this module.

Having said that, fixing the dc offset will only affect the first bin in the FHT, so it is not likely to affect the overall accuracy of the result. Try it though. The first bin is the DC offset basically.

]]>background only (quiet):

Time: 229 Amp: Max: 33% Avg: 25% RMS: 36% dB: -11.829

Time: 230 Amp: Max: 33% Avg: 25% RMS: 36% dB: -11.791

Time: 229 Amp: Max: 35% Avg: 25% RMS: 36% dB: -11.804

Time: 230 Amp: Max: 36% Avg: 25% RMS: 36% dB: -11.806

Time: 229 Amp: Max: 34% Avg: 25% RMS: 36% dB: -11.797

Time: 229 Amp: Max: 48% Avg: 25% RMS: 36% dB: -11.742

Time: 230 Amp: Max: 38% Avg: 25% RMS: 36% dB: -11.761

Loudest possible:

Time: 230 Amp: Max: 100% Avg: 38% RMS: 65% dB: -6.743

Time: 231 Amp: Max: 100% Avg: 74% RMS: 113% dB: -2.028

Time: 230 Amp: Max: 100% Avg: 66% RMS: 103% dB: -2.783

Time: 231 Amp: Max: 100% Avg: 71% RMS: 109% dB: -2.339

Time: 230 Amp: Max: 100% Avg: 71% RMS: 109% dB: -2.321

Time: 231 Amp: Max: 100% Avg: 70% RMS: 107% dB: -2.468

Time: 230 Amp: Max: 100% Avg: 71% RMS: 109% dB: -2.314

Time: 230 Amp: Max: 100% Avg: 71% RMS: 108% dB: -2.360

Time: 231 Amp: Max: 100% Avg: 66% RMS: 102% dB: -2.867

That’s using slow mode. using free flow it takes about Time: 53 but gives the same volumes.

]]>