Page 1 of 1
Transistor Question
Posted: Fri Sep 15, 2017 5:59 am
by Ronicus
To use a transistor as a switch does it need two independent power sources IE one for the collector and emitter and one for the base to switch it or can all this be driven from one battery. Every diagram I look at shows two power sources which make no sense to me.
Also what is the best transistor for a gpio pin to switch 24v
Thanks For Any Help

Re: Transistor Question
Posted: Fri Sep 15, 2017 6:18 am
by QMESAR
Ronicus wrote: ↑Fri Sep 15, 2017 5:59 am
To use a transistor as a switch does it need two independent power sources
Theoretically no - this depends heavily on what you want to do or what you want to switch or power.
To answer this people need to know more about your requirement.
Also what is the best transistor for a gpio pin to switch 24v
Again it depends on your requirement
type of use Simple switch (common emitter to ground) max current to switch ,possibly a Power supply switch where you supply power from the device to a load ,or amplifier circuit ? imposible to give you any valuable advice with out knowing your requirement
Ok my comments was before you edit your post and added a schematic of what you want to do ,Are just looking to control the led with the Transistor ? where does you need to apply 24V as your schematic shows 6V ?
Kind Regards
QMESAR
Re: Transistor Question
Posted: Fri Sep 15, 2017 6:25 am
by Ronicus
The only difference to this circuit is i will be switching a 24v circuit
Re: Transistor Question
Posted: Fri Sep 15, 2017 7:43 am
by Heater
You are missing one very important thing in the circuit diagram.
The voltage on the input and the voltage on the output must be referenced to a common ground (0v) connection.
A transistor is a current amplifying device. A small current into the base results in a big current in the collector. Both of these currents run through the transistor to that common ground on the emitter. There are two current circuits here, one from input to base to emitter back to inputs ground. One from output supply to collector to emitter back to outputs ground.
Like so:

- Screenshot (4).png (5.21 KiB) Viewed 1558 times
Please ignore the + and - terminals on the switch symbol here. Also ignore the resistor values, they are just typical numbers off the top of my head.
As you see the input voltage and output voltage need not be the same.
V1 in the diagram, and the switch, could be an output from a Raspberry Pi GPIO pin. V2 could be 6, 12, 24, whatever volts from a battery. Both the Pi ground and the negative end of the battery need to be connected together to complete the input and output circuits.
Suggest you google around for the millions of "transistor as a switch" articles on the net.
Re: Transistor Question
Posted: Fri Sep 15, 2017 7:51 am
by Heater
Ronicus,
Reading your post again I see:
Every diagram I look at shows two power sources which make no sense to me.
Well, the circuit you posted there does not show that. It shows to signal lines labeled +6v.
That means those two lines are both connected together. I.e they are both connected to the same +6v supply.
Hence there is only one ground signal in the diagram.
Re: Transistor Question
Posted: Fri Sep 15, 2017 8:13 am
by Ronicus
Heater wrote: ↑Fri Sep 15, 2017 7:51 am
Ronicus,
Reading your post again I see:
Every diagram I look at shows two power sources which make no sense to me.
Well, the circuit you posted there does not show that. It shows to signal lines labeled +6v.
That means those two lines are both connected together. I.e they are both connected to the same +6v supply.
Hence there is only one ground signal in the diagram.
Thank you so much for taking the time to explain that so a quick question. I see a diode in that pic can a diode be used to protect a circuit in the event I accidentally reverse to polarity when hooking it up to its power source? If so would i use a diode on botch the neutral and positive lines ?
Re: Transistor Question
Posted: Fri Sep 15, 2017 8:46 am
by Heater
I'm not sure what you mean. There is no regular diode in any circuit posted here.
There is a Light Emitting Diode (LED).
Of course an LED is a diode so there is no point in adding further diodes for reverse polarity protection.
Re: Transistor Question
Posted: Fri Sep 15, 2017 9:04 am
by Ronicus
Heater wrote: ↑Fri Sep 15, 2017 8:46 am
I'm not sure what you mean. There is no regular diode in any circuit posted here.
There is a Light Emitting Diode (LED).
Of course an LED is a diode so there is no point in adding further diodes for reverse polarity protection.
Sorry my mistake but if I did want to add a diode to the circuit im building can it be used in both negative and positive lines?
Re: Transistor Question
Posted: Fri Sep 15, 2017 12:34 pm
by Heater
Generally one would put a diode in the positive supply for reverse polarity protection. Arguably it makes no difference but that is where I would put it.
Re: Transistor Question
Posted: Fri Sep 15, 2017 6:07 pm
by Burngate
Whether you need a diode and where you would put it would depend on what you are protecting, and from what accident.
If you think that a power source could be connected the wrong way round - your kid sister stuffs the batteries in upside down, or you could do it yourself by accident - then a diode in the positive line would protect the circuit. Putting it in the negative line would be an alternative, but negative or ground lines often go to more places, so it's easier to miss one.
But if, in your first diagram, the feed to the base is from somewhere else - the bottom of the garden, perhaps - and there's a possibilty that lightning could strike at any moment, then a reverse-biased diode between base and emitter could protect the transistor.
Re: Transistor Question
Posted: Sat Sep 16, 2017 9:03 am
by Ronicus
I plan on using a 18 inch audio jock as a plug in for a 24v circuit that why Im wondering if i can just put it on both lines on both side of the circuit.
Re: Transistor Question
Posted: Sat Sep 16, 2017 9:13 am
by davidcoton
Ronicus wrote: ↑Sat Sep 16, 2017 9:03 am
I plan on using a 18 inch audio jock as a plug in for a 24v circuit that why Im wondering if i can just put it on both lines on both side of the circuit.
Two diodes are unnecessary, unless there is some very complex circuitry around. In general avoid diodes in ground connections, the voltage drops can push logic levels out of range.
If your engineering design prevents the polarity being reversed anywhere on the system, then the only time you are at risk is during initial build and test. I can't say whether that risk justifies a diode.
Another approach is to use current limiting resistors wherever possible on inputs and outputs, so that the current flowing will not damage anything even if the voltage applied is wrong.