Using varying duty-cycle PWM code, I have a circuit that alternately dims and brightens an LED. I'd like to transition this circuit to replace the LED with a small flashlight light bulb. The bulb is rated at 2.4V / 0.7A and is normally run by two D batteries.
I understand the max current of the chip's output pins is around 40 mA and thus I'll need external circuitry to amplify it. I've tried messing around with simulating a BJT NPN transistor since I have those on hand, connecting the pin output to the base and driving the bulb (in simulation) across the collector output. But my everyday 3901 NPN has a max current of 100mA. I was thinking of driving the external circuit/bulb at a higher voltage to compensate for the low current (to maintain similar power dissapation). But since the resistance of the bulb is rather low, I can't get a good voltage drop in a standard series configuration.
So basically I can't figure out a good external circuit to drive a PWM signal into an incandescent. A solid state relay is probably the easiest but I'm afraid I wouldn't be able to get my hands on one before next weekend when the project is needed.
Any ideas? Or alternately do you have any recommended reference circuits to point to that may be useful in design?
Also, would you recommend using a MOSFET instead for this type of application?
In the 0.7A domain I'd suggest a logic-level MOSFET, or a low saturation voltage BJT. This little guy, for example, will do quite nicely:
Voltage drop across it will be negligible at 0.7A.
The Ruggeduino: compatible with Arduino UNO, 24V operation, all I/O's fused and protected
Unfortunately due to time constraints, I may be limited with an IRF510 from Radio Shack. The specs seem acceptable but I am struggling to find the a decent driver circuit that allows me to dim the bulb.
I imagine I need a circuit that transfers the fixed 40mA output of the arduino to a fixed 0.7mA, and then I can set to PWM to move between 0V and 2.4V (max) for the bulb. Any circuit ideas?
I'm afraid you have some misconceptions in electronics. The output of the Arduino is not fixed at 40mA. It outputs 5V. The amount of current drawn from it depends upon what you hook up to the pin. If you hook up a 1k resistor to the Arduino pin (other end to ground) then 5mA will flow. If you hook up a 2k resistor then 2.5mA will flow, and so on. The Arduino output pin sets the voltage (~5V), what you hook up to it determines the current. This current must be limited to 40mA (preferably quite a bit less) else the Arduino will be damaged.
The IRF510 will not work as it is not a "logic-level" MOSFET. It needs ~10V between gate and source terminals to turn on. The 5V provided by the Arduino is not enough. The MOSFET I suggested is a logic-level MOSFET and will turn fully on with only 5V from gate to source.
The Rugged Circuits Yellowjacket: 802.11 WiFi module with ATmega328P microcontroller, only 1.6" x 1.2", bootloader
My apologies, I meant limited when mentioning 40mA, not fixed. As far as the MOSFET, since I am resource/time limited, I was willing to accept it not being logic-level. I assumed I can have an external power supply @ ~10V and design accordingly. Would that not be possible?
My apologies, I meant limited when mentioning 40mA, not fixed.
But again the wrong word is used. The arduino output pin is not 'limited' to 40ma, if you were to wire a output pin to ground and turn it on high, it would pass hundreds of milliamps before it blows up the chip.
The 40ma absolute maximum current specifications is a safety specification that the user must not exceed by whatever he/she wires to the output pin. There is no protection built into the arduino that prevents one from drawing too much current from a output pin.
It's ohms law, I = E/R, it's the R you wire to the pin that will determine what amount current will be drawn from the pin, draw too much and the output pin goes bye bye.
I assumed I can have an external power supply @ ~10V and design accordingly. Would that not be possible?
You could use a two-stage amplifier, like the circuit shown here:
Replace +5V with whatever you have available (within reason) and replace the LCD with your lamp. T1 is a general-purpose NPN BJT, T2 is a PNP BJT that can handle the current you expect of the lamp.
Alternatively you can replace T2 with a P-channel MOSFET. If you use +10V instead of +5V you don’t need a logic-level P-channel MOSFET, otherwise you do.
Finally finally, if you stick with T1/T2 being BJT’s you can add a third amplification stage: your IRF510 MOSFET (as long as you use +10V). T2 then would feed the IRF510 gate, and T2 does not need to be rated for the lamp current (it can be another low-current general-purpose PNP BJT).
The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, speaker, microphone, light sensor, potentiometer, pushbuttons
Thank you for the help and reference. I tried simulating that circuit with two BJTs and it seems like it'll work with some resistor tweaking! I'll try building it tomorrow and see how it goes.
Just wanted to follow up with this topic. I went back and reviewed the simulation of the circuit RuggedCircuits linked to. I simulated it in LTSpice IV and ran into some varying results.
If I simulate a 4.7 ohm resistance at the collector of the PNP (output), I get a peak of 24mW output with a wide active region from 0-5V arduino pin voltage. If I simulate 470 ohms resistance at the collector, I get a max of 180 mW with tighter active region of only between 1.5V-2.5V.
Is this what you meant by T2 being rated for the lamp current? I tried swapping T2 with a P-channel MOSFET and it seemed to be a little more robust to load variance. Do you think the load-dependance be decreased if I added a third stage? Just want to make sure I am understanding these concepts correctly.
Also, I wasn't sure the easiest way to attach/link files to this board so I just pasted the simulation netlist (for the BJT circuit) below:
- C:\Program Files\LTC\LTspiceIV\2stage_amp.asc
V1 N004 0 5
R1 N005 N004 4.7k
R2 0 N006 4.7k
R3 0 N003 470
R4 N002 N001 4.7k
C1 N005 0 1µ
Q1 N002 N005 N006 0 NPN
Q2 N003 N002 N001 0 PNP
V2 N001 0 9
.model NPN NPN
.model PNP PNP
.lib C:\Program Files\LTC\LTspiceIV\lib\cmp\standard.bjt
.dc V1 0 5 0.1
Is this what you meant by T2 being rated for the lamp current?
Uhhh...no, I meant that T2's collector current rating should be at least as high as the current you expect to supply to your lamp.
With a logic-level P-channel MOSFET (or non-logic-level if you use +10V) then I don't think there should be much load variance.
It would be more helpful to post your LTSpice .asc file instead of the netlist output. The netlist output is not so easy to read. The .asc is just a plain text file so it's easy to post.
The Rugged Motor Driver: two H-bridges, more power than an L298, fully protected
Ok thank you for the clarification.
I attached the asc file.
2stage_amp.asc (1.24 KB)