Resistor sizing (? Watts)

Thread Starter

CF58

Joined Oct 7, 2022
9
Hello,
I am an electronics novice, so please go easy on me.
I am attempting to make a circuit that detects when mains (AC) voltage is present.
The number of volts and amps is not important, just whether it is on or off.
The voltage state will then be fed back to an MCU (EPS32).
In my circuit, I am using an HCPL3700 IC. According to the datasheet, the correct resistor for my 240V input is 60K.
So, I wired up the circuit with a 60K resistor and everything worked as expected, except for one small issue - the resistor gets VERY hot.
To try and help with the heat problem I changed the circuit to use 2 x 30K resistors (one on the live and one on the neutral) and increased them to 2 watts each.
The circuit still works but the resistors are still getting very hot.
I don't like the heat because I plan to mount the circuit in a plastic enclosure when it is complete and this circuit will be powered 24/7.
Do I have the wrong wattage resistors, or is there a better way to detect AC voltage?
Thanks.
 

boostbuck

Joined Oct 5, 2017
261
The resistor is dissipating about 1 watt by my reckoning, so will get quite hot. 60k seems low for 240V? If you go higher resistance you will reduce wattage, but you'll still have a bit of heat to get rid of to stay within input current requirements.
 

BobTPH

Joined Jun 5, 2013
6,086
The resistor will dissipate nearly 1 Watt, so, yes, it will get hot.

I applaud your use of an optocoupler as it is a safe way to do this. I hesitate to recommend another simpler non-isolated method seeing as you are a novice.
 

Thread Starter

CF58

Joined Oct 7, 2022
9
The resistor will dissipate nearly 1 Watt, so, yes, it will get hot.

I applaud your use of an optocoupler as it is a safe way to do this. I hesitate to recommend another simpler non-isolated method seeing as you are a novice.
Thank you, but it isn't safe if it gets too hot and causes a fire.
 

MrChips

Joined Oct 2, 2009
27,715
One solution is to reduce the 240VAC to some low value such as 6-12V using an AC power transformer. You can get inexpensive AC or DC adapters from a second hand store.
 

Danko

Joined Nov 22, 2017
1,493
I don't like the heat because I plan to mount the circuit in a plastic enclosure when it is complete and this circuit will be powered 24/7.
Use resistor 6.8 kΩ in series with capacitor 51 nF, 600 V instead resistor 60 kΩ.
Then resistor 6.8 kΩ will dissipate about 100 mW only.
ADDED:
For main's frequency 60 Hz use capacitor 43 nF, 600 V.
1665145549497.png
 
Last edited:

Ian0

Joined Aug 7, 2020
6,726
I would use an opto with a series capacitor like @Danko suggested, but. .
. . .if you need a mains-derived sinewave at the other side, there is a miniature current transformer that is readily available called ZXMT101B.
Drive it with 220k in series with the primary and put 1k load on the secondary and you get a 1V rms sinewave.
 

Thread Starter

CF58

Joined Oct 7, 2022
9
I would use an opto with a series capacitor like @Danko suggested, but. .
. . .if you need a mains-derived sinewave at the other side, there is a miniature current transformer that is readily available called ZXMT101B.
Drive it with 220k in series with the primary and put 1k load on the secondary and you get a 1V rms sinewave.
That was my next idea - to use a ZMPT101B. I have used them before with good success. I was just hoping for a smaller solution with this circuit
 

Ian0

Joined Aug 7, 2020
6,726
If a capacitor is used, you need a reversed diode across the LED in the opto.
HCPL3700 is an AC input device.
(It has a load of other clever stuff that we probably don't need)
I would have used a plain ordinary H11AA1. At 1mA it has a CTR of 10%, so a 100k pull-up would give a usable logic output, with only 230mW dissipation in the AC side resistor.
If 1206 or smaller resistors are used, then two in series are required because of their voltage limits.
 

ThePanMan

Joined Mar 13, 2020
521
At 240VAC and 60,000Ω you're seeing 4mW (milli-watts). [edit] Strike through the wrong information. See next line for corrected statement. [end edit]
At 240VAC and 60,000Ω you're seeing 4mA (milli-AMPS).
0.004 X 240 = 0.96 watts.
If you're using a 1 watt resistor then you're at its max capacity. Change it for a 2 watt or higher. 3 watt is better but a little overkill. 5 watts is just plain overkill. It'll still work the same, just the resistor you use is more capable of handling the nearly 1 watt you're running at.

A rather simplistic approach, but since you want to know how to calculate the wattage go to Ohms law. V = IR. I = V/R. R = V/I. P (power in watts), P =VI (voltage times amperage). It's the basics. And this is not a complete listing of all of Ohms law.
 
Last edited:

Thread Starter

CF58

Joined Oct 7, 2022
9
HCPL3700 is an AC input device.
(It has a load of other clever stuff that we probably don't need)
I would have used a plain ordinary H11AA1. At 1mA it has a CTR of 10%, so a 100k pull-up would give a usable logic output, with only 230mW dissipation in the AC side resistor.
If 1206 or smaller resistors are used, then two in series are required because of their voltage limits.
Interesting!
I haven't come across an H11AA1, I am going to look it up. It sounds like it would be a better fit for my circuit.
Thank you.
You wouldn't have a schematic for how I want to use it, would you?
There may be something on the datasheet if not.
I will check it out.
 

Ian0

Joined Aug 7, 2020
6,726
Interesting!
I haven't come across an H11AA1, I am going to look it up. It sounds like it would be a better fit for my circuit.
Thank you.
You wouldn't have a schematic for how I want to use it, would you?
There may be something on the datasheet if not.
I will check it out.
100k resistor between live and pin1
100k resistor between neutral and pin 2
Connect the collector to the MCU input
Connect the emitter to 0V
Switch the pull-up on on the MCU input (or, if it doesn't have pullups, connect 100k between collector and Vcc)
 

DrBearEE

Joined Feb 3, 2020
9
Hello, CF58,

This is not exactly what you asked, but when I need to detect whether mains power is on, I use a USB charger brick and connect its output to the microcontroller. When mains is on, its 5 V. When mains go off, after a few seconds, the output drops to zero.

These things are so inexpensive now that I don't bother with mains transformers or optocouplers unless I need more than 5 Watts or so, or if I need exact power line timing.
 

Ian0

Joined Aug 7, 2020
6,726
Hello, CF58,

This is not exactly what you asked, but when I need to detect whether mains power is on, I use a USB charger brick and connect its output to the microcontroller. When mains is on, its 5 V. When mains go off, after a few seconds, the output drops to zero.

These things are so inexpensive now that I don't bother with mains transformers or optocouplers unless I need more than 5 Watts or so, or if I need exact power line timing.
48p for a H11AA1 and 1p each for two resistors. I've never seen a USB charger for less than 50p.
 

Thread Starter

CF58

Joined Oct 7, 2022
9
100k resistor between live and pin1
100k resistor between neutral and pin 2
Connect the collector to the MCU input
Connect the emitter to 0V
Switch the pull-up on on the MCU input (or, if it doesn't have pullups, connect 100k between collector and Vcc)
Is the base not connected?
What wattage resistors should be on pin1 and pin2?
Thanks.
 
Top