Homemade Sound Sensor

Look at what I got this week in my mailbox.

It is a sound detector sensor. I am going to show how it work with my Homemade Environment Sensor.

Here is how I wire them together.

That is pretty much it. It is ready to go. Here is a demo how it work.

Note: I find the sound sensor is a very simple sensor. It should be obvious base on the cost (less than $1). Sound sensing is a very wide and can be complex topic. You may have heard terms like spl. Those are more of sound metering. There are some processing to highlight range of frequency to meter. Then, there is Sound Recognition. This is whole different ball game. Just as a disclaimer, This cheap sound sensor is not build for those purposes. However, It may be useful for us who just want to know whether there is any sound activity in the room.


@iharyadi can you make one for the ultrasonic distance sensor? I have a use case for such a sensor.

Ultrasonic sensor is harder to interface. The one that I saw use the same pin to send a ping. Then, the same pin is used to listen to the ping. The time difference is your distance.

This will be hard to do with a simple Analog, digital io pin. To do this precisely, It is not possible since at this state most of the MCU resources are already used.

To do some approximation, It may be possible with help of two HC-SR04. However, I do not have the detail idea written down or tested. I suppose one can use the digital output to initiate the ping on one HC-SR04. Then, connect the second one to digital input. The DH will initiate the ping from one HC-SR04. The other one will be picking this up. Assuming the sensor allow us to do the above, the tricky part is the timing. This will be the highest risk where the idea would not work. I think this is where the approximation will be hard to get right because you have to account for the latency on the Zigbee network.

The other option, one can perhaps build a circuit to perform the ping on separate board and convert the ping to analog signal. Some range sensor like below has already do this native. You just need to read the analog signal. This is easy to do.

[quote="iharyadi, post:3, topic:3624"

I was thinking of one of the 3 pins one only that does analog out.

I think they look the same. I am not sure whether the output pin in is an analog signal.

If it is an analog signal, it will be easy connect.

I have a few analog sensor coming, I will be connecting them to the Environment sensor this coming week.

You may want to look at Maxbotix by MaxSonar. Their product has analog output.

This Time of Flight sensor seems very interesting:

4 wire (+3-5v, gnd, clk, data) interface - digital.

The VL53L0X sensor would be fine for MCU that has free I2C pins. It would be a good alternative if you are using something like hubduino.

Hi Everyone,

Having play with this sensor for a week, I found a few issue with this sensor. It is not design for sound detector.

It is generic comparator with adjustable potentiometer. There is no capacitor to filter DC output from the electret microphone. Below image is how an electret microphone should be wired. If you look closely to the module above, there is not a single capacitor. Potentially, the capacitor could be in the microphone itself. However, I doubt it.

This DC output build up over time. This cause my sensitivity setting outdated over time. I experience that I am happy with a setting. However, after more less 5 to 10 minutes, it does not react sound that I thought it should be sensitive.

I bought another set from amazon.


This sensor has proper sound detector circuit. There is a schematic there. There is a capacitor on the microphone output. I believe It is amplified by a transistor before eventually compared. Detection is still dumb "Sound or no Sound". However, this module is much easier to work with.

I also want to share one trick. Amazon Echo and Google Home employ a technique to use multiple microphone. Why? Sound at higher frequency has some direction. Multi microphone will help here and there to pickup that higher frequency sound. A simple trick for my purposes is to use "or gate" like below. This kind of solution perhaps is not available from an out box sensor.

Here my prototype test of 3 microphones.