Remote-controlled RGB mood light
Warm, cool, rainbow or breathing: cycle lighting moods from your sofa.
Shop by category
Shop all componentsSpin a ring of LEDs like a roulette wheel, slowing gradually until it settles on a random winner. The illusion of a physical wheel losing momentum comes entirely from changing one number. The delay between LEDs starts at 30 ms and grows a little on every step; because it grows by a percentage rather than a fixed amount, the slowdown feels natural rather than mechanical. The modulo operator % wraps the position back to LED 1 after LED 8, turning a straight line of pins into a ring.
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_54_digital_roulette.inoVerify & upload in Electrolarkint ledPins[8] = {2, 3, 4, 5, 6, 7, 8, 9};
int button = 10;
int buzzer = 11;
void allOff()
{
for (int i = 0; i < 8; i++)
{
digitalWrite(ledPins[i], LOW);
}
}
void spin()
{
int position = 0;
int stepDelay = 30;
int totalSteps = random(30, 50);
for (int step = 0; step < totalSteps; step++)
{
allOff();
digitalWrite(ledPins[position], HIGH);
tone(buzzer, 1200, 15);
delay(stepDelay);
// Slow down a little more each step
stepDelay = stepDelay + stepDelay / 8 + 2;
position = (position + 1) % 8;
}
int winner = (position + 7) % 8;
Serial.print("Winner: LED ");
Serial.println(winner + 1);
for (int i = 0; i < 4; i++)
{
digitalWrite(ledPins[winner], LOW);
tone(buzzer, 500, 100);
delay(150);
digitalWrite(ledPins[winner], HIGH);
delay(150);
}
}
void setup()
{
for (int i = 0; i < 8; i++)
{
pinMode(ledPins[i], OUTPUT);
}
pinMode(button, INPUT_PULLUP);
pinMode(buzzer, OUTPUT);
randomSeed(analogRead(A0));
Serial.begin(9600);
Serial.println("Press the button to spin");
allOff();
}
void loop()
{
if (digitalRead(button) == LOW)
{
while (digitalRead(button) == LOW)
{
delay(10);
}
spin();
}
}
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.
The sketch uses INPUT_PULLUP, so one leg goes to the pin and the other to GND. Use two legs on opposite sides of the button.
This project needs the passive buzzer (the one that plays notes with tone()), not the active one.
The illusion of a physical wheel losing momentum comes entirely from changing one number. The delay between LEDs starts at 30 ms and grows a little on every step; because it grows by a percentage rather than a fixed amount, the slowdown feels natural rather than mechanical. The modulo operator % wraps the position back to LED 1 after LED 8, turning a straight line of pins into a ring.
Press the button and the light races around the ring. The rotation visibly slows over about three seconds. It stops on one LED, which then blinks four times with a tone.
Yes. It is project 54 of 61 in the Geekobot Explorer Kit, in level 9 (Interactive games). 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.
9 parts: Generic Nano CH340 Development Board (Soldered), USB Cable, Solderless Breadboard, Dupont Jumper Wires (40 pcs), Through-Hole LED Pack (Pack of 10), Carbon Film Resistor 1/4W 5% (Pack of 10), Tactile Push Button Switch, Buzzer Module 3.3–5V 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 intermediate project and takes about 45 minutes. The build on this page has 6 steps.
No. This page has the complete, tested code (explorer_kit_54_digital_roulette.ino).
About ₹487 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Rapid delay manipulation to fake momentum; The modulo operator for circular movement; Randomising both the result and the run length; Combining light and sound for feedback.
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.
Learning project. Check every circuit and the datasheet of each part before you power it up.