How to drive a 12v LED from your arduino without frying your board...

Hi,

I just got a big dome button from sparkfun: https://www.sparkfun.com/products/11275

I'm a bit confused about how to hook this LED up to my arduino without frying it. I have a PN2222A transistor. I'm just not sure how to put it together. This is my first time working with this kind of switch.

So: I connect the 12v battery + end, to the positive terminal for the LED, then I connect one leg of the 2222A transistor to the ground terminal of the LED, one to the ground of the battery, and one to the arduino?

I feel that's not right (but maybe it is)?

I came by this blog post, but am still scratching my head a bit: http://blog.cornbeast.com/2013/08/driving-a-12v-led-from-a-5v-arduino-pin/

Thanks!

PS: For some context, this is a photo booth button. So, I'd like to use the LED in the button as part of the countdown indicator. You hit the button, it pulses every second for 5 seconds, then goes back to solid green. I already have the button coded, I just need a nudge with the physical set up.

I feel that's not right

Go with your feelings. You have no current limiting resistor in the base, and it matters which leg of the transistor is connected to what.

I came by this blog post, but am still scratching my head a bit:

Why, that is the right way to do it.

Ok, well the sparkfun button already has a 470 ohm resistor packaged with it (its sitting beside the LED inthe switch) that connects on the negative side, so does that mean I still need a 220ohm resistor between the 12v battery and the arduino Pin? Or just one?

And what happens to the ground of the 12v battery? Nothing?

Then with the actual switch part (https://dlnmh9ip6v2uc.cloudfront.net//images/products/9/1/8/1/09181-01.jpg) do I just hook it up normally like a button w/ a 10k resistor? (http://arduino.cc/en/uploads/Tutorial/button.png).

You just need one resistor so go with the one they wired up already.

All grounds are always connected together.

Grumpy_Mike: You just need one resistor so go with the one they wired up already.

All grounds are always connected together.

So I should -connect the ground of a 12v battery to my breadboard (um....not sure, that's a large voltage, does it matter?) -then connect the positive of the 12v battery with a 220hm resistor to the positive of the LED, -then connect the ground end of the LED to the C leg of the 2222a, -then the middle leg with NO resistor to the arduino (I don't feel this is right) -then the E leg to the ground.

Meh, just removed the existing resistor and slapped a 220ohm resistoron it, now it runs right off the board.

Thread closed, Thanks for the replies.

-then the middle leg with NO resistor to the arduino (I don't feel this is right)

Just for the record this is not right you always need a resistor on the base of a transistor.