Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By jra
#43480
martinayotte wrote:In my own design, I would have placed the LED (along with it's own limiting resistor) completely in parallel with the relay supplied on the 5V side, not on the input side of the opto-coupler ! ... :ugeek:

Agree the design as-is is probably marginal @3v3. I made the following additional measurements with the input grounded:

@Vcc = 3v3
Code: Select allVoltage across indicator LED              1.763V
Voltage across current limiting resistor  0.492V
Voltage across opto-isolator LED          3.3 - 1.763 - 0.492 = 1.045V
Current through opto-isolator             0.492/988 = 0.5ma


@Vcc = 5.0V
Code: Select allVoltage across indicator LED              1.835V
Voltage across current limiting resistor  2.054V
Voltage across opto-isolator LED          5.0 - 1835 - 2.054 = 1.111V
Current through opto-isolator             2.054/988 = 2.1ma


My relay boards use a 817c opto-isolator. This basic design has been cloned a zillion times, who knows what they use. The 817 spec sheet indicates that driving this with only half a ma may not generate enough collector current to reliably operate the relay. Mine happen to work, YMMV. Using a level shifter, shorting out the indicator LED or using a smaller current limiting resistor would help.
User avatar
By AdrianM
#43486
Trent wrote:
AdrianM wrote:Can you read or measure the resistance of the part labelled R5 in the circuit above?


It's 988 ohms if my memory serves me. I'll re-measure when I get home but recall thinking it was a 1k.

Oh and I don't know if that is the exact schematic but can confirm that the indicator stays lit even when JD-VCC power is removed and the relay closes.


Well there's 0.5V drop already across that resistor. The original design was for a 5V input so they were looking for around 2V drop in the resistor, hence 2mA through the Opto. Without the "headroom" of 2V (you're looking at more like 0.3V) it would be hard to get a decent current limiting resistor value but the numbers come out as 0.3V/0.002mA i.e. 150 Ohms.

So you could change the resistor to 150R or simply short out the indicator LED and leave the 1K resistor. That would also give around 2mA.

The GPIO output has it's own (not insignificant!) impedance which makes the calculations a bit off. If it were mine, I'd use a 100R resistor to make sure it was properly turning on the Opto.
User avatar
By Trent
#43488 I'll probably just bypass the indicator LED. I don't need it anyway. I don't have surface mount resistors laying around.

I am tempted to buy one of those SSR's mentioned to keep everything small and on my breadboard but it stinks paying $5 in shipping for a $1 item.

I really appreciate all of your assistance. This is a great community!