SparkCore + NPN transistor to switch 12v LED strip. 3/4 brightness?

I know this is probably something simple, but anyway…

I have an LED 12v strip, nothing fancy, single colour, 1 anode, 1 cathode, resistors built in, which I’d like to control using the spark core. I’ve tested this on an Arduino and it’s fine, works as expected. I can analogWrite various values to control the brightness of the strip via an NPN MOSFET . I’ve used this approach several times before, with 5v as the control voltage and always without problems.

However when I connect my NPN and LED strip to the core, I only get about 7.7volt reading across the strip when I digitalWrite HIGH to the control pin, which causes the strip to be very dim.
The thing is, I can’t figure out how the NPN knows that I’m using 3.3v or 5v. The 5V is a separate power source which goes straight into the core (and is subsequently regulated down to 3.3v internally). I know the pin is only supplying 3.3v, but how does the NPN transistor know that it should expect 5v to turn on the controlled circuit 100%? Why won’t it accept 3.3 and give me full brightness of my LED strip?

I’m essentially using a simplified version of this circuit, with a single LED circuit (rather than 3), and no voltage regulator (i’m using a PSU from an external hard drive, which supplies 12v and 5v rails.)

Is there a resistor or something I should be using to get this working? :confused:

Thanks :smile:

ps: not sure what category this should be under, it’s not a specific core issue, so I didn’t want to put it in hardware or troubleshooting.

Transistors are actually amplifiers; the output from the emitter is relative to the inputs at the base and collector. So in the circuit you linked, you control how much voltage (or current) is applied to the base, which in turn controls how much voltage (or current) passes through the LED and into the collector [of the transistor], where it finally flows out of the emitter and into ground.

People call transistors a switch, but that’s really not accurate; they’re more like valves (hence why Tubes are called Valves by some people). It’s like a water faucet, the further you turn it, the more the water comes out!

Generally there’s a ratio for each type of transistor that will tell you the saturation, maximum and minimum voltages and current, plus the amplification factor is. If you’re running 12V through the LED, then most likely you just don’t have enough voltage to fully “open” the junction.

In this case, I think you’d be better off using a TTL level FET instead of a transistor. The advantage to a FET is it’s either on or off; once the gate hits minimum voltage you should get a full current flow from source to drain.

Hope this helps out a bit! Feel free to ask any questions. Out of curiosity, what type of transistor are you using?

@dermotos, you put a sneaky link into the data sheet for the transistor you are using, which @timb missed, and so did I at first.

So its a BUZ71 N-channel FET. (You used the term “NPN” earlier, which applies to BJT transistors, not FETs).

This FET is not “logic-level”, so I suspect that the 5V from the Arduino output was enough to switch it on fully, but unfortunately the 3.3V from the SparkCore is not quite enough, switching it not quite fully on, leading to the voltage drop you measured.

From the BUZ71 data sheet:

Gate to Threshold Voltage VGS(TH): min: 2.1V, typical: 3V, max: 4V

So the 5V from the Arduino should always be enough to switch it on, being 1 volt higher than the maximum 4V threshold.

However, the 3.3V from the SparkCore is only just over that typical 3V typical value and less than the 4V max. Hence it only partly switches on.

Suggest swapping them with IRL520, which has a logic-level input. The Gate voltage is 2V, so 3.3V should switch it on fully.

Paul

Hmmm, @dermotos must have put in a ninja edit when I was writing my post, because it did not say FET or contain that link.

So yeah, like @PaulRB said, you need a “Logic Level” MOSFET. As I mentioned, most FETs are either on or off, however, if you’re really close to the threshold, they will start to conduct, just not completely. The conduction threshold of a transistor is a shit ton bigger than that of a FET.

@dermotos
Another cheaper alternative is to use a BJT transistor: 2N2222, which can be controlled with a 3.3v base voltage and can handle currents of upto 800mA.

@timb Nope, no edits, check the post history. Eitherway, thanks for your informative description, you and @PaulRB have really helped. I wasn’t aware of the Threshold Voltage, I guess I just got lucky previously with the voltages I was using.

@PaulRB Do you think this MOSFET will work? http://www.ebay.com.au/itm/MOSFET-Logic-Level-N-Channel-60V-21A-PIC-Arduino-AVR-AU-Stock-/181159868586?pt=AU_B_I_Electrical_Test_Equipment&hash=item2a2df838aa&_uhb=1

It’s located locally so Id have it in a day or two if I ordered from that seller. No data-sheet but it’s described as “logic level” which I assume means the threshold voltage is less than 3.3v (see, I’m learning! :D)

@dermotos can you please link me to your LED spec sheet, and I’ll chime in on the resistor you asked about. Also when deciding on what type of driver you need (BJT, MOSFET, Darlington, etc…) it’s important to know all of your load Voltage and Current ratings.

@dermotos, not sure about that eBay transistor. It doesn’t give a product code or even say what it is equivalent to. It says logic level but then does not state the Vgs figure. I would be asking myself if the seller really understand the term “logic level”? Having said that, it does look suitable based on the little data given. I would check out similar local items first though.

But as @BDub asks, what is the spec of the led strip? Power fets may be overkill.

This is all the info I have on them: http://cgi.ebay.com.au/ws/eBayISAPI.dll?ViewItem&item=280986736670

There’s 30 x 5050 SMD White LEDs on each strip. I think they pull about 500mA per strip at 12v, so around 6W. I’m running 3 of them, which is around 15W, hence the reason for the mosfet.

The strips have been running fine for months on a 1.8A power supply with problems, I just now want to control them using the spark core so they can be faded up and down. (something I did with an arduino and same fet/led strip type without problems in another project)

The ebay seller just got back to me with a datasheet link http://www.fairchildsemi.com/ds/FQ/FQP20N06L.pdf
The threshold voltage is between 1.0 and 2.5, which should work… right?

Yeah, technically that’ll work, but 60V@21A, talk about overkill! You should be able to get some 2N2222 Transistors locally, as they’re one of the most common types on the market. In the US, you can even get them on Amazon with Prime shipping! Personally, I’d use one of those for each strip.

Ah ok… looks like you don’t need to worry about resistors then for the LEDs. You might want to just add some pull down resistors from Gate so Source of your FET… so when the spark is off they don’t turn on accidentally. Maybe 47k ohm or so.

Your FET will be driven in the linear region at 3.3V… but from the graphs it looks like it’s good for 10A. If you are driving all 3 strips off of one FET, just keep an eye on it for temperature if you are not heatsinking it. By calculation it should be fairly warm (20°C above ambient), but not blazing hot. It should be dissipating about 1/3W on a TO-220 case in free air it should be fine. If you use one FET per strip, no worries.

I think the 2N2222’s would be pretty dang hot running at 500mA. Not to mention they have crappy gain and would require 50mA of base drive to get 500mA out reliably… Spark Core is good for 20mA max. Stick with the FETs and don’t start any fires :wink:

Eh, just double the 2N2222’s up, like a Darlington! I’ve run them up to 750mA like that no problems. Good quality ones can be overdriven a lot more than people realize. Though, come to think of it, they were the metal case type. Hmmm, yeah go with those FETs I guess then. At least that way you can add more strings and expand later on! :smiley:

Thanks guys, you’ve all been really helpful. I’ve everything up and running now, using a BUZ71 mosfet so I could finish the project (albeit with dim LEDs) and i’ll swap it out for the logic level one once it arrives.

Cheers for the heads up on heat @BDub

Just came back to say the logic level FET arrived today, swapped it in and it’s working perfectly at full brightness. Thanks for the help guys!

1 Like