switch on 12v light bulb

Hello. It's the first time i use Arduino to switch on something more powerful than a led! Actually i am using the arduino diecimila and i want to be able to switch on and off 3 light bulbs. As this new board has only a 5v power output, i was wondering what i needed to add to my circuit in order to light this 12v bulb?

I don't know much about electronic, but can i find a component such as a resistor that can increase the voltage ? (Mof set?, relay?) Or do i need to get the power from an adaptator that convert 220 v to 12 v and then use a resistance to low the voltage from 12 v to 5 v? Is there any documentation or example about this?

Thank You.

Get a 12V power pack and power the bulbs off it. Also power the Arduino off it. Its internal voltage regulator (the chip next to the power plug) will knock the voltage down to 5v.

Connect the Grounds from the 12v and the 5v together. And use a transistor to switch the bulbs (Base pin goes to a output pin on the Arduino).

You may need a transistor which can handle the 12v. I'm not sure if a standard one will do it without frying.

I am not completely certain what value the resistor should have, but R = U/I... 5 / 0.02 = 250. I think you should be quite safe using a 300 Ohm resistor. Mark, I [u]THINK[/u]..

Thank you very much it's working !

Now I am just worried about burning my arduino... I am using a transistor mofset IRF 540 . Do you think i need to add a resistance between the pin and the transistor? Especially if i run 3 lights at the same time... I don't really understand the transistor specifications.


It isn’t the transistor itself nor the voltage/amperage driven by it that matters. It’s the amount of current you pull from the Arduino. I’m not responsible for any damage you do but I would strongly advice using a resistor. At worst it won’t do any harm. :wink: The hardware refrence for Diecimila sais:

Each of the 14 digital pins on the Diecimila can be used as an input or output. They operate at 5 volts. Each pin can provide or receive a maximum of 40 mA and has an internal pull-up resistor (disconnected by default) of 20-50 kOhms.

Each pin can max provide or recieve 40mA (0,04A) so I would go with beeing on the safe side and limit it to about 20mA.

R = U / I (resistance = voltage / current) soo…
R = 5V / 0.02A
R = 250Ohm

Sooo… if you connect a 250Ohm resistor between the pin and the transistor, a maximum of 20mA can be pulled from the Arduino-pin. Should be well on the safe side, at least if you have the Diecimila which can provide twice that. I have played around with printerport interfacing, and each pin has to be limited to a maximum of 20mA. The port is max 5V and I used a 370Ohm resistor “in front of” the transistor limiting the current flow to about 13mA which was plenty enough to trigger the transistor. (not sure if saying “trigger the transistor” is the right wording, but you probably get the point) ::slight_smile:

I added a 300 ohm resistance between the pin and the transistor. And it hasn't burnt yet!! ;) Everything seems to be working properly! Thank you for helping!

I know a bit more about electronics now!!

No problem! Us newbies have to stick together, you know! ;) And besides, I am asking the Arduino-gurus stuff so the least I can do is answer as best I can when I can. :)

I used TIP120 transistors to control 16 12v auto bulbs:


based on this tutorial:


Each bulb drew an amp so having a power supply that could handle it (without heating etc) and isolating the board were important.