3 ms·
Optocouplers are neat. I few months ago, it was the middle of the night and I was thinking about how to add AC frequency monitoring to my GPS clock project. (
by jrockway 4y ago
Optocouplers are neat. I few months ago, it was the middle of the night and I was thinking about how to add AC frequency monitoring to my GPS clock project. (Any frequency source is fun; I have two GPSes, a DS3231, a WWVB module, etc.) I didn't have any optocouplers, but I heard that LEDs work as photodiodes. Indeed, I found some random LEDs, connected one to mains with a large resistor, and pointed it at another LED. A 60Hz voltage appeared on the leads of the second LED. I then went to sleep instead of finding an ADC and writing the frequency sampling code... and so the thing never made it into production. But, neat surprise. If you want a quick and dirty optoisolator, you only need one type of component: the humble LED.
- mindslight 4y agoIf you do get back to this project, you'd be better off with an X rated capacitor instead of a resistor. Lower power consumption, and it's explicitly rated to be across the line. I'd add a small fast acting fuse, as well.
- jrockway 4y agoThis was a 3mA LED, so the inefficiency of a resistor didn't matter that much. I think I used a 50k or 100k ohm resistor. Didn't need to get to full brightness either!
- pflanze 4y agoAt 120 V that's 0.36 W (if using both halves of the AC wave), if you use that 10 years non-stop you'll burn 31 KWh, a value of 5-20$ or so, thus if you were to produce many of these devices it would be worthwhile to lower :). But sure, for a one-off it won't matter. OTOH I'm wondering how you didn't break the LED during the reverse cycles of the AC wave, if you didn't use either a high-voltage diode in sequence or some random diode or second LED in reverse direction in parallel to the first one to bypass the other half of the wave.
- mindslight 4y agoGood point about needing to plan for both halves of the wave. That's especially true for my capacitor suggestion. Last time I designed something (trickle supply) with line rated capacitors, the DC component was a zener which has that built in. My line capacitor suggestion was really just to get one started thinking about an actual circuit design for longer term. A 1/4 W resistor in serious with line voltage works fine on the test bench, but for longer term non-attended usage I would think about the various ways things could go wrong. And if you're going to spec a special resistor, then you might as well spec a special capacitor instead. If I had to guess about why the LED wasn't destroyed, it's because the reverse breakdown voltage is low enough that significant heat does not build up in the LED. A reverse avalanche isn't necessarily destructive.