Remote-controlled RGB mood light
Warm, cool, rainbow or breathing: cycle lighting moods from your sofa.
Shop by category
Shop all componentsRecreate a road traffic light with red, yellow and green LEDs following the correct real-world sequence. A real signal is a fixed sequence of states, each held for a different length of time, and the timings are not arbitrary. Green and red are long because traffic needs time to move; yellow is short because it is only a warning. Writing each phase as its own block of code, with allOff() called first, means no phase can accidentally leave a previous lamp lit. That habit, clear everything, then set what you want, prevents a whole class of bugs later on.
Every part for this build comes in the Geekobot Explorer Kit box, a Geekobot exclusive, together with the parts for all 61 projects, from a first blinking LED to a smart fan and a reaction game. The wiring below is the kit's own wiring.
Tick anything you already have and the total updates.
The brain of every Explorer Kit project
Male-to-female and female-to-female leads for the modules
LEDs from the kit's red, green, yellow and blue packs
220 ohm resistors: one in series with every LED segment
Nano I/O shield from the kit: every pin has its own S, V, G header, so modules plug in with jumpers
Follow the colours: red is power, dark grey is ground, blue is a signal.
explorer_kit_03_traffic_signal.inoVerify & upload in Electrolarkint redLed = 8;
int yellowLed = 9;
int greenLed = 10;
void allOff()
{
digitalWrite(redLed, LOW);
digitalWrite(yellowLed, LOW);
digitalWrite(greenLed, LOW);
}
void setup()
{
pinMode(redLed, OUTPUT);
pinMode(yellowLed, OUTPUT);
pinMode(greenLed, OUTPUT);
Serial.begin(9600);
}
void loop()
{
// STOP
allOff();
digitalWrite(redLed, HIGH);
Serial.println("RED - stop");
delay(5000);
// GET READY
allOff();
digitalWrite(redLed, HIGH);
digitalWrite(yellowLed, HIGH);
Serial.println("RED + YELLOW - get ready");
delay(2000);
// GO
allOff();
digitalWrite(greenLed, HIGH);
Serial.println("GREEN - go");
delay(5000);
// PREPARE TO STOP
allOff();
digitalWrite(yellowLed, HIGH);
Serial.println("YELLOW - prepare to stop");
delay(2000);
}
Use the kit's mini-USB cable, install the CH340 driver on Windows if no port appears, pick Tools > Board > Arduino Nano and try Tools > Processor > ATmega328P (Old Bootloader) if the upload times out.
Turn it round: the long leg (anode) goes to the pin side through the 220 ohm resistor, the short leg to GND.
Set the Serial Monitor to 9600 baud, the same speed as Serial.begin() in the sketch.
A real signal is a fixed sequence of states, each held for a different length of time, and the timings are not arbitrary. Green and red are long because traffic needs time to move; yellow is short because it is only a warning. Writing each phase as its own block of code, with allOff() called first, means no phase can accidentally leave a previous lamp lit. That habit, clear everything, then set what you want, prevents a whole class of bugs later on.
Red holds for 5 seconds. Red and yellow light together for 2 seconds. Green holds for 5 seconds.
Yes. It is project 3 of 61 in the Geekobot Explorer Kit, in level 1 (Foundations). Every part on the list comes in the kit box, and you can also buy the parts one by one from the list above.
No. Every Explorer Kit project is wired on the Nano I/O shield and the breadboard with jumper wires.
6 parts: Generic Nano CH340 Development Board (Soldered), USB Cable, Dupont Jumper Wires (40 pcs), Through-Hole LED Pack (Pack of 10), Carbon Film Resistor 1/4W 5% (Pack of 10) and Arduino Nano IO Expansion Shield (328P Compatible). On this page you can tick the parts you already have and add only the rest to your cart.
It is a beginner project and takes about 30 minutes. The build on this page has 4 steps.
No. This page has the complete, tested code (explorer_kit_03_traffic_signal.ino).
About ₹435 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Real-life automation sequences; Breaking a process into named phases; Clearing all outputs before setting new ones; Why different phases need different durations.
Warm, cool, rainbow or breathing: cycle lighting moods from your sofa.
Press to roll: the pips tumble and slow down before landing on a number.
Wait for the light, hit the button: how many milliseconds can you beat?
A bright 4-digit clock that keeps time through power cuts.
Lessons are free to read. Maker (₹499/month) and Pro add quizzes, worked problems and certificates, paid with your Geekobot account. See plans
Learning project. Check every circuit and the datasheet of each part before you power it up.