detect AC voltage

I've got a project in mind wherein I need to simply detect if there is 120VAC flowing through a wire that's in a completely separate circuit. The easiest way I could think to do this was to put a 120VAC coil relay in parallel with the circuit I want to monitor. I'd put the 5V from the arduino on the contactor side of that relay, then feed that into an input pin. If the pin is high, then the 120VAC is on. But there are so many components out there that I don't know about that I thought maybe there'd be a neater way with only one or two components (like I can with a relay). Anyone have any ideas? Thanks as always.

should probably mention I want to do this on the cheap. I know there are some neato 5V power supply modules out there, that'd be cool beans but they're like $20 each and I need 4. Too much. Thanks again.

Not sure of the exact specs to this type of sensor, but I remember reading about a guy who did this by winding insulated wire around the mains-wire and measuring the voltage induced in the coil. Sorta like a transformer..

I guess you could wind a wire around the 120VAC mains wire you want to monitor, and measure the voltage coming off this coil with a multimeter. Building rectifier is pretty simple stuff, using 4 diodes and a capasitor. (you'll need one as the voltage coming off the coil wrapped around the mains wire will also be AC).

Coming from a different angle, could you use a small power transformer (like a mobile phone charger) to step the voltage down to 5V, then just detect it on a digital pin?

You'd have to hack up the power pack if you don't have a standard outlet, and I guess you'd have to be confident in your ability to work with high voltages.

Coming from a different angle, could you use a small power transformer (like a mobile phone charger) to step the voltage down to 5V, then just detect it on a digital pin?

You'd have to hack up the power pack if you don't have a standard outlet, and I guess you'd have to be confident in your ability to work with high voltages.

What trialex proposes seems like a better solution. At least you would be sure it worked without all the hassle of figuring out the amound of windings needed to get a readable voltage. :stuck_out_tongue: Just hack open a 120VAC/5VDC transformer and hook the primary coil up in series with the equipment on the power outlet (break one 120V wire and hook the two ends up to the two pins on the primary coil of the transformer).

But like he sais, working with mains voltage isn't the thing for you unless you know what you are doing! It could very well kill you, and if you survive but don't use the correct equipment or thick/robust enough wires it might burn down your house (again as likely killing you as not). To dampen your christmas DIY spirit even more.. if your house burns down due to you tampering with mains wireing, your insurance company will just say "FU asshat, we ain't paying because you just had to hack apart your mains wire!". That would kinda suck... -_-'

Kids, trialex has a great idea, but the moral here is: play with fire (or rather high voltage electricity) and you could get burned! So unless you are confident in your abilities.. just don't. :wink:

Meh. 120v is nothing compared to our 240v when it comes to killing power. ;D
I've had a number of nasty zaps.

With Trialex's idea you could even use two halves of a rectifier and you'd be able to detect the phase. :slight_smile:

Meh. 120v is nothing compared to our 240v when it comes to killing power. ;D
I've had a number of nasty zaps.

With Trialex's idea you could even use two halves of a rectifier and you'd be able to detect the phase. :slight_smile:

True, true.. 120V is for girliemen! Are you a girliemaaan? 240V for real men! :sunglasses:

Still haven't managed to get zapped by 240V mains, but I did get a good bang off of the flyback transformer in an old CRT-monitor rated at 30-40.000V. Of course, the current in something like that is dissapearingly small, but my vision still vent black for a fraciton of a second there. Scary stuff. ^^

Hi,
sometimes the first ideas are the best ones.
Use the relais - job done!

BTW. Take care with all voltages above 24V. 65V can kill a horse (or your dog, cat whatever..)
Got zapped several times, nothing happend?
Wait until you caught a flew! Zapp! Heart goes out of sync, family cashes the life-insurance.

Just a wakeup call from a electrician...

Eberhard

Hi,
BTW. Take care with all voltages above 24V. 65V can kill a horse (or your dog, cat whatever..)
Got zapped several times, nothing happend?
Wait until you caught a flew! Zapp! Heart goes out of sync, family cashes the life-insurance.

Ahem, don't mean to be a downer, but what kind of insane worst case scenario is this taken from? U=R*I man.. It ain't the voltage that kills, it's the current. 0.06A to be more spesific. 0.06A across the heart will cause instant heartfailure in most all cases.

U=65V, I=0.06A

R=65V/0.06A

R=1084Ohm.

Correct me if I'm wrong, but to fint a path for the current going throught the heart that has an electrical resistance of only 1KOhm, would you not have to pretty much stab a person in the heart with 2 electrodes?

Again, I might just be an asshat, and I am not trying to be a know-it-all but advicing against working with anything above 24V 'cause it can kill a horse seems a bit like Christian fanatics screaming that you should shun Marylin Manson and Ozzy Osbourne 'cause going to a concert with one of them will surely land you a private reservation in the inner circles of Hell. :wink:

Hi,

Ahem, don't mean to be a downer, but what kind of insane worst case scenario is this taken from?

It's from the german laws that where made to prevent severe accidents caused by electrical appliances.

Wikipedia says : Electrical injury - Wikipedia

It is sometimes suggested that human lethality is most common with alternating current at 100-250 volts, however death has occurred from supplies as low as 32 volts and supplies at over 250 volts frequently cause fatalities.

Worst case? Yes.

Don't miss the next question in our series :
Do I really have to wear a seatbelt when driving slowly?

Eberhard

Ok, so I guess I'm an asshat then.. ::slight_smile: Heh..

However, what we learned in school (that 0.065A is the border between lethal/nonlethal) and what my multimeter tells me is my hand-to-hand electrical resistance (Mega-ohms, if I'm not mistaken) leads me to think playing with 24V is pretty safe. I=24V/1MOhm = 0,000024A That's 24microamps.. 2700x less current than what might be lethal to a healthy human.

But I might be wrong, and die from playing with a 12V transformer. Then again, I might slip and fall down some stairs, get hit by a car or quite simply try to eat the transformer whole, choke and die. Should any of the above occur, my tombstone will say "Darwinism at work. One less retard in the gene-pool." :wink:

Best not to tempt fate with mains.
I wouldnt worry about 24v at all though.

The odd thing is that every single time I've been zapped, I've never been deliberately doing anything with mains.
Heck. One time was a 300v discharge from a camera flash which ran off 4 AAs.

Thanks for all the replies....the voltage discussion was a welcome piece of humor to my morning :slight_smile:

I'm comfortable around 120VAC, no worries there. I've been tickled enough to know how to be safe, and yes, it's for girliemen, and I'm a girlieman when it comes to voltage, I'll admit it. 120VAC is as high as I go. I've been wanting to build a nixie clock for a long time and the voltage is keeping me away. Something about 180V and DC that doesn't sit well with me.

And you know, I thought of that charger power supply idea and I wouldn't have to hack up the power supply. The current here is tiny, so I could just get a female plug at the hardware store, put it on a piece of lamp cord, and attach the other end of the lamp cord to what I want to monitor. Then when that 120VAC is on, so's the plug. Then I just plug in the 5V wall wart and attach the other end (I'd chop that off, but's 5V) to my pin.

That windings idea is neat though, and virtually free. I'll have to check that out :slight_smile: THANKS!

I'd suggest staying away from messing with the 120VAC directly if you've not had some basic electrical (not electronic) training. If you make a mistake with the Arduino, you fry a $4 ATmega or a $34 board. Make a mistake with 120/240, you can kill someone, burn your house down, etc.

Not sure where you're getting your power supplies (for $20 each I'm guessing Radio Shack), but in about a minute I found several different 5V regulated wall warts for less than $6 at my favorite surplus places, All Electronics and BG Micro. For less than $2, you can get an unregulated supply that, combined with a regulator or maybe just a diode, would do the trick.

You do have a junk box, right? The box/drawer/closet/spare bedroom where you stash all the electronics that don't quite work, but you're not ready to throw out? Look at the power supplies there. An oddball 4.3V cell phone charger will be enough to trigger the 5VTTL input on the Arduino.

Go to your favorite discount store, look at off-brand cell phone/iPod chargers. If it's got a USB jack type connector, that's regulated 5V ready to go.

If I were going to try and do this with 120VAC directly, I'd look at using direct rectification of the AC, add a capacitor to filter it a bit, and interface that with an appropriate optoisolator. And fuses. And insulation. And testing. Lots of testing.

-j

Don't miss the next question in our series :
Do I really have to wear a seatbelt when driving slowly?

LOL... :smiley:

--Phil.

quite simply try to eat the transformer whole, choke and die.

LOL and I'm sure there's a bad pun in there somewhere...

--Phil.

Using a small transformer in series with your load will probably seriously limit the current that can flow in your load. The idea of wrapping a few turns around one of your 120V lines isn't too bad--it gives you good isolation from the 120V. However, to rectify the signal you will need to develop at least 400mV in your home-brew secondary. All is not lost though. You can use a cheap op-amp to amplify the signal enough to use a simple diode rectifier circuit.

The reason you don't want to wrap turns around both wires in your 120V connection is that the currents cancel & you won't get any signal at all (except maybe from some fringing effects).

Mark

To wrap up a coil in one of the 120v. wire is a good solution, but aditional circuitry is necessary.

A relay that works with 120v. is simple but not exactly cheap.

To use directly 120v. reducing voltage throw resistors and diodes is possible, but not safe.

To hack an ac adaptor is not cheap too.

But tell me one thing: do you need to know if the wires have exactly 120v.? Or the wires are connected to a 120v. socket and you just need to know if the voltage on it is high [on] (you already know is almost 120v. and don't need to confirm) or 0v.[off]?

In affirmative case, you can use another simple solution too:

to put a [small 120v. neon lamp+resistor in series] connected to 120v. wires, and use a [ldr+resistor] to switch 5v. when light is on (logic 1) to Arduino pin. A home made photocoupler (remember to put them together and isolate, inside some small closed box.

That's exactly what I need to know (or need the arduino to know), just whether it's on or not, and that's a pretty sweet solution. I've got some of those neon lights with matching resistors kicking around already too.

BTW, I'll tell you all what this is for, maybe you can offer other advice about it, more brains are better. I live in the Northeast US, cold in the winter, oil fired boiler with big old radiators. I have three zones. I'd like to be able to track time and duration of the boiler firing and the zones' calls for heat so I can track my oil usage and find out which zone is burning the most oil at what time of day, etc, etc. So the 120VAC I want to detect are going to the circulator pumps (3 zones) plus the boiler thermostat that activates the big transformer. I already put my meter on it so I know just where to hook this up.

Those circulator pumps are likely controlled by relays, and the relay coil voltage is probably something like 24VAC. It may be possible to tap the control lines instead of the power lines.

-j