Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Using a Transistor to Connect Ground to a Relay

Status
Not open for further replies.

DustinB

New Member
Sorry if this is a really simple question, I have not used transistors yet.

I have a power strip with 12v N/O relays inside it. I will be using an arduino to control the relays.

All of the relays will have a constant connection to +12v. The relays are wired to activate by connecting each one to ground instead of positive voltage.

Is it possible to use an NPN transistor to connect ground to a relay instead of positive voltage? My current understanding of a transistor is that is either let's voltage pass through it or it doesn't, hence my question about connecting ground instead.

Thanks
 
Last edited:
Yes.
What is the resistance of one relay coil (or the coil's current requirement)?
What is the supply voltage on your Arduino?
 
I don't know the current requirements as they are unmarked in a commercial product. **broken link removed**

The relays have an average resistance from the 12v line to the ground control pins of 165ohms.

The arduino will output 5v when switching high.
 
You can use ULN2803A. Connect pin 9 to GND and pin 10 to +12V.
Connect each input to your Arduino, and each output to a relay.
If you prefer to use discrete transistors, use 2N7000 MOSFETs. Connect each gate to an Arduino output, each source to ground, and each drain to a relay coil.
If the relays don't have diodes across the coils, you will need to add a 1N4148 from each drain to +12V. Connect the diode's cathode to +12V, and the anode to the drain.
To determine if diodes already exist across the coils, measure a coil's resistance, then swap the ohmmeter's leads and measure it again. If the measurements differ substantially, the diodes are already present. This assumes that if one coil has a diode, all will. You can measure all of them if you are paranoid.
If the diodes are not present and you do not add external ones, the transistors will be destroyed by the flyback voltage generated when the transistor is switched off. The ULN2803A has internal diodes, all connected to pin 10. If they are already present internal to the SR-8, no harm will be done.
 
Last edited:
I would do as Roff suggest using the ULN2803A to drive the relays. It is designed to do exactly what you want to do from a single chip. However, if you want to go the discreet component route and use transistors the circuit would look like below attached image.

Your relays will draw about 73 mA so any number of NPN transistors will work well. I used a 1 K Ohm resistor on the base. I also used a 2N2222 and placed a 1N4002 diode across the relay coil. It gives you a picture if that helps. :)

Again, I like the ULN2803A as a first choice.

Ron
 

Attachments

  • Relay From Pic.gif
    Relay From Pic.gif
    5.3 KB · Views: 566
I would do as Roff suggest using the ULN2803A to drive the relays. It is designed to do exactly what you want to do from a single chip. However, if you want to go the discreet component route and use transistors the circuit would look like below attached image.

Your relays will draw about 73 mA so any number of NPN transistors will work well. I used a 1 K Ohm resistor on the base. I also used a 2N2222 and placed a 1N4002 diode across the relay coil. It gives you a picture if that helps. :)

Again, I like the ULN2803A as a first choice.

Ron
My original suggestion recommended 2N2222 or 2N3904, but I recommended 560 ohm base resistors to satisfy the forced beta spec Ic/Ib=10. This puts the maximum total Arduino sourcing current above 50 ma, which I believe (correct me if I'm wrong) is the max allowable for Arduino. That's why I switched to 2N7000. There are alternatives -2N7002, BSS145.
 
Well we are trying to save as many pins as possible on the board. I will be using an MCP23008 port expander. There are already diodes on each relay. Basically you have a standard DB9 connector on the relay strip. One pin is a common 12v for the relays, always active. The other 8 pins are for connecting ground to activate each relay.

Here are some pics of the project so you can get a better idea.

Hydra pictures by DustinsReef - Photobucket
 
My original suggestion recommended 2N2222 or 2N3904, but I recommended 560 ohm base resistors to satisfy the forced beta spec Ic/Ib=10. This puts the maximum total Arduino sourcing current above 50 ma, which I believe (correct me if I'm wrong) is the max allowable for Arduino. That's why I switched to 2N7000. There are alternatives -2N7002, BSS145.

I am really glad you posted that. I read your post and would have sworn I saw reference to the 2N2222 and 2N3904 and then I looked back and saw the 2N7000 and was totally lost. Never caught the edit. I just figured I lost it again. :)

No, you are correct as to the best choice. I wasn't thinking much about the Arduino sourcing current. However, the OP seems to have it figured another way.

Ron
 
Well I haven't figured out another way, just the way I will be sending 5v. Instead of connecting each control to an arduino pin I will be using the MCP23008 port expander with 8 5v lines off that.

12v Directly to the relay 12v rail. Then 5v control from the port expander pins.

So by using the transistor schematic posted it will work like this? :
Port expander line goes high with 5v, then 5v goes directly to the ground input on the relay. (Relay Off/Open)
Port expander line goes low with 0v, then ground goes to the ground input on the relay. (Relay On/Closed)
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top