Arduino Uno R3 Traffic Advisor

Hi all, sorry for this post (I know it probably seems stupid).

This is my first ever Arduino project, I have no idea what I am doing and I'm hoping for some help.
I'm a volunteer firefighter and I'm trying to make a 6 LED traffic advisor for my car using an arduino uno R3 and 6 relays (one for each LED set). I'd like it to have 4 modes, each controlled via it's own button. The buttons are latching, so I need to pattern to repeat aslong as the button is pressed

Mode 1: Left, lights start on the right and make their way to the left
Mode 2: Right, lights start on the left and make their way to the right
Mode 3: Center out, this one is pretty self explanatory, the middle 2 lights turn on, then go out to the end of each side (6 lights in total)
Mode 4: Alert, just a general flashing pattern, hoping for an even/odd style one ("_" light off, "^" light on). Flashing between _ ^ _ ^ _ ^ and ^ _ ^ _ ^ _

These are the inputs to my relays:
image

Hopefully this makes some sense and yall can help me.
Thank you!

Yes it makes sense.
What have you tried so far?

Literally nothing, I have no idea what I'm doing lol.

I did try ChatGPT (and you can imagine how that went)

Well let's first make sure you have things wired correctly, so you don't burn out your UNO.
Post the data sheet for or link to the relay board you have.

Mine is the 6 way version
https://www.aliexpress.com/item/1005005865597217.html?spm=a2g0o.order_list.order_list_main.32.6a881802GRBS2f

For testing, you will need a 12V power supply with a current rating of at least 0.5A.

Yep, I've got one of those, I'm still waiting on the board to arrive, it should be here in a couple of days, I'm hoping to get everything setup (or nearly setup), so when it arrives, it's basically plug 'n' play

I don't know about plug and play but we should be able to make it work.
Do you have some LEDs and resistors you can connect to the relays to see when they turn on?

I've got LEDs, but no resistors, is there a way to test it without any resistors?

No
Buy some 1K resistors

Righto, thanks. I've actually just found 5 which I desoldered off an old PCB, is that enough to test it with 5 LEDs?

Sure, 5 is OK for now
Here is how to connect the relay board to the Uno.
I show an 8 channel and I only show 1 LED but the other 5 should be wired the same way
The important thing is to remove that yellow jumper and connect 12V as shown
Of cource you will also need to add 4 buttons

1 Like

Beautiful, thank you. I'll do that as soon as it arrives. Do you have any idea what to do code wise?

The rest you need to figure out yourself

const int RELAY_PIN1 = 13;  // The Arduino pin, which connects to the relay IN1 pin

void setup() 
{
  // initialize digital pin as an output.
  pinMode(RELAY_PIN1, OUTPUT);
}

// the loop function runs over and over again forever
void loop() 
{
	// This will turn the relay ON for two seconds
	// then OFF for two seconds
  digitalWrite(RELAY_PIN, HIGH);
  delay(2000);
  digitalWrite(RELAY_PIN, LOW);
  delay(2000);
}

Beautiful, thank you so much

Spent a few hours and now everything is working perfectly on my bench, thanks so much for your help. How would you recommend that I power my arduino inside my car? I don't want to accidentially cook it. Cheers!

Hello jack2384

Post your final sketch for all other forum members.

You have 12V for the relays, so connect that to the barrel connector on the Uno.
Make sure you get the polarity right.
One like shown below. 5.5mm x 2.1mm male
Buy on amazon, ebay adafruit, digikey etc

1 Like

Never knew that the barrel connector on an arduino uno R3 could support 12v Thanks!

12V is the maximum but it can tolerate voltages as high as 20V for short periods.