I have project completed and digital outputs from Arduino send signal through resistor and led diode, optocoupler and NPN transistor.
There are 12 open collector outputs and I want to drive 12v relays (about 30ma, 360 ohm coil resistance) on the SV2 outputs.
I have applied +12v to the relay, put diode over coil and connected specific output to other side of the coil but relay doesn’t switch, I got only appropriate led diode on but it looks no output for the relay.
What I am missing - appreciate your suggestions. What about pin 13 on the SV2 output, should it be connected somewhere?
What about pin 13 on the SV2 output, should it be connected somewhere?
This looks to be the Relay's power supply return connection.
What is the Arduino’s Vdd? 5V?
If so then the Arduino’s output pins swing between about 0V and 5V.
With two LEDs in series there is a (1.2 + 1.4)V drop across the LEDs (assuming the external LED is Red). The opto’s LED needs at least 5mA so the series resistor should be:
(5 - 1.2 - 1.4) / 0.005 = 480 Ohm.
On the other side of the Opto: Assuming you have 12V on the collectors. When the Opto’s transistor is ON it is trying to apply 12V without any current limiting the the base of the next transistor. This is BAD since a transistor’s Base can never be more than a diode drop above the emitter. Without a series resistor either transistor would burn out.
To turn on the BC547 with 30mA collector current you need about 300uA of base current. So the base resistor is:
(12V - 0.6V)/.0003 = 38k Ohm. This is not too critical and a lower value resistor is ok. I’d use between a 10k to 33k resistor.
The relay coil’s diode should be across the coil and close to the coil terminals. I like soldering the diode right onto the relay’s coil terminals.