User avatar
davef21370
Posts: 897
Joined: Fri Sep 21, 2012 4:13 pm
Location: Earth But Not Grounded

Transistor selection

Sat Feb 21, 2015 3:27 pm

This isn't strictly a Raspberry Pi question as the project is now using an Arduino Nano but I'm programming it through the Pi so fair's fair.
I've currently got the board flashing and flickering several LED's (separate pins) and it's working as expected. Now I want it to do the same with strings of LED's (I'm sacrificing some battery powered ones, the cheap Christmas type) so I figure I'll need to use a transistor.
I know the Nano will supply 5V at a max of 40mA and the LED's work on 4.5V at, let's say, 200mA (not measured but it's a figure).
The LED's will have a separate supply and I know I need some resistor between the Nano and the transistor's base.
Given the information I have how do I work out what spec of transistor I need and what value resistor?

I've been Googling a while now and still stumped, even the online calculators I've found need more info that I have so not lazy, just confused.

Dave.
Apple say... Monkey do !!

gregeric
Posts: 1509
Joined: Mon Nov 28, 2011 10:08 am

Re: Transistor selection

Sat Feb 21, 2015 4:09 pm

I'd recommend you use a MOSFET instead of a junction transistor. Chosen correctly, it will work as a near perfect (negligable on-resistance), voltage driven switch. I use the IRL2203N which can be turned fully on even with 3V3 logic. I've controlled 12V LED strips drawing around 5A with this, and it barely gets warm, no heatsink required.

It will work without a resistor between the nano's output & the MOSFET gate, but I think it is more correct to use say 10k to limit the current when charging the tiny gate-source capacitance. You can also tiew the gate to ground with 10k so as to ensure the MOSFET is off, not floating, when the arduino is unpowered.
Last edited by gregeric on Sat Feb 21, 2015 4:21 pm, edited 1 time in total.

User avatar
davef21370
Posts: 897
Joined: Fri Sep 21, 2012 4:13 pm
Location: Earth But Not Grounded

Re: Transistor selection

Sat Feb 21, 2015 4:18 pm

gregeric wrote:I'd recommend you use a MOSFET instead of a junction transistor.
I'm using PWM (980Hz max) to control the LED's, will a MOSFET be able to switch fast enough?
Apple say... Monkey do !!

gregeric
Posts: 1509
Joined: Mon Nov 28, 2011 10:08 am

Re: Transistor selection

Sat Feb 21, 2015 4:22 pm

Yes.

User avatar
Tage
Posts: 287
Joined: Fri May 24, 2013 2:29 am
Location: St Thomas, Ontario Canada

Re: Transistor selection

Sat Feb 21, 2015 4:49 pm

some examples of smaller size MOSFETs:
Si2302CDS, Si2312CDS, PMV16UN, DMG3414U, DMN2075U

there are dozens of similar parts that can be directly connected to 3.3V GPIO output pins and can drive several Amperes at relatively high switching frequency. Look for n-channel MOSFETs with Rdson specified at 2.5V. if you take a large MOSFET that has Rdson specified only at 4.5V you can probably use it at least at low current, but it has ten times larger gate capacitance and price.
if you use npn transistor you should look for a high gain transistor, and expect that you have to drive the base with 1/10 to 1/30 of the collector current to make the transistor turn on fully. this amount of current can be too much for the GPIO.
and forget Darlington transistors. they have too high power loss and are not really suited to be driven by 3.3V GPIO output.

User avatar
davef21370
Posts: 897
Joined: Fri Sep 21, 2012 4:13 pm
Location: Earth But Not Grounded

Re: Transistor selection

Sat Feb 21, 2015 9:07 pm

Thanks all, I have a MOSFET knocking about somewhere (something 540) so I'll try that.

Dave.
Apple say... Monkey do !!

Return to “Other projects”