I followed this: https://learn.edwinrobotics.com/230v110v-ac-mains-detection-using-arduino-raspberry-pi-and-esp8266-thing/#Step2

With the exception that I used an LTV-814 that doesn't require a bridge rectifier.

enter image description here

The forwards voltage of the optos led is 1.2 (1.4max) and If = 20mA

Give: Power = I^2 * R = (0.020A)2*(390000) = 156 watts

That doesn't make much sense to me. I'm only using a 1 watt resistor so it should have blown up by now, but it doesn't even get hot. What am I missing?

Further, I calculated my own resistor value for the 390k one rather than relying on the schematic I followed in the aforementioned link:

R = (170vpeak - 1.2forwardvoltage) / .020A = 8440 ohm

Is this correct? Should I use this instead of the 390k resistor?

Mains: 120v

  • \$\begingroup\$ why are you assuming 20 mA flow through the 390 kΩ resistor? (That's pretty certainly not the case) Your calculation for the resistor value seems to make sense, why are you even using someone else's resistor value? \$\endgroup\$ – Marcus Müller Oct 4 '19 at 7:28
  • \$\begingroup\$ What minimal current is required by the opto to operate it and what value resistor does that imply? \$\endgroup\$ – Andy aka Oct 4 '19 at 7:31
  • \$\begingroup\$ @MarcusMüller it was from the schematic of the circuit for which this was based. the opto used in that circuit had the same characteristics. \$\endgroup\$ – Alex Oct 4 '19 at 8:05

I do not know if you are connecting this to 120V or 240V ac mains, but this source voltage (U) and the resistor (R) is what defines the current through the optocoupler input LED, not the other way around!

So for example you need a current of I=20mA with a given U=120V ac mains, then you can calculate R = U/I = 120V/20mA = 6kOhms. The resistor dissipative power will be about I^2*R = 2.4 Watts (It is actually less than that because of AC current).

(I disregarded the 1.4V voltage drop of the diode as this is negligible compared to the high input voltage U).

| improve this answer | |
  • \$\begingroup\$ Of course, thank you! now that you've explained it i see the err in my thinking. i am indeed using 120v power. if you wouldn't mind expanding a bit on the part that says "resistor dissipative value..."? im curious how this relates to the actual rated wattage of the resistor. \$\endgroup\$ – Alex Oct 4 '19 at 8:04
  • \$\begingroup\$ Resistor dissipative power is the actual power that is dissipated by the resistor. Of course you need a resistor with actual rated wattage higher than that (e.g. 5 watts rated resistor). \$\endgroup\$ – Stefan Wyss Oct 4 '19 at 8:24
  • \$\begingroup\$ ok, and to be clear you got the dissipative power via: 120^2/6000 = 2.4? \$\endgroup\$ – Alex Oct 4 '19 at 8:35
  • 1
    \$\begingroup\$ Yes, or alternatively I^2*R = 20m^2 * 6000Ohms = 2.4V \$\endgroup\$ – Stefan Wyss Oct 4 '19 at 8:39
  • \$\begingroup\$ 2.4V should be 2.4W. \$\endgroup\$ – Michael Karas Oct 4 '19 at 9:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.