Alternating 3 LED project

I am making a Halloween costume for my son and it needs some light. Basically he’s a character from the Mario Bros universe that carries a traffic light on a fishing pole. I am trying to figure out a way to light the traffic lights red, green, and yellow lights using leds in a single circuit that would turn them on and off independently. Just something simple that goes red, then yellow, then green, then back to red over and over. Is there something to build or a circuit diagram? I really have never done any wiring like this ever, so the easier the better. I am sure an arduous could do it, but I have never used one before. I am also hoping for it to be portable and run off a 9v battery, not a wall socket.

Thank you for your help

I think this would be simplest with an Arduino. There’s a sample program called “Blink,” it’s one of the simplest possible programs, that could be modified a little to do what you want.

I’m imagining you using 3 LEDs of each color so that you can diffuse the light and have a reasonably large circle for each traffic light. Say you choose resistors to go with your LEDs to pass about 10mA through each LED. If you’ve got 3 LEDs per color, that means that the LEDs will be pulling about 30mA at any given time. The Arduino board itself draws something around 60mA for a total of 90mA - at that draw I’d expect a new 9V battery to last 3-ish hours, probably long enough for a costume, so that’s good.

Check out this page on the blink code:https://www.arduino.cc/en/tutorial/blink

You’d need to connect each LED (and its resistor) to a separate pin and in the code you’ll give these pins names by typing something like “int green1 = 2;” (you can see examples of that in the “fade” sample code https://www.arduino.cc/en/Tutorial/Fade)

Then in the “setup” part of the code, you’d set up each of the pins you’re using to be an output like they do in the blink code (substituting your names for LED_BUILTIN).

Then, in the main loop, you’d turn on all the green LEDs, delay for however long you want the light to stay on, turn off all the greens, turn on all the yellows, delay, turn on all the reds, delay. And there you go!

Be careful to put the input from the battery into the pin labeled “Vin” rather than the 5V or 3.3V pins and I’d use pins 2-10, skip 0 & 1.

Good luck!

Seems to me that you could adapt a simple circuit like this (see figures 6-7) here-> http://www.nutsvolts.com/magazine/artic … r-circuits

without using a micro. Simply connect the GRN led to outputs 0-3, YEL led to 4-5, and RED led to 6-9 (or some combination that results in the relative on time for each led). No micro needed but you would have to find the parts (555, 4017B, etc).

Following up on my previous post… also look at figure 11 where reset is used to sequence only a subset of the 10 outputs. In your case 3 for equal on times.