Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Sense 120VAC

Status
Not open for further replies.

jack0987

Member
I need to know if the 120 VAC line is hot and get an isolated 5VDC output.

I googled up two design ideas (please see images). I would like something like them.

I like the first one because it uses a 4N33 (which I have on hand) but it may not be the best one to use.

Please advise. Thanks.

SenseCircuit1-2.jpg




SenseCircuit2-small.png
 
The first thing will provide a pulsating output. The second one will provide a somewhat steady DC voltage. But that same filtering action will hold the output high for a few dozen milliseconds after the power is removed.
 
For a few bucks I would just get a 5V DC Wall Power Adapter UL Listed Power Supply (5-Feet, 5V 500mA) and call it a day. You get a line isolated power supply already enclosed. I have seen them for under $4 USD. While I have several in a bucket if I wanted what you seem to be looking for I would just use a wall wort to drive a DI on your Arduino. I would also place a bleeder resistor at the DI.

Ron
 
Circuit #1, R2 needs to be much higher value for 120V. Needs a capacitor on the output.
Circuit #2, Probably needs a diode across the input of the isolator. I like the capacitor in the output.

I can't find the part number(s) now but some time back this question came up and I found parts that have two diodes in the input. So plus or negative current will work.
You can make a full wave bridge, 4 diodes, ahead of the isolator so current will flow in the + and in the - half of the cycle. This really helps the output.

-----edit-----

Here is the old thread on the same subject. You might want to start at #1. Remember that some of the advice here is not right. Anything that RonSimpson said is questionable. #17 shows a isolator that works with AC.
https://www.electro-tech-online.com/threads/120-vac-voltage-detection.151860/#post-1304912
 
Last edited:
Thanks so much for the quality replies.

For a few bucks I would just get a 5V DC Wall Power Adapter UL Listed Power Supply (5-Feet, 5V 500mA) and call it a day. You get a line isolated power supply already enclosed. I have seen them for under $4 USD. While I have several in a bucket if I wanted what you seem to be looking for I would just use a wall wort to drive a DI on your Arduino. I would also place a bleeder resistor at the DI.

Ron

I would definitely go your way Ron if I was only sensing one AC line, but I will be doing over twenty just for starters.
Cheap wall power adaptors are available, but the reviews are poor at best. I would like something that will last for years.

Based on the comments above, the following image is my suggestion.

SenseCircuit1-2.jpg


My electronics knowledge is quite basic.

What value and wattage should R2 be?

I have lots of diodes for D1, D2, D3, and D4.
They are 1N715, 1N829, 1N914, 1n4005, and 1N4004.
Which one do you think or something else?

Should I add a cap from the rectifier output to ground?

As an afterthought, I wonder if a neon light and a phototransistor combo might be a simpler, cheaper, better solution. If you think so, could you please suggest a part number for each.

Thanks.
 
Last edited:
A capacitor on the input or output of the OK1 will help.
I changed the diodes connections.
Use any small low voltage diodes. They will only see 1.5 volts. 1N914 will work fine.
upload_2018-8-13_21-52-28.png

R2: Many small resistor can not handle line voltages. You might use two resistors so each resistor only sees 1/2 of the line voltage. Put one resistor on line-1 and the other resistor on line-2.
R2: Value?? Pin 4/5 current is 1mA. The CTR for the 4N33 is 500% min, but that is at one point. At low current (and temperature) the CTR might be as low as 100%. So you need at least 1mA on the LED. 120k ohms will get you 1mA. (use two 68k resistors)
1mA * 120V = 120mW
 
Last edited:
If you need to stay cheap and aren't worried about 16mS (or 20mS if 50Hz) overshoot then the simple method without the bridge can be supplemented by software. The software can assume off if no input for 16mS otherwise it's on. Doing this in software is trivial and flexible.

Mike.
 
a company i worked for in the early 1980s made audio power amplifiers. in the protection circuit there was a transistor driven from a diode and RC filter, that would shut off the speaker relay when the AC line went down. the circuit ran from the 12V secondary of the transformer, and the RC time constant was set to 1 cycle of the AC line (16.6mS for 60hz power, 20mS for 50hz).
 
Oh, yeah.
I remember the loud "thump" heard when turning on or off a transistorized audio amp.
Better amplifiers would have an output relay as you mention.
 
I would definitely go your way Ron if I was only sensing one AC line, but I will be doing over twenty just for starters.
Cheap wall power adaptors are available, but the reviews are poor at best. I would like something that will last for years.
That does change things. I have seen complete boards with 8 and 16 channels but if you want to roll your own you may want to try using an AC optocoupler which will conduct on the alternating halves of your AC line signal. The H11AA1 is popular for applications like this. Here is an example of what you seem to want. I would likely place a resistor on the Hi and Low AC Mains side input and adjust the resistance accordingly for 120 VAC verse 220 VAC. Once you get a good working prototype you can likely have a few 8 channel boards made.

Ron
 
I thought about that as I have a few I really like using. Then I thought about the original poster mentioned looking at 20 lines. You can build a touch less sensor but making 20 of them and then figuring the spacing of the AC lines and proximity of each sensor I sort of discounted it. I guess it depends on the whole setup.

Ron
 
If you need to stay cheap and aren't worried about 16mS (or 20mS if 50Hz) overshoot then the simple method without the bridge can be supplemented by software. The software can assume off if no input for 16mS otherwise it's on. Doing this in software is trivial and flexible.

Mike.

Thanks. This is a possibility as the overshoot would not matter for me.
I would, however, like to avoid debounce processing if possible.
 
You wouldn't need any debounce. Whenever you detect a voltage you set a counter to 17. Each millisecond you decrement the counter. If the counter gets to zero then the signal has gone.

The fact you see any voltage is an indication that the power has been switched on, any bouncing will have ceased long before the 16mS has passed.

Mike.
 
That does change things. I have seen complete boards with 8 and 16 channels but if you want to roll your own you may want to try using an AC optocoupler which will conduct on the alternating halves of your AC line signal. The H11AA1 is popular for applications like this. Here is an example of what you seem to want. I would likely place a resistor on the Hi and Low AC Mains side input and adjust the resistance accordingly for 120 VAC verse 220 VAC. Once you get a good working prototype you can likely have a few 8 channel boards made.

Ron

This is very interesting and I do like it's simplicity. I may very well go with this.
I will make the boards here in the end.
 
You wouldn't need any debounce. Whenever you detect a voltage you set a counter to 17. Each millisecond you decrement the counter. If the counter gets to zero then the signal has gone.

The fact you see any voltage is an indication that the power has been switched on, any bouncing will have ceased long before the 16mS has passed.

Mike.

Hmm! I have misunderstood. Thanks. Let me study more.
 
A capacitor on the input or output of the OK1 will help.

R2: Many small resistor can not handle line voltages. You might use two resistors so each resistor only sees 1/2 of the line voltage. Put one resistor on line-1 and the other resistor on line-2.

For Resistor placement, do you mean like this?
Do you think placing the cap on the input may be better?
SenseCircuit3.png
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top