I need help in regards with the switching On/Off with a Sound device
I builded a project where I light up a LED with a On/Off button and everything works fine, I am able to turn on and off a LED (via a rule i created) with the push of the button and I see the event in the serial interface:
SW : State 0
EVENT: button#LED=0.00
ACT : gpio,12,1
SW : GPIO 12 Set to 1
SW : State 1
EVENT: button#LED=1.00
ACT : gpio,12,0
SW : GPIO 12 Set to 0
When I replace the button with a switch sound device, I am unable to get the LED turned ON, If I activate the sound probe, I can see a momentary LED flash on the sound device and I can also see a momentary flash of main the LED on the ESP but my test LED does not turn On/Off neither any event in the serial interface
My sound switch is connected to D4, GND and VIN and is configured as below:
And here is a picture of my setup:
Should I plave a resistance or anything ?
thanks for any help
Change GPIO state using a Sound detection device
Moderators: grovkillen, Stuntteam, TD-er
Change GPIO state using a Sound detection device
Last edited by goldriver on 20 Jan 2018, 19:55, edited 1 time in total.
Re: Change GPIO state using a Sound detection device
I am not sure how that switch device you have is performing the switch.
Does it have a pull-up or pull-down resistor internal? Or is it connected to GND and with "1" the pin just floating?
And also how is the GPIO pin in the ESP8266 wired? (pull-up resistor?)
Those are probable causes.
So first try to find how the switch you use is wired internally.
And it looks like you power it from 5V. If the switch gives 5V on the switch when set to "1", it might be you just killed the input pin on the ESP8266.
I expect the switch will pull to GND for a "0" and has the pin floating on a "1" and then the pin must be pulled up to 3.3V via a resistor.
This can also be done in the ESP if I remember correctly.
So first try to get more info on the switch itself.
Does it have a pull-up or pull-down resistor internal? Or is it connected to GND and with "1" the pin just floating?
And also how is the GPIO pin in the ESP8266 wired? (pull-up resistor?)
Those are probable causes.
So first try to find how the switch you use is wired internally.
And it looks like you power it from 5V. If the switch gives 5V on the switch when set to "1", it might be you just killed the input pin on the ESP8266.
I expect the switch will pull to GND for a "0" and has the pin floating on a "1" and then the pin must be pulled up to 3.3V via a resistor.
This can also be done in the ESP if I remember correctly.
So first try to get more info on the switch itself.
Re: Change GPIO state using a Sound detection device
Another problem might be the output of the switch module.
The circuit seems to be quite simple, a microphone and a chip which defines a threshhold as far as i can see from the photos.
Usually the chip is a LM393 or similar comparator chip. Depending on the exact type of this chip it might have an "Openb Collctor"
output. Youmay try a 10 K Ohm resistor from VCC to GPIO/Output of the switch. It won't hurt if there is another comparator type
but it might help if it is an open collector type.
Anyways these soundswitches might have a disadvantage depending on the circuit: A sound is not that well defined.
The comparator might generate several pulses from something that you hear as one sound.
Sadly i don't have such a sounswitch module at hand, it would be interesting what the output looks like on an oscilloscope screen.
The circuit seems to be quite simple, a microphone and a chip which defines a threshhold as far as i can see from the photos.
Usually the chip is a LM393 or similar comparator chip. Depending on the exact type of this chip it might have an "Openb Collctor"
output. Youmay try a 10 K Ohm resistor from VCC to GPIO/Output of the switch. It won't hurt if there is another comparator type
but it might help if it is an open collector type.
Anyways these soundswitches might have a disadvantage depending on the circuit: A sound is not that well defined.
The comparator might generate several pulses from something that you hear as one sound.
Sadly i don't have such a sounswitch module at hand, it would be interesting what the output looks like on an oscilloscope screen.
Regards
Shardan
Shardan
Who is online
Users browsing this forum: Bing [Bot] and 10 guests