Wednesday, March 05, 2008

Non contact Voltage Presence Measuring for Appliance Modification

So I have been wondering about non-contact measurement of voltage in AC wire.  I want to know when my espresso machine is brewing so I can turn on a shot timer.   I tried and tried looking around on-line, and eventually I realized to would faster to actually try it with my own hands, duh...  

I carefully cut a slot between the two wires in an extension cord and wrapped one side with some thin insulted wire (i had some 30 gauge wire-wrap stuff from radio shack around). I wrapped it 8 times and added a resistor in series to make some voltage from any induced current. Low and behold, I can measure voltage between the two ends of the coil! At first, it was better with the AC voltage measure on my multimeter. So I swapped the resistor for a garden variety diode (i wish i had diodes in my garden), and low behold I can see 0.2 V dc!

So this setup essentially detects if my extension cord is plugged in or not.
- One twist that came up is that this extension cord has a dimmer switch in it (an inside resistor between the wall and the sensor). If switch the dimmer switch to the on mode, I am actually see when the light turns on or not. With the light off and the dimming on, I see about 0.015 volts. With the light on, it jumps up to 0.1v. With the dimmer off, it appears flat at .2 volts regardless of the lamp.

Interestingly, the voltage is positive or negative depending on the direction i set the diode. I'm sure there is a good explanation for that. 

Now I want to measure this voltage with the analog inputs on my Arduino. From there, all sort of things are possible. For example, it now means that folks modifying appliances can sense current inside the appliance without interrupting the power circuits!  I'm talking to you, Rancilio Silvia modders who want to make arduino shot timers or watch the steam switch and change the target temperature on your home-made temperature controllers.  Yeah, you. ;)

A bunch of good comments and feedback coming in here.  Thanks all.  Tips ranging on better ways to do this, to why this doesn't work.  So take this with a grain of salt! One comment on hackaday mentions that that detects current, not voltage.  That doesn't add up to me since it detects if an extension cord is plugged in, regardless of whether there is current passing through (anything actually on).  Perhaps this is detecting neither current nor voltage, but detecting a magnetic field around the wire (linked to voltage presence...)?  I'm trying to dig back in my mind to E&M physics, but alas, all that dribbled out my ears a long time ago.


Karl Patrick Gruenewald said...

Hey Tim - I was googling for more info on this process, and what do you know - here you are! I am going to try this as I've had inconsistent results dissecting the non-contact voltage detector.

Anonymous said...

Since the current is induced by an AC source, it's constantly alternating between positive and negative and the diode blocks either the positive or negative current. Thus you only observe positive or negative voltages depending on the orientation of the diode. It's a half-wave rectifier.

If that was already apparent, I didn't mean to be condescending. If not, I'm glad I could help!

Anonymous said...

@anonymous, good explanation, although I'm fairly sure diodes always block negative current ;)

Anonymous said...

Very cool idea, I was actually looking for a way to detect if the lights in my house was switched on or not (for my homeautomation project) and this seems like a real way of reading the light status without having to cut into any wires. Great job!

Anonymous said...

One can't really be talking about negative and positive here.. makes little sense. =P With AC, the direction of the flow of electrons through the wire alternates. The electrons go from - to +, but which wire is - and which is + changes 50 (or 60) times pr second. The diode only lets current through in one direction, ergo you get DC current that is on for 0.01 seconds, then dead for 0.01, then on again for 0,01. Without the diode, the current would change directions every 0,01 seconds, but the diode cuts away one "phase" of the sine waveform.

Damn.. did NOT mean to write that much! /rant and stuff, got in about 2-3 hours of sleep last night. x(

Anonymous said...

You have built a current transformer. If you put a resistor in parallel with your windings you will get a voltage proportional to the current flowing in your mains wire. Say you used a 100 Ohm resistor and there was 1 Amp flowing in the mains cable and you wound 100 turns around the cable. You would get 1 Amp / 100 = 10mA flowing through your 100 Ohm resistor which gives a voltage of 1 Volt per Amp. You would need to rectify this voltage with a diode and maybe do a bit of smoothing with a cap...

Unknown said...

Diodes always block negative current, but the direction the current is allowed to flow is just reversed when you reverse the diode, so the multimeter just "sees" a negative voltage. but acually the multimeter is now wired up the wrong way.

It will probably be more than 0.2V DC but most multimeters can't measure rectified currents that have not been smoothed.

I would connect a full-wave rectifier, and then a electrolytic capacitor parallel to that, bout 470uF should do the trick. Then you'll be able to measure the acutal voltage the coil produces.

Anonymous said...

I don't get it. whats with the non-contact foolishness? just solder a wire on there allready! if you want isolation use a phototransister and a neon bulb. and if your not comfortable cutting into AC you realy shouldn't be messing with this thing anyway.

Anonymous said...

Be careful with CT's, they pack a hefty punch.


Care must be taken that the secondary of a current transformer is not disconnected from its load while current is flowing in the primary, as this will produce a dangerously high voltage across the open secondary, and may permanently affect the accuracy of the transformer

Anonymous said...

Commercial Current Transformers for this purpose are readily available.

Google for 'Split Core 5v current transformer', and you'll get a lot of results.

CR Magnetics has a large line of them, including split-core, which you can put around your existing extension wire easily:


Anonymous said...

It's useless to wind the wire just around the cable. The coil you are creating with this is vertical to the magnetic field produced by the wire. You should do something like this:
(more effective with an iron-core)

btw: you can't measure voltages at diodes because it's constant when they have reached a specific level, for example 0.7V for Si-Diodes.

Sorry for my bad english... Maybe I just got something wrong...


Anonymous said...

I'm confused. If you want to turn something on after something else is on, isn't this a case for a relay?


Anonymous said...

Dangerous high voltage across the secondary??? Not with a couple of turns of wire around one lead of an extention cord. This how a "Clamp On Ammeter" works,it just gets a tiny sample of the current flowing thru the wire. Having said this... still always be careful working around household AC mains, they can hurt/kill you!

This idea is a great way to easily "sense" if an electrical device is turned on and trigger another device to do something. I believe that is the premise of the article.

Unknown said...

could be a great starting point for a n energy-consumption meter. so simple, yet so powerful!

Anonymous said...

what are the chances of getting your sensor gizmos from frying when your house is near an electrical storm? thanks.

Anonymous said...

Shot measurement

As for measuring the shot duration, my guess is that this isn't the most precise way of doing it.

I suggest using a strain gauge to actually measure tha amount of water by weight instead. This will work even with coffee grinded and packed differently each time, which makes for an inconsistent duration.

You could put the gauge underneath the water container and measure the weight before the shot and while the coffee is being poured. The drop in weight from the water container corresponds to the quantity of coffee dispensed (or spilled).

my 2 cents

thereza said...

Funny, I just tried something similar myself but had no luck. I tried connecting it across a 4M7 resistor, but I couldn't see any induced voltage on my scope.

I'm not sure about the diode idea, but perhaps i'll try it with thinner cord.


Anonymous said...

I came across the exact same problem for the exact same reason. I am working on a stopwatch that is triggered by the brew switch on Silvia.

My solution was a reed switch attached to the side of the three-way.

I was struggling to find a simple way of detecting AC current, when it hit me that the solenoid was already producing a magnetic field, and those are relatively easy to detect. Not only that, it's isolated already, and I can use it as a digital input to the rest of the circuit. :D