I’m a long time customer, but just joined the forums.
I thought what I wanted to do was simple, but apparently not. Basically I want to send 12V to another circuit via a pin on my Arduino. The Arduino and the other circuit are both powered by the same power source (12V) but the Arduino has a 5V regulator in between it and the power source.
So I want to be able to send 12V (positive) to the other circuit, essentially turning it on.
I have this working with a MOSFET (BS170) if I’m trying to sink another circuit to turn it on, but can’t find a way to source the 2nd circuit in a similar way. Is there a MOSFET or other component that can do this? Sinking the circuit is not an option since it’s in a case with other circuits that share a common ground, but have individual power lines.
I’ve been trying all night to get this to work with PNP transistors, but they don’t appear to be trivial to hook up.
The circuits I’m trying to drive essentially just have a string of LEDs on them so they won’t draw any more than 20mA.
I was actually trying something similar to this last night, but with an PNP transistor.
I have a wire from my Arduino pin to a button and from the button to the 5V line. Once this goes high, then I change another pin to high to power the transistor circuit (via a 1k resistor).
What I was observing was that the LED (connected to 12V via a current-limiting resistor) stays very dimly lit when the button isn’t pressed and lights up when the button IS pressed. So that’s close. I never considered using a P-channel MOSFET though. Do you think that would work better than the PNP transistor I’m using?
How about using a reed relay. I have a circuit bread boarded right now where I’m switching 24V @ 2A with an Arduino pin. The Arduino drives the relay coil, which is rates at 9ma. Not much good for high speed pulsing, but fine for on/off control.
I’m only driving 20mA for the most part. Occasionally I’ll need to drive closer to 100mA, but no more than that. A relay seemed like overkill to me which is why I went with the transistor solution.
What I was observing was that the LED (connected to 12V via a current-limiting resistor) stays very dimly lit when the button isn’t pressed and lights up when the button IS pressed
Yep, that because the PNP was not turning completely off. Try connecting a 10k R from base to emitter (pins 2 to 3) on the PNP. This will remove base current when the NPN transistor is off.
The circuit should now work.
The only real advantages of a MOSFET is the very low RDSon (low voltage drop) and almost no current on the Gate to keep the MOSFET on. If the switched circuit doesn’t pull much current than the PNP solution should work fine.
waltr:
Yep, that because the PNP was not turning completely off. Try connecting a 10k R from base to emitter (pins 2 to 3) on the PNP. This will remove base current when the NPN transistor is off.
The circuit should now work.
The only real advantages of a MOSFET is the very low RDSon (low voltage drop) and almost no current on the Gate to keep the MOSFET on. If the switched circuit doesn’t pull much current than the PNP solution should work fine.
I just finished implementing your suggestion and it works like a charm! Thanks so much for your help. This stuff is slowly sinking in.
If this is the type of application you will find yourself doing often, you may want to pick up some ULN2803s, which are 8 channel darlington arrays in a nice IC package. Obviously if you are only switching one circuit (especially at a low current), it might be overkill. But these are great for switching a wide range of voltage levels, allow fairly high current, are easy to interface to, and even have protection diodes built in if you are controlling an inductive load.
Retroplayer:
If this is the type of application you will find yourself doing often, you may want to pick up some ULN2803s, which are 8 channel darlington arrays in a nice IC package. Obviously if you are only switching one circuit (especially at a low current), it might be overkill. But these are great for switching a wide range of voltage levels, allow fairly high current, are easy to interface to, and even have protection diodes built in if you are controlling an inductive load.
Oh good to know since I will be doing this fairly often with a number of similar inputs.
Hmm, must have missed that. You need a high-side driver, then. Something like the UDN2981, perhaps. It is pretty much the equivalent to the ULN2803, except it is designed for high-side driving instead. It’s even pinout compatible with the ULN2803.
I am curious: what is your application that you cannot switch from sourcing to sinking.
I have mounted LEDs in a Star Trek model with their -ve leads going to ground and +ve leads exposed via a 9-pin connector on the bottom. The only way to light them is to provide 12v so I have to have source it.
In hindsight and going forward I will likely have them all share the 12V +ve line and have exposed -ve lines to make this easier.