LM393 Sound Detection Sensor Module and ESPEasy as a switch

Moderators: Voyager, BertB, rtenklooster, Stuntteam, grovkillen, TD-er

Post Reply
Message
Author
Teknor
Normal user
Posts: 3
Joined: 12 Nov 2018, 23:15

LM393 Sound Detection Sensor Module and ESPEasy as a switch

#1 Post by Teknor » 08 Mar 2019, 20:36

Hi all - I have a NodeMCU running ESPEasy with a few sensors.

One of them is a LM393 Sound Detection Sensor Module.
Image

How do I configure this in ESPEasy to send one switch "on" when there is noise triggering the "switch"? I have tried a few alternatives, but ESPEasy dont put the switch back to "0" when silence.

All tips and help are much appreciated.

Pic01.png
Pic01.png (98.26 KiB) Viewed 146 times
Raspberry Pi 3 - Domoticz - RFLink 433 - ESP Easy - PikrellCam

Shardan
Normal user
Posts: 1060
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: LM393 Sound Detection Sensor Module and ESPEasy as a switch

#2 Post by Shardan » 08 Mar 2019, 23:29

Due to the data sheet of the LM393 it's a comparator with open collector output.

So it should be easy to connect to an ESP-Chip.

Connect the output of the FC-04 to a GPIO, for example GPIO 13.
Connect a resistor of about 10 KOhm from the connected GPIO to +3.3V.
The FC-04 should work with 3.3V or 5V. I'd prefer 3.3V in this case.
So conenct the Vcc of the FC-04 to 3.3V and GND to GND.

Configure a switch in ESPeasy to the used GPIO.

the trimmer at the FC-04 board sets sensivity. Turn up until the switch changes to "1",
then turn back until switch just hops back to "0".

Noise can be eliminated even with the trimmer too, by making it less sensitive.
If the noise level is nearly same as the sound that should trigger the switch, it will be very difficult to
get this to work. It is not a problem of ESPeasy, but a problem of the microphone.
There's a reason why modern smartphones or voicecontrols use microphone arrays of
four to eight microphones and digital signal processing.....
Regards
Shardan

RobertM
Normal user
Posts: 7
Joined: 22 Oct 2017, 15:23

Re: LM393 Sound Detection Sensor Module and ESPEasy as a switch

#3 Post by RobertM » 10 Mar 2019, 11:41

Shardan wrote:
08 Mar 2019, 23:29
Connect a resistor of about 10 KOhm from the connected GPIO to +3.3V.
Why not simply click "internal PullUp" ;)

Shardan
Normal user
Posts: 1060
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: LM393 Sound Detection Sensor Module and ESPEasy as a switch

#4 Post by Shardan » 10 Mar 2019, 17:27

RobertM wrote:
10 Mar 2019, 11:41
Shardan wrote:
08 Mar 2019, 23:29
Connect a resistor of about 10 KOhm from the connected GPIO to +3.3V.
Why not simply click "internal PullUp" ;)
The internal pullup is a so called "weak pullup" with a high impedance.
The LM393 has a significant leak current on "high" state (see datasheet), the more
as on some of these modules a LED is connected to the output.
Due to my experience in many cases using an external pullup works more reliable.
Regards
Shardan

Teknor
Normal user
Posts: 3
Joined: 12 Nov 2018, 23:15

Re: LM393 Sound Detection Sensor Module and ESPEasy as a switch

#5 Post by Teknor » 10 Mar 2019, 20:06

Thanks for great support.

I have hooked the sensor up to the nodeMCU and it triggers the switch. However, when I clap (once) the switch turns on. And stays on... Until next time I clap. Then it turns off.
Clap first: 79882796: SW : GPIO=12 State=1 Output value=1
Clap again: 79885596: SW : GPIO=12 State=1 Output value=0

Is it a function to configure this to Output value=1 when noice and then back to 0 after a few seconds? Like a PIR sensor?
pic2.png
pic2.png (51.02 KiB) Viewed 96 times
Raspberry Pi 3 - Domoticz - RFLink 433 - ESP Easy - PikrellCam

ThomasB
Normal user
Posts: 182
Joined: 17 Jun 2018, 20:41
Location: USA

Re: LM393 Sound Detection Sensor Module and ESPEasy as a switch

#6 Post by ThomasB » 10 Mar 2019, 23:42

However, when I clap (once) the switch turns on. And stays on... Until next time I clap. Then it turns off.
Change the Switch Button Type to "Normal Switch."

Edit: Be aware that the sound sensor's output goes logic-low only during the noise event and immediately returns to logic-high. So if you intend to see the Device's state change in the web browser then the noise would need to have a constant uninterrupted duration of several seconds. As a workaround you can use the system Web Log to see when a brief noise was detected.

Also, I found a schematic. There's already a 10K ohm pull-up on the sound board, so no need to add another. It is OK to use the Switch plugin's Internal Pullup function too.
http://www.mpja.com/download/31072mp.pdf

- Thomas

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests