Two transistors to switch on/off two relays with an arduino from one pin

beerzinnss

Sep 26, 2016
8
Joined
Sep 26, 2016
Messages
8
Hi!
I have little understanding of transistors, but I need to get a circuit like this to work:

Screen Shot 2017-04-27 at 23.59.03.png



This obviously is the wrong way, because the relays aren't turning on. Relay coil resistance is 400Ohm, transistors are PN2222A

Can someone help? I tried lower resistor on base(s), but it didn't work with 220 Ohm, and I didn't want to fry anything, so I thought I'd ask here. I guess it's not okay to connect bases of multiple transistors like that. What is the solution?
Tried googling, but couldn't find a similar circuit anywhere. Thank you.
 
Last edited:

Minder

Apr 24, 2015
3,561
Joined
Apr 24, 2015
Messages
3,561
Why not use a single logic level Mosfet to control both relays?
AND use a single DPDT relay.
If you cannot you could still use a single Mosfet.
M.
 

AnalogKid

Jun 10, 2015
3,045
Joined
Jun 10, 2015
Messages
3,045
This obviously is the wrong way, because the relays aren't turning on.
There is a flaw in your logic. There also is a flaw in the schematic, but not in the way you think.

At least one relay should come on. A better way is to have pin D3 drive two resistors, one for each base. The problem is that the base-emitter forward voltage is not exactly the same for all transistors, so one of the two transistors might hog most of the current from the resistor, preventing the other one from turning on. Individual resistors fixes this. Yes, the two base currents will not be exactly the same, but standard switching transistor circuit design includes supplying the transistor with much more base current than it actually needs, so there is plenty of tolerance margin.

Confirm the pinout of the transistors; of the six possible arrangements, three are popular.
Confirm that the signal D3 really is present and report its amplitude.
1K should work, but 470 ohms is a better compromise.
For how long are the relays supposed to be activated?

ak
 

beerzinnss

Sep 26, 2016
8
Joined
Sep 26, 2016
Messages
8
There is a flaw in your logic. There also is a flaw in the schematic, but not in the way you think.

At least one relay should come on. A better way is to have pin D3 drive two resistors, one for each base. The problem is that the base-emitter forward voltage is not exactly the same for all transistors, so one of the two transistors might hog most of the current from the resistor, preventing the other one from turning on. Individual resistors fixes this. Yes, the two base currents will not be exactly the same, but standard switching transistor circuit design includes supplying the transistor with much more base current than it actually needs, so there is plenty of tolerance margin.

Confirm the pinout of the transistors; of the six possible arrangements, three are popular.
Confirm that the signal D3 really is present and report its amplitude.
1K should work, but 470 ohms is a better compromise.
For how long are the relays supposed to be activated?

ak

None of the two relays turn on.. but when i connect the base resistor to 5v directly, both of them turn on, so i guess current on the pin is too low?
The transistor pinout according to datasheet is EBC, so that's alright.
I checked the voltage on the pin when connected to the base resistor, it was only 0.4 V
When disconnected from the circuit, voltage on the pin is 4.6V

I will probably go to the store and get a dpdt relay, it will make my life easier :)
 

AnalogKid

Jun 10, 2015
3,045
Joined
Jun 10, 2015
Messages
3,045
0.4 V is a typical output voltage for a logical low output. Nothing about the transistors would pull it that low. Are you sure you are programming the pin correctly? In other words, what is the output pin voltage with the transistors not connected?

ak
 
Top