Tim Allen's Home Improvement TV Series |
More power always seem like a good idea at first. Well at least you fail in style: if you were to crash and burn, you might as well burn the candle at both ends.
PC817-based 4-channel optocoupler PCB |
Note the 3K series resistors at the input as well as output |
You could for instance feed 12V at the input IN1 and this will pass about 4mA into the optocoupler diode. The PC817 has a current transfer ration (CTR) of 50% so the output will put out at least 2mA. A typical V1 is 3.3V so this is more than enough to pull the ESP8266 or Raspberry Pi GPIO pin low.
But what if I wanted to use it as an optoisolated digital output board? If I connected an ESP8266 3.3V GPIO configured as output, it will light up the input LED and feed approximately 1mA into the optocoupler diode. With a CTR of 50% I would expect a maximum of 0.5mA at the output. With 5V at V1, I measured 0.09mA at the output. That will light up an LED dimly, but will not do much else.
One way to improve the output drive is to convert the output to a darlington stage. Indeed, with typically low CTRs, optocouplers with darlington outputs are quite common, like the 6N138.
Optoisolator with darlington output |
I have plenty of the venerable 2N2222 in TO-92 package which will attach nicely to the HY-M154:
Darlington output stage using 2N2222 transistor |
To increase power I would need to drive the optocoupler input diode harder, and the input 3K resistor needs to be changed. I started with a 30R resistor.
HY-M154 with 30R input and 0R output resistors |
I get 39mA at the darlington output at 5V. Now we're talking. Lowering it further to 10R should be good enough to drive a small relay.
I used this program to blink the ouputs.
No comments:
Post a Comment