voltage divider / rectifier / voltmeter / ESP8266

Questions relating to designing PCBs

Moderator: phalanx

Post Reply
Posts: 1
Joined: Fri Jun 08, 2018 4:15 pm

voltage divider / rectifier / voltmeter / ESP8266

Post by huramentzefix » Fri Jun 08, 2018 5:01 pm

hello fellow sparkies,
I just recently got into home automation systems and find it to be a very interesting topic. I have some basic knowledge but a lot of things are still new to me.
I have some outside LED lights which are switched on and off by a photosensitive resistor.
It consists of it's own little enclosed and is connected to 110V (125V in reallity). So it has it's own transformer and controlls a relay. I can't get inside that enclosure.
I own a couple of sonoff devices and have currently tasmota running on them. I would like to connect a sonoff to my photoresistor's output to read the status and voltage.
It has 3 wires. The output voltage is the input voltage.

How can I connect the 125V AC to my PIO14 on my sonoff? I was thinking of a voltage divider consisting of a 1.6kOhm resistor and R2 12 Ohms.
That should give me 0.97V AC @ 130V. 6,2Watt. What is the specifications on the ELM8266 PIO14? + 2 diodes to get AC.
does that make sense? does it have to be stabilised in any form?

I understand that I only can get a voltage reading when it's dark outside.

Posts: 7
Joined: Sun Feb 13, 2011 6:37 pm

Re: voltage divider / rectifier / voltmeter / ESP8266

Post by madbodger » Wed Jun 20, 2018 6:35 pm

Hooking a 120VAC signal to a logic input is tricky. For one thing, you have to pay attention to the peak voltage, which is about 170V. Using your divider, with its 133:1 ratio, that would give about 1.3V out peak. You said you want to use 2 diodes to get AC, I'm assuming you meant DC? I'm not quite sure how you'd use two diodes here, normally either a single diode is used, in a peak detector configuration, or four diodes as a bridge. However, there are three more problems: a small one, a medium sized one, and a big one. The small problem is that ordinary silicon diodes have a 0.6V drop, which will eat up nearly half your input voltage. The medium sized problem is there will be spikes on the AC line carrying higher than expected voltages: the usual way to deal with them is to add clamping circuitry to protect your logic input. The big problem is that, for it to work, the two circuits (the 125V one and the ELM8266 one) need to share a common reference, which means you're hooking your processor to one side of the AC line! This is exceedingly dangerous! My usual recommendation for monitoring AC voltages like that is to use a transformer, which can both step down the voltage and provide required safety isolation. An ordinary 6.3V transformer would do fine, but any low voltage would work, just adjust your voltage divider correspondingly. You can then use a diode or bridge rectifier (the 0.6V drop is small compared to the voltage coming out of the transformer) and capacitor to filter the rectified DC, then the voltage divider and ideally a clipping network to scale the voltage for your processor.

Post Reply