Hey guys, I have a project I am making where I need to both power an LED that operates with a 9V supply and an Arduino with the same 9V. However, I need the LED to turn on when a port on the Arduino sends an output as "HIGH". How can I go about wiring this, and what do I need to make this work?
Constraints: The solution needs to be as compact as humanly possible, so the fewer items, the better!
Control an NPN transistor or N channel logic level MOSFET low side switch with an Arduino output (pin) to control the power to the LED if the LED will tolerate low side switching. Connect the 9V to the power jack or Vin. You will need one or two resisors with the transistor. Current limit for the LED depends on the LED. Choice of transistor depends on the current requirement of the LED. So, I guess we need to know more about the LED. You failed to state the Arduino model that you are using. That could affect the choices, too.
Thank you for your suggestion on the Transistor. I have a PN2222 rated for 1000 mA that I used, and here is how I wired it up (two 10K resistors in series for 20K).
Oh my.... That's quite embarrassing. Switched it around and changed resistors, but now I'm having a power issue to the LED. It's now barely visible. Tried it again with no resistor at all, and same issue.
Yes it does when connected straight to the 9V, and quite brightly as well at the full 815 lumens (measured). However, with a 2K resistor from my pin 11 on the Transistor base, I get at best 0.5 lumens in a dark room, and 5 lumens with a 200 resistor
AceofWWII:
Constraints: The solution needs to be as compact as humanly possible, so the fewer items, the better!
Then don't use an Arduino, not even the still bulky Pro Mini, but an ATtiny25/45/85 or other 8-pin AVR, preferably in VSSOP package. All you have to add is a regulator (SOT23-5 SMD package is tiny), filter cap (can come in tiny package - like the 0604 SMD) and indeed a MOSFET for switching (get one in SOT-23 package) and a resistor to protect your pin (can also be 0604 size).
Of course, it's just that you said "as small as humanly possible" and apparently left out some essential information on the project as a whole, such as what else is to be connected to the Arduino.
3.3V from the arduino, 0.7 base-emitter volt drop.
voltage across base resistor = 3.3 - 0.7 = 2.6V
V = I x R
Voltage across base resistor = base current x base resistor
base resistor = Voltage across base resistor / base current = 2.6V / 0.01A = 260R
So 270R or 220R would be more suitable to get the transistor to saturate and pass full collector current.
Tom...
Guys, a 2222 will not be comfortable with a 1A collector current. End of story. And a DC gain of 100 applies only if the Vce is well above saturation. At saturation you'd be looking at more like Beta is 10 to 20 at best.
My advice is a FET, something with a Vgt (gate threshold voltage) around 2V and has its RdsON performance at less than 5V actually declared in the data sheet as FDD8447 does. When fets warm up the on resistance of the channel can double if it gets really warm so make an allowance for that as well.
If you are not looking to switch this load at any kind of frequency then any fet with the right on resistance specified in the data sheet with a 4.5V drive (assuming a 5V arduino?) could be fine without heatsink and without even getting warm itself.
A BJT as you were trying to use will drop a greater voltage than a MOSFET and either require a higher base current than you can provide or to be a darlington circuit arrangement with potentially slightly higher saturation voltage and definitely will not be a super fast switch and will likely require some heatsinking or at least surroundings that will tolerate some warmth.
Look at FDD8447 as a good example of what will do the trick if you have the drive voltage (5V) to use it.
My apologies Marle, I did not intend to come across aggressive.
Thank you for your response PE. I don't believe heat should be a concern for this project, as it is just going to be turned on for short periods of time (1min or so) a couple of times per day. As far as the drive voltage, I should have plenty for the drive voltage (9V), and my gate voltage is going to be at 3.3V with a 3.3V Arduino. As you can tell, I have never used a FET before so I thank you for clearing up that. You said that the FDD8447 would work well assuming I had a 5V Arduino, and the minimum gate voltage would be at 2V. I'm assuming this would also work fine with a 3.3V gate voltage, would I run into any issues with that?
So, to clear up any misunderstandings, I am running a 3.3V Arduino with a 950-1050 mA LED. My gate voltage is going to be 3.3V from the arduino, and my drive voltage will be 9V from a battery (not a supply). The LED will be connected to the 9V source.
A MOSFET that will switch ON at 3.3V gate will need a site with a good parametric search.
A close look at characteristic curves of Vgs vs Rds(on) may be needed.
For example
NTD3055L170
IRLB8721PbF
This one is just about ideal, just need some steady hand soldering, SMD.
SQA410EJ file attached.
@PE suggestion of FDD8447 has a very good graph of Vgs and Rds(on)
and it is in an easy solderable package.