Switching 12V NPN Transistor with 5V?

So I am making a remote controlled RGB system for my computer, and I am using an arduino to do it. I have infared down, but have a problem with applying the voltage to the LEDs. The LEDs run on 12V, and need to switch that using an arduino, which only supplies 5 to an output pin. I am attempting to use 2N2222 NPN transistors to make this work, but also have 2N3906 If I need to use those. The question I am asking is if I could switch the transistors using 5V from an ardiono, if it is going to be switching 12V. thanks!

As long as you put the transistors on the low side (and use a NPN or N-channel) then yes, no problem. And most (all?) ledstrips are designed with a common anode (positive/high side) so that should all work out.

Time to show drawings (NO Fritzing breadboard view, photo of hand drawing will do) and more details like : - What happens? - What do you expect? - Which ledstrip (link) - etc

septillion: Time to show drawings (NO Fritzing breadboard view, photo of hand drawing will do) and more details like : - What happens? - What do you expect? - Which ledstrip (link) - etc

Sorry If I did not do those things, I have not been on this forum in a long time.

The thing is, the whole LED is a fairly straightforward but weird setup. I got an RGB fan from my friend while I was building his computer, and the pins did not fit my motherboard. To fix that problem, I stripped the wires and plugged them into a power supply at 12V. Nothing happened, so I hooked the fan up to my computer and tried again. This time, the LEDs lit up, contrary to what I thought. I am actually feeding my Arduino off of my computer's PSU, as well as the fans. There is not real link to the strip of LEDs, as it came with the motherboard, the Biostar Z270 Racing GT4.

The LEDs appear to share a common cathode, with separate anodes for the three colors. I have attached the schematic here: http://schematics.com/project/aduino-ir-rgb-52532/ Thanks!

Hmm, I get a 403 error when I try to follow your link.

opencircut74: I have not been on this forum in a long time.

That's why we try to help you with a big fat sticky at the top of each board How to use the forum. But newbies just tend to ignore this useful advice ;)

I've read your reply 3 times and I still have no idea what you try to say there...

And all I get when I follow the link is a forbidden :/

But running Arduino from PC PSU is just fine, no different then running it of USB actually...

Hi,

Please read the first post in any forum entitled how to use this forum. http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code. It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks... Tom.. :)

Here is the code

#include <IRremote.h>
int message;
int Blue = 3;
int Green = 4;
int Red = 5;
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
 pinMode(Blue, OUTPUT);
 pinMode(Red, OUTPUT);
 pinMode(Green, OUTPUT);
 Serial.begin(9600);
 irrecv.enableIRIn(); // Start the receiver
}
void loop() {
 if (irrecv.decode(&results)) {
 message = results.value, HEX;
 switch (message){
 case 0xFF02FD:{
  digitalWrite(Red, LOW);
  digitalWrite(Blue, LOW);
  digitalWrite(Green, LOW);
  Serial.println("Off"); break;
 }
 case 0xFF629D:{
  digitalWrite(Red, HIGH);
  Serial.println("Redhigh"); break;
 }
 case 0xFF22DD:{
  digitalWrite(Blue, HIGH);
  Serial.println("Bluehigh"); break;
 }
 case 0xFFC23D:{
  digitalWrite(Green, HIGH);
  Serial.println("Greenhigh"); break;
 }
 case 0xFF6897:{
  digitalWrite(Red, LOW);
  Serial.println("Redlow"); break;
 }
 case 0xFF9867:{
  digitalWrite(Green, LOW);
  Serial.println("Greenlow"); break;
 }
 case 0xFFB04F:{
  digitalWrite(Blue, LOW);
  Serial.println("BlueLow"); break;
 }
 default: Serial.println("Press a button");
 }
 irrecv.resume(); // Receive the next value
 delay(500);
 }
}

I have the new link here. Sorry it did not work before, I forgot to change it to public.

|500x305

Do not use the 5 volts of the Arduino to power motors, fans etc. Study the image below for typical output connections. |500x367

LarryD: Do not use the 5 volts of the Arduino to power motors, fans etc. Study the image below for typical output connections. |500x367

I took off the fan, but when I plugged the arduino in to the psu, it fried. Now, I will use 5v from the psu instead of 12:) with a new arduino

And those LED's wil never turn on this way... With there cathode connected to the positive side of the battery...

Rule of thumb for making a circuit diagram, draw GND on the bottom and Vcc on the top. The other way around is asking for trouble ;)

Hi, Why have you got gnd going to +12V of your power supply? No wonder it fried...

Tom.. :)

Hi,
This is what you will need to be doing.
LED_Connection.JPG
Tom… :slight_smile:

I know what you're going at with the diagram, but I see a problem. The LEDs take 12v, and I need to feed that through the transistors. Will that still work? Also, what are the values or R1, 2 and 3?

You haven't said what current the LED strips take. We don't know if 2N2222 is suitable even.

The current LED strips take 12 volts to light up. I believe that the 2N2222 can handle up to 30 volts on the emitter, 60 volts on the base, and 5 volts on the collector. The last value worries me.

You haven't said what current the LED strips take. We don't know if 2N2222 is suitable even.

Read what I asked!

Each color takes around 70 mA.

opencircut74:
The current LED strips take 12 volts to light up. I believe that the 2N2222 can handle up to 30 volts on the emitter, 60 volts on the base, and 5 volts on the collector. The last value worries me.

VCEO is 30V, VCBO is 60V. VEBO is 5 volts. That last is only of concern if you hook things up backwards (i.e. +12V at the emitter).

Cheers!
Dirk

70mA means its a very short LED strip then (they can be several amps, hence the clarification) no problem with a 2N2222 for 70mA, use 1k base resistor for that sort of current.

70mA could be 6 or maybe 9 LEDs long.