# DC voltage on an AC line

Discussion in 'Electronic Projects Design/Ideas/Reviews' started by embedded_sys, Sep 28, 2017.

1. ### embedded_sysNew Member

Joined:
Sep 8, 2017
Messages:
22
Likes:
1
Thanks for the explanation of the different components. I did realize C1, R4, R5, R6, and L2 were just representations of the wires and relay. I didn't realize V3 and V4 could be used in a simulation that way. Very cool.

I tested the circuit today, and it worked great. I had to adjust a few resistor values to match the environment, but it worked out. I do have a question about the V1 source. This voltage, 3.3VDC comes from the MCU's PSU. Why is it okay to connect a 120VAC main line to a 3.3VDC voltage source with a resistor? That through me when I saw it in your simulation, and although it works, I'm confused why it didn't burn something out. It appears safe, but is it?

2. ### MikeMlWell-Known MemberMost Helpful Member

Joined:
Mar 17, 2009
Messages:
11,139
Likes:
566
Location:
AZ 86334
It is all about power dissipation in the resistors. When I did the sim, I was thinking that the ac voltage was the standard US 120v, and the power dissipation in the resistors I showed was under 150mW. At 240V, you should redo the power dissipation calculation, and maybe use 1/2W resistors. Goal should be that the resistors dissipate less than half their rated power, and have less than half of their rated voltage across them.

Standard metal film resistors and chip resistors have a breakdown voltage rating that you must verify. It might be prudent to use two resistors in-series, both to reduce the voltage across each resistor by half, and also to reduce the power dissipation in each resistor.

Last edited: Oct 4, 2017
3. ### embedded_sysNew Member

Joined:
Sep 8, 2017
Messages:
22
Likes:
1
I am using the US standard 120VAC. The resistance of the line measured from the beginning was close to 4.9K ohms. I've decided to stick with the original 100k ohm resistor you had in your simulation. I get about 154mV if there is no fault in the line and much more if there is a fault.

I have a few other lines I detect to see if they have voltage (120VAC). I use a resistor in series with an opto coupler. Seeing that a resistor can used to connect a main line with a DC voltage source, I wonder when an opto coupler is necessary vs the use of a resistor? At what point will connecting the AC line voltage to the DC voltage source with a 100K ohm resistor fail? I suppose the first post to this thread, which is quoted below, concerns me when it says lethal. Your simulation and my breadboard implementation are both working without "lethal" consequences.

Last edited: Oct 4, 2017

Joined:
Jan 12, 1997
Messages:
-
Likes:
0

5. ### MikeMlWell-Known MemberMost Helpful Member

Joined:
Mar 17, 2009
Messages:
11,139
Likes:
566
Location:
AZ 86334

If it is a standard opto-coupler, you can use a resistor-capacitor-diode network on the LED side to both limit current, limit dissipation, limit reverse-voltage breakdown. Here is how I would make an isolated AC detector:

V(out) is yellow
Current into the optop is red
Power in R2 is Green (Time average of R2 power is in the box)

R2 limits peak in-rush
R4 discharges C1 when no ac is present.
D2 prevents reverse voltage across LED. It can be a visual LED as an indicator of AC on.

6. ### embedded_sysNew Member

Joined:
Sep 8, 2017
Messages:
22
Likes:
1
Okay, so this will be the final design. D1 is to ensure that V2 doesn't see voltage greater than 5V. Output goes directly to my processor's ADC. There isn't opto-isolation, so I am relying on the 100K R4 resistor for power dissipation and the D3 diode for over voltage protection. Any danger?

7. ### MikeMlWell-Known MemberMost Helpful Member

Joined:
Mar 17, 2009
Messages:
11,139
Likes:
566
Location:
AZ 86334
You cannot put a 4.7V Zener in parallel with a 5.0V Power Supply without having a current-limiting resistor between V2 and the Cathode of D1. It will blow-up the Zener. A 3.3V supply and a 4.7V Zener could co-exist without the resistor.

Here it is with a 220 Ω resistor between the 5V supply and the Zener. I plot the currents through R1 and R3. Note that even with the Line voltage at its peak of ~170V, the current through R3 is always from the 5V source toward the Zener, meaning that you are never injecting current back into the supply.

You really do not need D2. Since the current sourced by R1 is a peak of ~1.6mA when the line voltage is at its maximum of +170V, then even if 1.6ma flows backwards into the 5V supply, that just reduces the total load on the 5V supply by 1.6mA. Assuming that the 5V supply has a minimum load of several tens of mA, then the supply voltage will not increase. Another way of saying this is at the line swings from +170V to -170V, the current in/out of the 5V supply swings from -1.6mA to +1.6mA. With a 3.3V logic supply, a 4.7V will not conduct except when the line is struck by lightning, which if it is 1500ft long, is not all than unlikely.

Last edited: Oct 5, 2017
8. ### dr pepperWell-Known MemberMost Helpful Member

Joined:
Oct 6, 2008
Messages:
4,757
Likes:
258
Location:
North west UK
Thats pretty nifty mike.
One thing I'll add you can get auxilliary contact blocks that attach to the side of mcb circuit breakers, so you could add overload detection too if you wanted it.

9. ### embedded_sysNew Member

Joined:
Sep 8, 2017
Messages:
22
Likes:
1
With my MCU only 3.3VDC compatible, I will make V2=3.3VDC and want the zener diode (D2) to have a breakdown voltage of 3.3VDC. Could I use this (MM2Z3V3B) surface mount component?