120vac to 5vdc sensor signal to controller

Thread Starter

ammarqs153

Joined Feb 15, 2016
14
Hello guys,
I am not sure if this is the correct thread to post this topic on, but it is related to microcontroller, so here is goes.
I have a 120vac input signal coming from an existing sensor that i need to sense to my controller and then act accordingly. I have tried 2 circuitries and have success with both but there is a trust factor missing. I want it NOT to fail down the road because of heat issues etc.
1. Is using a bridge rectifier with a 20k 2 watt resistor, 0.5uF 200 V cap going to an opto coupler and from there to my controller. Works perfect but the resistor is starting to heat up. The location of installation wont have much ventilation so i am worried it will burn out. The math shows 2watt should be enough but apparently it aint. I can go higher, maybe lets say 3-5watt, but still with no ventilation, it has chances of failure.
2. Option 2, and everyone is going to hate this, including myself is using a capacitor on the AC side, 0.33uF to limit current with a 10ohm resistor, 470k ohm on secondard side of the bridge with 1000uF cap for smoothing, goes into the opto, also works perfectly. But safety is the concern.

i cannot make up my mind on what else i can do here or somehow perfect what i have with either option 1 or 2.

looking forward for some feedback.

thank you.
 

dendad

Joined Feb 20, 2016
4,451
You could replace the 20K resistor with a 100nF snubber , or a mains rated capacitor.
Add a 100R resistor in series for surge limiting.
 

Thread Starter

ammarqs153

Joined Feb 15, 2016
14
Capture.PNGCapture2.PNG

these are the 2 circuits i mentioned above. sorry for uploading these late.
if someone can convince me that the 2nd circuit is not safe, i will go ahead with that. i really want someone to convince me that it isnt safe, my gut feeling is telling me not to move forward with this but i am not seeing much other options here.
 

DickCappels

Joined Aug 21, 2008
10,153
The second circuit would take care of your heat problem but I would use a higher value inrush resistor like several k depending on what the rectifiers can safely take. A fuse on the AC input is a good idea.
 

Thread Starter

ammarqs153

Joined Feb 15, 2016
14
The second circuit would take care of your heat problem but I would use a higher value inrush resistor like several k depending on what the rectifiers can safely take. A fuse on the AC input is a good idea.
my R15 is 10 Ohm for current limit to cap, and my R16 is around 470K. rectifier is rated safe. i am safely testing the second circuit for 3 days straight but no issues, the only issue is me being paranoid about a capacitor limiting circuit.
 

Thread Starter

ammarqs153

Joined Feb 15, 2016
14
I am working on a thrid solution here, probably the most hassle free. i would like to share with other who might find it useful.
I MIGHT use this PCB mount power supply and drive my optocoupler with a 330 ohm resistor. simple. This is going to provide me with isolation, easy troubleshooting and replacement if anything goes wrong.
Capture3.PNG
This is still under works, i would love to hear the feedback. Yes this will end up being a couple dollars expensive comparatively, but considering some other factors here (personal opinions), this might be the best way.
 

Sensacell

Joined Jun 19, 2012
3,432
This is my favorite circuit for this application, it dissipates very little power and can be built with low voltage rated parts and1/4 watt resistors.
It's fiendishly clever.

Also no need for fancy accross the line rated capacitors.

Read the notes on the document.

It outputs pulses, but you can stretch the pulse into a DC level by placing a capacitor to GND on the output and a higher value pull up resistor -(R5).
 

Attachments

Last edited:

Ian0

Joined Aug 7, 2020
9,667
if someone can convince me that the 2nd circuit is not safe, i will go ahead with that. i really want someone to convince me that it isnt safe, my gut feeling is telling me not to move forward with this but i am not seeing much other options here.
It's extremely common and perfectly safe if built with Class-X capacitors and sufficiently large creepage and clearance gaps on the circuit board.
 

Ian0

Joined Aug 7, 2020
9,667
If you want a version of circuit #2 with reduced component count, try this:
3D68CC93-ABEA-495C-A7E2-E7CCEAD0FF66.jpeg
if you want to reduce the component count even further, just use a small relay with a 120V AC coil.
 

Ian0

Joined Aug 7, 2020
9,667
Isnt class X supposed to be installed within L and N. mine in in-line of L.
The most arduous conditions it faces is when connected across live and neutral, and it is designed and tested to survive them. It can be used anywhere you need a film capacitor, provided that its current and voltage ratings are not exceeded, and you don’t mind its relatively poor accuracy.
 

Thread Starter

ammarqs153

Joined Feb 15, 2016
14
The most arduous conditions it faces is when connected across live and neutral, and it is designed and tested to survive them. It can be used anywhere you need a film capacitor, provided that its current and voltage ratings are not exceeded, and you don’t mind its relatively poor accuracy.
I see. i just bought a X2 rated cap, 0.33uF 275 VAC.
Will use my current circuit and replace the input cap by this: https://www.digikey.com/en/products/detail/kemet/R46KI333040N0M/10063712

Thank you for the feedback.
 
There is a couple of optocouplers by Avago, now Broadcom that detect AC. Then there is a gazillion standard modules that fit on a standard backplane for detecting various voltages. They are called I/O modules. You can find them with logic voltages of 5, 15 and 24V.

You have ones for output and ones for input. They come in single module and a quad pack.

The BUS I/O system from Gravitech is essentially the same thing except the modules are not potted.
 

dcbingaman

Joined Jun 30, 2021
1,065
Another option:
Use a step down transformer (120VAC) to say 5VAC. It can be an extremely lower power transformer as we plan to pull practically no current. Rectify and filter the output, then send to a comparator with reference voltage. You get the isolation from the transformer and you get an easy to work with voltage from the output of the transformer.

On secondary side of transformer, requirements very easy:
120VAC_TO_5V_DIGITALPNG.PNG

You don't need a very expensive transformer, this 6V one for $2.30 will work fine:

https://www.digikey.com/en/products/detail/zettler-magnetics/BV301S06006-ZU/12093244
 
Last edited:

Ian0

Joined Aug 7, 2020
9,667
Another option:
Use a step down transformer (120VAC) to say 5VAC. It can be an extremely lower power transformer as we plan to pull practically no current. Rectify and filter the output, then send to a comparator with reference voltage. You get the isolation from the transformer and you get an easy to work with voltage from the output of the transformer.
This one does an excellent job:
https://uk.rs-online.com/web/p/toroidal-transformers/1243841/
I use it to measure mains voltages - it has extremely low phase shift

This one is adequate:
https://uk.rs-online.com/web/p/pcb-transformers/1617801
A little bit of phase-shift at 50Hz, and very little response above 1kHz (which may be a good thing)

This one is terrible:
https://uk.rs-online.com/web/p/pcb-transformers/1707407
It's designed to run in saturation. The input/output relationship is non-linear, and it runs ridiculously hot.
 
Top