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.

TTL level detection of 120vac

Status
Not open for further replies.

Mike_2545

Super Moderator
I have been working on a circuit to be able to tell a logic level device, i.e. micro controller, or other TTL device, whether a 120 vac circuit is actuated. I could use a transformer/power supply but would like to accomplish this with as few parts as possible.

I have sketched out what I think will work and but thought about running it by the group to get feedback.

Mike 2545
 

Attachments

  • 120V AC turn on led.pdf
    331.5 KB · Views: 655
I have been working on a circuit to be able to tell a logic level device, i.e. micro controller, or other TTL device, whether a 120 vac circuit is actuated. I could use a transformer/power supply but would like to accomplish this with as few parts as possible.

I have sketched out what I think will work and but thought about running it by the group to get feedback.

Mike 2545

That should work fine. Using optical isolation is a very good idea for this kind of application. In construction, I would build the circuit as a small module and mounted it away (and covered) from the low voltage circuitry that it's feeding. I would specify a higher voltage rating for the capacitor and one try and find one that is safety rated for direct connection to line voltage.

Lefty
 
I see Mouser has some rated 180vac for a few dimes.

Physical isolation is a good idea as well. Thanks

Mike2545
 
You should add a resistor in series with the 0.27uF capacitor to minimize surge current when the circuit is first plugged in. 470Ω or so will keep the max surge current below 0.4Amps but still be small enough not to dissipate too much power.
 
Would a larger voltage rated capacitor, say 240vac work just as well? Or are you concerned with another component?

Mike2545
 
I would probably skip some parts on the HighVoltage section but filter the output of it to keep component pricing as cheap as possible.

One Capacitor and a resistor in serie with the OptoCoupler led, a diode in reverse, should be enough. X2 grade or better on the AC section. Still possible to switch to AC optocoupler type to avoid the extra diode.

On the low voltage side, you could still skip the filtering and detect pulses/frequency.
 
Last edited:
Would a larger voltage rated capacitor, say 240vac work just as well? Or are you concerned with another component?Mike2545
It is mainly to relieve stress on the zener diode and the 0.27uF capacitor. Think of what happens if the circuit is plugged in just as the 120Vrms 60Hz waveform is at it's peak of apx 170V! A very large surge current flows and is only limited by the resistance of the house wiring, etc.
mister_e's idea is good also, especially if you want to eliminate even more parts.
 
You could use a 120VAC SPST relay coil, whose contacts are wired as a switch with one end tied to positive and the opposite end grounded through a resistor feeding the logic input. Total of two parts for this circuit.
 
Kchrste,
I think I'll order up some parts and throw it on the scope to see how it behaves.

shockjok,
the less 'noise' the better. relays are inherently a poor choice, especially for digital circuitry. You have the contact bounce factor, fly back and mechanical limits of the device.

I think the part count is OK. It will make a nice small footprint without any big expensive component like a transformer...or relay
 
Last edited:
Mike,
using a LED in the Vac section and moving the capacitor to the +5V side of the opto, you can have a simpler circuit and a "status light" on the Vac side too. See the attached scheme.
 

Attachments

  • SCAN_0002.jpg
    SCAN_0002.jpg
    24.5 KB · Views: 492
A slightly different approach. I saw this somewhere, but can't reference it, and haven't tried it. Rather than detecting the 120 volts AC, needing high voltage capacitors and high (relatively) wattage surge resistors, it detects "current" flowing in the activated 120VAC circuit. The diodes D1-D4 need to be sized to handle the peak AC voltage and current. R1 is a 1/8W low-ohm resistor.

Just another idea. ;)

Ken
 

Attachments

  • Line Detector.gif
    Line Detector.gif
    7.4 KB · Views: 392
Last edited:
A slightly different approach. I saw this somewhere, but can't reference it, and haven't tried it. Rather than detecting the 120 volts AC, needing high voltage capacitors and high (relatively) wattage surge resistors, it detects "current" flowing in the activated 120VAC circuit. The diodes D1-D4 need to be sized to handle the peak AC voltage and current. R1 is a 1/8W low-ohm resistor.

Just another idea. ;)

Ken

I like that circuit. With out high voltage caps it should take up less space.

It is load dependent, but sometimes that is a plus, in that a voltage detector may tell your logic that the light is on, but if the bulb is burned out there is no light on ;)

Lefty
 
I just got some miniature high voltage caps(.27mf), less then 1/2" and I used the 1n5338 zener diode which is plenty heavy. Threw it on the scope and got a 5.3v saw tooth waveform.
I have to admit when I turned on the isolation transformer I was half expecting blue smoke, but the led lit and everything is working fine.

I may play around with some of the other suggestions and ideas but I'm more than happy with the way this is working.

Thanks for your input.

Mike2545
 
If mechanical noise is your problem with the relay, why not use a solid state relay?

180v Cap .22
optoisolator .25
diodes .16
Elect/Cap .08
resistor .01
Total .72

Solid state relay 4.29

Knowing how to think... Priceless
 
No really, the relay idea is perfectly acceptable for some applications.
As you can see from this one simple need, there are many different ways to accomplish the same objective. Each has pros and cons.
 
If mechanical noise is your problem with the relay, why not use a solid state relay?

I think you are thinking backwards. The OP wanted to detect a 120VAC circuit and feed a µC. The input to an SSR is the low voltage side and the output is the high voltage AC side...mostly. I suppose you could call a optoisolator an SSR if that is what you were thinking, but it's not usually referred to that.

Ken
 
Correction

I should reflect the correct price for a 120vac solid state relay:
Quote:
If mechanical noise is your problem with the relay, why not use a solid state relay?

180v Cap .22
optoisolator .25
diodes .16
Elect/Cap .08
resistor .01
Total .72

Solid state relay 4.29

Knowing how to think... Priceless
Solid State Relay link:
G3NA-220B-AC100-120

$24.43 vs. $0.75
 
I should reflect the correct price for a 120vac solid state relay:

Solid State Relay link:
G3NA-220B-AC100-120

$24.43 vs. $0.75

Mike,

I support your cheap solution with the photocoupler, but you seem to be comparing the prices of apples and steak dinners, as a snack. That SSR is a high power "triac" output relay. Though the VAC input range is usable, the thyristor output would not work switching the 5V "DC" input to a µC.

Ken
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top