I had this project of smoke detection.. so the smoke detector when it detects smoke will output a sound with a volume of 80dB, How can I measure dB using the raspberry pi and a USB microphone?

  • You may want to read this raspberrypi.org/forums/viewtopic.php?t=18014&p=179448 Jan 17, 2015 at 9:58
  • I think you can do this with a piezo. They cost < $5 and should be easy to find at an electronics supply. I guess you might have to calibrate it against something -- which you could try with the USB mic too, but I think it will not be as reliable or consistent.
    – goldilocks
    Jan 17, 2015 at 14:15

1 Answer 1


To measure decibels you would have two ways, after you acquire the signal from the microphone, apply Windowing (Hamming), do a Fast Fourier Transform (FFT), make the spectrum normalisation, apply A-Weighting and finally do your RMS calculation. From the RMS with the Perseval Theorem you can have your values in decibels dB.

Other option would be to do it by convolution, you would have to work with filters FIR, A Weighting and RMS calculation as well, you just take the FFT and spectrum out, and put signal convolution on top of it.

The USB microphone gives you what kind of data input? digital or analog?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.