Maker Pro
Maker Pro

simplest way to detect 120VAC using a microcontroller

J

Jamie

Jan 1, 1970
0
Hi,

I would like to detect if 3 different 120VAC signals are active using a
microcontroller, is it safe to just use a 1kV ceramic capacitor from the
120VAC signals and feed them into the microcontroller's ADC?

cheers,
Jamie
 
T

tm

Jan 1, 1970
0
Jamie said:
Hi,

I would like to detect if 3 different 120VAC signals are active using a
microcontroller, is it safe to just use a 1kV ceramic capacitor from the
120VAC signals and feed them into the microcontroller's ADC?

cheers,
Jamie

How about three opto-isolators, resistors, and zeners to set thresholds and
provide noise immunity.
 
P

Phil Allison

Jan 1, 1970
0
"tm"
How about three opto-isolators, resistors, and zeners to set thresholds
and provide noise immunity.

** It's easy enough it drive a LED from the AC supply via a suitable cap and
current limiting resistor.

Using 3 optos is the way to go, transistor out is all you need.



..... Phil
 
J

Jan Panteltje

Jan 1, 1970
0
Hi,

I would like to detect if 3 different 120VAC signals are active using a
microcontroller, is it safe to just use a 1kV ceramic capacitor from the
120VAC signals and feed them into the microcontroller's ADC?

cheers,
Jamie

I have used optos in the past.
 
S

Spehro Pefhany

Jan 1, 1970
0
"tm"

** It's easy enough it drive a LED from the AC supply via a suitable cap and
current limiting resistor.

Using 3 optos is the way to go, transistor out is all you need.

AC-input optos (back-to-back LEDs) or precede the opto with a couple
of BAV99s in a bridge configuration.

.... Phil


Best regards,
Spehro Pefhany
 
F

Fred Bartoli

Jan 1, 1970
0
Jamie a écrit :
Hi,

I would like to detect if 3 different 120VAC signals are active using a
microcontroller, is it safe to just use a 1kV ceramic capacitor from the
120VAC signals and feed them into the microcontroller's ADC?

cheers,
Jamie

Yep, perfectly safe: the caps should survive...
 
R

Rich Webb

Jan 1, 1970
0
Hi,

I would like to detect if 3 different 120VAC signals are active using a
microcontroller, is it safe to just use a 1kV ceramic capacitor from the
120VAC signals and feed them into the microcontroller's ADC?

In addition to the other approaches already mentioned:
- A relay with a 120 VAC coil powered from each line.
- An undervoltage sensor (e.g., a relay with tighter spec'd pull-in and
drop-out voltages).
- A loop of nichrome wire and a thermistor.
- A light bulb, a chicken, and a microphone.
 
How about three opto-isolators, resistors, and zeners to set thresholds and
provide noise immunity.

You're going to need a anti-parallel diode across the isolator's diode, at
least. A line-rated capacitor in series with the diode/resistor can reduce
the power dissipated quite a bit (10mA * 240V gets hot). I don't think the
zener is necessary but may be useful.
 
S

Spehro Pefhany

Jan 1, 1970
0
In their new scopes, Tek does this by heatshrinking a piece of normal
hookup wire to the outside of the AC line wiring, making a small-value
capacitor that has the insulation characteristics of the AC wire. It
should be pretty safe to attach that to a uC ADC input, and it'll work
whether the load is drawing any current or not.

He'd probably need a buffer amplifier. PIC ADC inputs, for example,
like to see no more than 10K (2.5K for some newer units). If we put a
20K + 20K voltage divider across Vdd/Vss and capactively couple 120VAC
to the midpoint, and want (say) ~100mV RMS (1 LSB being ~5mV) for
reliable detection, we'd need more than 200pF.

A 'Y' safety type capacitor (typically something like 4kV rating)
_might_ be okay, but I'd use an opto.
 
R

Rich Webb

Jan 1, 1970
0
A field effect chicken?

Nah. When power is lost the light goes out and the chicken roosts. The
lack of "cluck cluck" noise is sensed and thereby used to decide that
power was indeed lost. Not a particularly fast response, and the chicken
has to sleep *sometime* but the eggs are a useful side-effect, as is the
fried chicken when it's time to upgrade to a newer model. ;-)
 
H

hamilton

Jan 1, 1970
0
Yes, I saw that app note as well.

You forgot to mention that the micro-controller was also powered by the
same 120VAC.

So the micro was HOT as respect to neutral.

Not a deign for the faint of heart.

hamilton
 
S

SMS

Jan 1, 1970
0
Hi,

I would like to detect if 3 different 120VAC signals are active using a
microcontroller, is it safe to just use a 1kV ceramic capacitor from the
120VAC signals and feed them into the microcontroller's ADC?

cheers,
Jamie

Use a quad AC Input opto-coupler, i.e. Vishay ILQ620 or NEC PS2505-4 or
equivalent. Look at page 5 of the app note at:
<http://i2c2p.twibright.com/datasheet/6n139_an.pdf>. You'll just need a
pull-up resistor on the collector of each output. Probably don't need
the inverter shown there since you can program the microcontroller for
high or low detection.

Be sure to look at the difference between a DC input and AC input
opto-coupler. You can use a DC input part for AC but you'll need an
external diode.

<http://www.jameco.com/webapp/wcs/st...ay?langId=-1&productId=320725&catalogId=10001>

<http://www.newark.com/jsp/search/productdetail.jsp?SKU=58K1694&CMP=AFC-GB100000001>

Note to our favorite troll: I have no association with Jameco or Newark.
 
J

John S

Jan 1, 1970
0
why an adc input if you only want to detect?

I've seen a microchip appnote where they use a 20M resistor from 220V
to a digital input
for zero cross detection in a dimmer.

the esd diodes clamp the voltage, the resistor limits the current

or just get three tiny transformers, something like 6VAC 0.35VA


-Lasse

I've used this method to check for the presence of line voltage in a
remote location. The circuit has been in service for over 5 years with
no problems (I used several 1/2 watt resistors in series so they would
withstand a few kV of line spike).

John S
 
S

SMS

Jan 1, 1970
0
It looks pretty cool to me, at least for simple a.c. detection. I
just did this differently, using a transformer (I didn't want HV a.c.
close to my device).


He, ah, could um, ah, cut about 5 minutes out of his ah, video, um, if
ah, he'd um, STOP saying "um" and "ah!"

;-)

LOL, ever since being in Toastmasters with the "ah counter" it's much
more noticable when people speak like that, and I try to catch myself
and not do it.
 
Yes, diode, but you do not need 10 mA.
Those optos are linear to much lower currents,
so if you use 100 uA, and the opto does 1:10,
then you have 10 uA in the photo transistor,
10 uA in 5V is about .5 MOmh pullup, OK on a CMOS input pin,
add a small capacitor so it is a lowpass for 50 Hz or 60Hz,
that also protects against spikes, RFI.

The one's I've used get really squirrely at under a mA, and that's when new.
They degrade quite a bit, over time. The specs want 10mA. A series cap can
reduce the power dissipation, though.
 
I would like to detect if 3 different 120VAC signals are active using a
microcontroller, is it safe to just use a 1kV ceramic capacitor from the
120VAC signals and feed them into the microcontroller's ADC?

I have used miniature neon lamps on 220 V and photo darlingtons.

A neon lamp is a high voltage low current device which only requires a
single low power resistor. Any LED light source would require an extra
diode and a high power resistor or some spike suppression if series
capacitance is used.

If it is known that the AC lines are always loaded, you could use
reed relay tubes with some turns around it.
 
S

Spehro Pefhany

Jan 1, 1970
0
The one's I've used get really squirrely at under a mA, and that's when new.
They degrade quite a bit, over time. The specs want 10mA. A series cap can
reduce the power dissipation, though.

They don't degrade as fast if you don't drive the snot out of them.
 
S

sms88

Jan 1, 1970
0
If you're really paranoid, use a two-section RC filter. You can buy a
lot of Rs and Cs for the price and board space of your average opto, and
avoid having the mains wiring on the CPU board. It wasn't my idea, but I
liked it a lot when I saw it.

You can just as easily package a quad optoisolator in an external probe
and run 5 wires back to the CPU board (power, ground, and three signals).
 
S

sms88

Jan 1, 1970
0
But that takes an extra baby board, unless you're talking about roach
wires, and is probably $10 more expensive when you're done. The heat
shrink trick is just like Muntzing your version--clip off two of the
wires, cut off the baby board, and the thing still works.

I would not use a board, I'd dead bug it, inside some heat shrink, using
a surface mount part. It'd cost $2.00 in low quantities, but it's only a
single part in the heat shrink, not a bunch of Rs and Cs cobbled
together messily.
 
P

Phil Allison

Jan 1, 1970
0
"Vladimir Vassilevsky"
The capacitance from the power cord to the sense line would be at the
order of 1pF. We can count on the chassis potential of ~ 1/2 of the mains.


** Not with any scope I ever saw or would want to use - the chassis is
always securely bonded to safety ground.

The OP has not indicated that this is the case with his project, so a method
that involves sensing from active to neutral and isolates both from the uP
is preferable on safety grounds.



..... Phil
 
Top