AC Detector

Thread Starter

Edgar Gil

Joined May 10, 2018
14
Hello guys,

I am designing a uC based device and I want to detect the presence of 240VAC.

I am thinking to use the PS2505 optocoupler, I share with you the datasheet.

I would like to know if I am reading the datasheet correctly

It says forward current is 50mA, and in test says 10mA, I guess any value in between will be good, please let me know if I am wrong.

Assuming a peak current of 30mA, with 240VAC input (aprox 340V peak) we talk a resistor of 11.5kohm for the input.

At the output, it says collector current of 50mA, VCE 0.3V, so I am thinking to limit collector current with a 100ohm resistor.

The uC works at 3.3V, so I want to make the voltage divider with a 200ohm resistor, so output will be 3.3V, and add a 47uC capacitor to filter the ripple and warrantee the high logic output at zero crossing.

I share the schematic I am thinking to use
1724713318618.png

Does my logic make sense and will this work? can someone share any experience with this?

Thank you in advance.
 

Attachments

liaifat85

Joined Sep 12, 2023
200
Given the 240VAC input, which peaks at around 340V, the resistor calculation for limiting the current to 30mA would be:
R=IVpeak=30mA340V=11.33kΩ (Approx.)

You've chosen an 11.5kΩ resistor, which will result in a slightly lower current, closer to: I=340V11.5k ohm=29.6mA (approx.)
This current is within a reasonable range, so your choice of resistor is valid. The design looks OK to me. I suggest you simulate in Proteus or something similar.
In case you are eager to make an IoT AC Current Measuring System, you can see here:
<COMMERCIAL LINK REMOVED BY MODERATOR>
 
Last edited by a moderator:

DickCappels

Joined Aug 21, 2008
10,661
Most small signal resistors are rated at lower voltage, like 200 VDC. To use with 220 VAC inputs you will need two or more resistors in series (in place of the single 11.5k resistor) in order to keep the resistors from breaking down. Check the voltage ratings of the resistors you are using.
 

AnalogKid

Joined Aug 1, 2013
12,126
1. Test conditions in a datasheet usually are chosen for best performance. If the test current for the input LED is 10 mA, design around 10 mA.

2. Absolute maximum ratings never should be use as design points. 50 mA collector current is just below the point at which the manufacturer says the part probably will fail. A uC input pin is a high impedance load, so there is no reason to beat up the optocoupler with unnecessarily high output current. Consider 1 mA to 5 mA as a design point for the output. With 5 mA secondary current, the required CTR is only 50% while the part has a minimum CTR of 80%. That extra 30% is a comfortable design margin.

ak
 

Sensacell

Joined Jun 19, 2012
3,784
Don't forget the power dissipation!

Using an 11.5K dropping resistor results in more than 4 watts of power burning in the resistors!
Power resistors are expensive, large and wasteful.

The attached circuit is my favorite for this application.
It looks complex, but it solves the problem at a very low cost and requires no power resistors.
 

Attachments

AnalogKid

Joined Aug 1, 2013
12,126
I meant to go back and include power dissipation. Lowering the input current often is the only means of reducing the physical size of the input resistor power. A common rule-of-thumb is to make sure all resistors never dissipate more than 50% of their rated power. In this application, I would start with an input current of 2.4 mA (RMS) and an output current of 1 mA. This increases the input resistor value to over 100K, and lowers its power dissipation to 1/2 W. A 1 W part will work where you originally needed a 10 W part. Because this is a 240 V mains application, I would use two 1/2 W parts in series.

ak
 

Ian0

Joined Aug 7, 2020
13,131
If you only wish to detect the presence of AC, not to measure it nor to determine its zero crossing, you could use a class-X capacitor instead of the resistor. You might need a small resistor in series to limit the power on switch-on.
 

MisterBill2

Joined Jan 23, 2018
27,507
Use two 180K resistors, one in each of the mains power leads. That avoids the 200 volt limit and reduces te AC current a bit more. Ot use a pair of 220K resistors, one in each of the mains power leads, and be closer to the 10 milliamps.
 

Skysurfer

Joined Jul 26, 2024
1
If you only wish to detect the presence of AC, not to measure it nor to determine its zero crossing, you could use a class-X capacitor instead of the resistor. You might need a small resistor in series to limit the power on switch-on.
This is also my preferred solution. If only the series resistor is used, too much power is wasted. Another clean solution uses the ISO1211 and is documented here: https://www.ti.com/lit/ab/slla382a/slla382a.pdf
 
Top