Arduino Powered Traffic Advisor

I have a prototype of the traffic advisor that i have in mind, right now I have it working with the 5v leds thatIi have and it works how I want it too. My question is how would I be able to bump it up from 5v to control 12v leds. I tried it and I got it to somewhat work but it seems like the transistor does not want to kill all the power going to the leds. IF someone has any ideas to help me that would be wonder.

This is my first real project I would say. I know kinda what I'm doing but if any of y'all have an experience in this field that would be wonderful.

I can post pictures and videos of the prototype and how it works if needed. I can also upload the code to if that would help any.

Any help would be greatly appreciated.

Here are the picture of the bread board and a circuit diagram. I'm not sure how well is done considering that its the first one I've done. I'll have to make a separate post about the code because it's too long.

I'm assuming that I'm going to need to use a transistor to power the 12v leds instead of the 5v ones.

Here's the code that i have written for it as of now. Is it going to have to change once i start using 12v leds. This is the frame work each of the cases has a certain set of on and off commands with different timing(it was too long for the entire code to go on here).

int buttonPin = 2;  // button pin variable, we will be using pin 11

int val = 0; // variable to read button pin value

int sequence = 1; // variable to hold current sequence

void setup()
{
  pinMode(13,OUTPUT);
  pinMode(12,OUTPUT);
  pinMode(11,OUTPUT);
  pinMode(10,OUTPUT);
  pinMode(9,OUTPUT);
  pinMode(8,OUTPUT);
  pinMode(2,INPUT);
}

void loop()                   
{
        val = digitalRead(buttonPin);
        if(val == LOW) 
        {
            if(sequence == 13)
            {
               sequence = 1;
            } else
                {
                  sequence++; 
                }
                delay(50);  
  }
                             
         switch(sequence)
             {
                  case 1:
                  strobe();
                  break;
                  
                  case 2:
                  altStrobe();
                  break;
    
                  case 3:
                  inOut();
                  break;
                  
                  case 4:
                  inOutS();
                  break;
                  
                  case 5:
                  lR();
                  break;
                  
                  case 6:
                  lRO();
                  break;
                  
                  case 7:
                  lROS();
                  break;
                  
                  case 8:
                  rL();
                  break;
                  
                  case 9:
                  rLO();
                  break;

                  case 10:
                  rLOS();
                  break;
                  
                  case 11:
                  outIn();
                  break;
                  
                  case 12:
                  outInS();
                  break;
                  
                  case 13:
                  sideSide();
                  break;
           
              }
                             
                             
}



void strobe()
{
}

void altStrobe()
  
void inOut()
{
  
}

void inOutS()
{
   
}

void lR()
{
   

void lRO()
{
   
}

void lROS()
{

}

void rL()
{
 
}

void rLO()
{
   
}

void rLOS()
{
  
}

void outInS()
{
  
}

void sideSide ()
{
  
  
}



void button_delay(int msec, int btnpin)  
{
  int btnstate = 0;      
  btnstate = digitalRead(btnpin);
  if(btnstate == HIGH)
  {
    delay(msec);
  }
}

Hi,
Welcome to the forum.

Can you post a copy of your circuit you tried to get 12V LED operation.
You will not need to change the code, just how you drive the LEDs.

Thanks.. Tom.. :slight_smile:

Here is the circuit I tried with the 12v one.The boxes are the transistors. They are sharing a common anode and I'm controlling them with the cathode. It seems to work somewhat but my problem was that the leds wouldnt turn all the way off they would only dim and brighten. I tried using a resistor to soak up and left over power but it only made them flash dimmer. I might be using the wrong transistors(IRF520 is what I'm using).

You need a N-channel MOSFET with a logic level gate, that will turn fully on with a 4.5V-5V gate signal

Why do you want the addition MOSFET?

Look into some free CAD software for capturing your designs, such as
https://www.expresspcb.com/free-cad-software/

If there's another way to control the 12v leds from the arduino I'd be all for it. But as I'm new to this I don't know if there's another way to get around the mosfet.

Hi,
The circuit that CrossRoads has posted for you will work, you need logic level MOSFETs to make sure the MOSFET switches ON fully with 5V on the gate.

Tom... :slight_smile:

Thanks for all the help. I will order the MOSSFETs that CrossRoads sent. I will let y'all know how it turns out.

So I received the MOSSFETs today and I'm still having the same problem as to where when I try to flash them fast they don't want to turn completely off. Right now i don't have a resistor in between the MOSSFET and the led, could that be causing the problem? If I do what size would I need in between them?

Hi,

JacobMuras:
So I received the MOSSFETs today and I'm still having the same problem as to where when I try to flash them fast they don't want to turn completely off. Right now i don't have a resistor in between the MOSSFET and the led, could that be causing the problem? If I do what size would I need in between them?

Yes.. you need a resistor between the LED and the MOSFET.
Can you please post a picture of your project?
Tom... :slight_smile:

Here's what I have as of now. The LEDs I'm using are 12v stable. So where whould I need to put the resistor, and what size should it be? The blue wire coming in is the source ground and the black wires coming off are the drain grounds while the yellow wires are the gate wires.

JacobMuras:
Here's what I have as of now. The LEDs I'm using are 12v stable. So where whould I need to put the resistor, and what size should it be? The blue wire coming in is the source ground and the black wires coming off are the drain grounds while the yellow wires are the gate wires.

You answered your own question here.

JacobMuras:
So I received the MOSSFETs today and I'm still having the same problem as to where when I try to flash them fast they don't want to turn completely off. Right now i don't have a resistor in between the MOSSFET and the led, could that be causing the problem? If I do what size would I need in between them?

"Right now i don't have a resistor in between the MOSSFET and the led, could that be causing the problem?"

So "in between the MOSSFET and the led" is where you put the resistor, 470R or 680R will do the trick for 12V.

What blue, black and yellow wires?

Can you please post a picture of your project?

Thanks.. Tom.. :slight_smile:

Sorry, but I forgot to upload the file, but it's on the post now. Thank you you and I'll try that out and see if it works.

Hi,
Have you put the resistors in yet?

Tom... :slight_smile: