arduino transistor help

Hey guys, I'm doing this project and need some help.
I need to power 4 LEDs in a series which requires a total of 12VDC. But the arduino atmega328 only gives out around 4 -5V which is not enough to power it. I'm trying to use a 3904 NPN transistor as a amplifier to power the 4 LEDs but doesn't seem to work. What should I do? I don't know if I wire it correctly..

but doesn't seem to work.... I don't know if I wire it correctly..

If you tell us how you wired it, maybe we could help...

I connected the Collector to a 12V. Connect the Base with the output pin from the atmega with 1k Ohm. Connect the Emitter to the positive of the LEDs series and negative to the ground. When I used my multimeter to test the voltages that the Emitter is giving out, its only 4 - 5 V, not 12V...

Connect the Emitter to the positive of the LEDs series and negative to the ground

The 2n3904 is an NPN, isn't it?

I don't know if I wire it correctly..

Neither do we without a drawing showing what you are trying. Keep in mind that a transistor cannot create voltage, it can only control it. If your LED string requires +12vdc then you will of course first require a 12vdc voltage source. The transistor can then be wired up to switch the +12vdc current flow on and off via the arduino output pin wired to the base of the transistor with a suitable series current limiting resistor.

Lefty

krazyhorze:
I connected the Collector to a 12V. Connect the Base with the output pin from the atmega with 1k Ohm. Connect the Emitter to the positive of the LEDs series and negative to the ground. When I used my multimeter to test the voltages that the Emitter is giving out, its only 4 - 5 V, not 12V...

Wire +12vdc to anode (positive) side of LED string, cathode side of led wires to collector, emitter wired to both negitive terminal of 12 volt voltage source and to arduino ground pin. Output pin to resistor, other end of resistor to base.

Lefty

AWOL:

Connect the Emitter to the positive of the LEDs series and negative to the ground

The 2n3904 is an NPN, isn't it?

Yes

retrolefty:

I don't know if I wire it correctly..

Neither do we without a drawing showing what you are trying. Keep in mind that a transistor cannot create voltage, it can only control it. If your LED string requires +12vdc then you will of course first require a 12vdc voltage source. The transistor can then be wired up to switch the +12vdc current flow on and off via the arduino output pin wired to the base of the transistor with a suitable series current limiting resistor.

Lefty

Or can I use it as a switch instead of an amplifier? A switch to turn 12V on or off?

Or can I use it as a switch instead of an amplifier? A switch to turn 12V on or off?

Using transistors as on/off switches is the only way you can use transistors with arduino digital or PWM output pins.

Lefty

Here's a circuit that I think will work for your application:

http://ruggedcircuits.com/html/circuit__28.html

--
The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, speaker, microphone, light sensor, potentiometer, pushbuttons

RuggedCircuits:
Here's a circuit that I think will work for your application:

http://ruggedcircuits.com/html/circuit__28.html

Its the NTD4960N a NPN transistor that is also connected to a zener diode?

Nope, it's a MOSFET. Less power loss than an NPN transistor. You can buy one here:

--
The Rugged Motor Driver: two H-bridges, more power than an L298, fully protected

RuggedCircuits:
Here's a circuit that I think will work for your application:

http://ruggedcircuits.com/html/circuit__28.html

I tried but the LED doesn't turn off, instead it stay turned on and keep blinking w/o the LED turn off...

What do you mean by "keep blinking w/o the LED turn off"?

--
Beat707: MIDI drum machine / sequencer / groove-box for Arduino

Well I'm not sure. I followed your schematic but I probably made a mistake. This is how I hooked it up.

The MOSFET pins 1, 2, 3.
I connected digital pin 13 to MOSFET pin 2.
Connect ground to MOSFET pin 1.
MOSFET pin 3 to ground of LED.
5v to LED positive.

and I wanted to power the LED in parallel, not series.

The MOSFET pins 1, 2, 3.

Looking at the front of the MOSFET:

1=Gate
2=Drain
3=Source

You want digital pin 13 to MOSFET pin 1 (through a resistor, as in the schematic). Ground to MOSFET pin 3, the LED's to MOSFET pin 2.

--
The Quick Shield: breakout all 28 pins to quick-connect terminals

Does this work for parallel LEDs?

Yes, but parallel LED's are not a good idea. One LED will take the majority of the current and be bright while the others (most likely) will be very dim.

With LED's in series they all carry the same current and have more-or-less the same brightness.

--
The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, speaker, microphone, light sensor, potentiometer, pushbuttons