SparkFun Forums 

Where electronics enthusiasts find answers.

Questions relating to designing PCBs
By huramentzefix
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.
By madbodger
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.
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]