I could really need some advice. I do have a cat door bell, its a simple PIR Sensor that is placed outside and inside I do have a blinking device that does also play a sound once triggered. I would like to integrate that into my SmartHome. I made it that my Wemos D1 Mini is connected to Wifi and MQTT. So my initial idea was to grab the signal of the LEDs once they start blinking. But they deliver 4.4V once active which will kill the chip. So not an option, so I thought of the other thing that being triggered, the little loudspeaker and indeed once its triggered it will return something between 1.4v and 1.6v for a couple of seconds. Doing some google searching I found out the posibility to use the A0 Pin and with some coding convert the reading to a voltage, but I cant get it to work. I soldered a little wire to the loudspeaker and connected that directly with the A0 pin. I get constantly a reading of 0.01 or 0.02 but also the same once its triggred. Do I have to put some resistors in between to get a proper reading?
My programming idea was a simple If condition. If Value > 0.5V do change variable in MQTT delay of 10 seconds reset variable. thats it.
I could really need some advice. I do have a cat door bell, its a simple PIR Sensor that is placed outside and inside I do have a blinking device that does also play a sound once triggered. I would like to integrate that into my SmartHome. I made it that my Wemos D1 Mini is connected to Wifi and MQTT. So my initial idea was to grab the signal of the LEDs once they start blinking. But they deliver 4.4V once active which will kill the chip. So not an option, so I thought of the other thing that being triggered, the little loudspeaker and indeed once its triggered it will return something between 1.4v and 1.6v for a couple of seconds. Doing some google searching I found out the posibility to use the A0 Pin and with some coding convert the reading to a voltage, but I cant get it to work. I soldered a little wire to the loudspeaker and connected that directly with the A0 pin. I get constantly a reading of 0.01 or 0.02 but also the same once its triggred. Do I have to put some resistors in between to get a proper reading?
My programming idea was a simple If condition. If Value > 0.5V do change variable in MQTT delay of 10 seconds reset variable. thats it.
Appreciate your help in advance!
Thanks
Michele
Hi Michele,
Would it be fair to say you are new to electronics?
First, the 4.4v problem. You can use this but you need to use a divider to get it down to 3.3v, you need 2 resistors in series, something like LED (where the 4.4v is) to a 3k3ohm resistor to a 10k ohm resistor to 0v. Take a wire from the junction of the 2 resistors to A0. Don't forget to connect the Arduino ground to the cat flap ground.
For the second idea, I get the impresion you have connected a wire from the speaker to the Arduino to A0 but not connected 0v. You should not be doing it this way anyway as the speaker output will be AC not the DC a digital input needs.
Would it be fair to say you are new to electronics?
First, the 4.4v problem. You can use this but you need to use a divider to get it down to 3.3v, you need 2 resistors in series, something like LED (where the 4.4v is) to a 3k3ohm resistor to a 10k ohm resistor to 0v. Take a wire from the junction of the 2 resistors to A0. Don't forget to connect the Arduino ground to the cat flap ground.
For the second idea, I get the impresion you have connected a wire from the speaker to the Arduino to A0 but not connected 0v. You should not be doing it this way anyway as the speaker output will be AC not the DC a digital input needs.
Hi Perry,
no thats absolutely fair, I've been trying hard to find my answer on my own. Thanks for your input I will give that a try. I was just trying to avoid using multiple resistors for space reasons.
I've been hardly trying to get it work, but without success.
Here is the sketch + code how I connected everything. The reading I get is always 0.01 even when the LED of the bell is flashing. My Multimeter shows at this point 4,57v
and here is the little portion of code beside the wifi setup.
A possibly safer solution: stick an LDR on top of the flashing LED and use that as input for the WeMOS. With appropriate series resistor you may even read the LDR with a digital pin.
Alternative: wire up an optocoupler in parallel to that LED (connect it so that both the LED and its current limiting resistor are in between the optocoupler's connections, and add a separate current limiting resistor for the opto).