Remote-controlled RGB mood light
Warm, cool, rainbow or breathing: cycle lighting moods from your sofa.
Shop by category
Shop all componentsUse the kit's TV-style remote to change the LED ring's colour, brightness and effects. The remote flashes an invisible infrared code for each key. The IR receiver turns the flashes back into pulses, and the IRremote library decodes them into a key number. The sketch looks that number up: keys 1 to 6 pick a colour, up and down change brightness, 0 starts a spinning rainbow and OK switches the ring off.
The ESP32 is a 3.3V board: never connect a 5V signal straight to a GPIO pin.
Every part for this build comes in the Geekobot Titan Kit box, a Geekobot exclusive, together with the parts for all 120 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.
ESP32 DevKit V1 (38-pin): the brain of every Titan Kit project, with Wi-Fi and Bluetooth
Male-to-female and female-to-female leads for the modules
WS2812 ring of 8 colour LEDs, each one set by the sketch over one data wire
ESP32 expansion board from the kit: every GPIO has its own S, V, G header
Follow the colours: red is power, dark grey is ground, blue is a signal.
titan_kit_110_ir_remote_light_ring.inoVerify & upload in Electrolark#include <IRremote.hpp>
#include <Adafruit_NeoPixel.h>
#define IR_PIN 35
#define RING_PIN 18
#define LEDS 8
Adafruit_NeoPixel ring(LEDS, RING_PIN, NEO_GRB + NEO_KHZ800);
// key codes of the kit's 17-key remote (NEC): if yours differ, read them in the Serial Monitor
const uint8_t K1 = 0x45, K2 = 0x46, K3 = 0x47, K4 = 0x44, K5 = 0x40, K6 = 0x43, K0 = 0x19;
const uint8_t KUP = 0x18, KDOWN = 0x52, KOK = 0x1C;
uint32_t colour = 0;
int bright = 50;
bool rainbow = false;
uint16_t hue = 0;
void fillRing(uint32_t c)
{
for (int i = 0; i < LEDS; i++)
{
ring.setPixelColor(i, c);
}
ring.setBrightness(bright);
ring.show();
}
void setup()
{
Serial.begin(9600);
IrReceiver.begin(IR_PIN);
ring.begin();
colour = ring.Color(0, 0, 255);
fillRing(colour);
Serial.println("Point the remote at the receiver and press a key");
}
void loop()
{
if (IrReceiver.decode())
{
uint8_t key = IrReceiver.decodedIRData.command;
bool repeat = IrReceiver.decodedIRData.flags & IRDATA_FLAGS_IS_REPEAT;
IrReceiver.resume();
if (!repeat)
{
Serial.print("Key code 0x");
Serial.println(key, HEX);
}
switch (key)
{
case K1: colour = ring.Color(255, 0, 0); rainbow = false; break;
case K2: colour = ring.Color(255, 90, 0); rainbow = false; break;
case K3: colour = ring.Color(255, 200, 0); rainbow = false; break;
case K4: colour = ring.Color(0, 255, 0); rainbow = false; break;
case K5: colour = ring.Color(0, 0, 255); rainbow = false; break;
case K6: colour = ring.Color(160, 0, 255); rainbow = false; break;
case K0: rainbow = true; break;
case KUP: bright = min(bright + 10, 150); break;
case KDOWN: bright = max(bright - 10, 5); break;
case KOK: colour = 0; rainbow = false; break;
default: break;
}
if (!rainbow)
{
fillRing(colour);
}
}
if (rainbow)
{
for (int i = 0; i < LEDS; i++)
{
ring.setPixelColor(i, ring.gamma32(ring.ColorHSV(hue + i * 65536L / LEDS)));
}
ring.setBrightness(bright);
ring.show();
hue += 256;
delay(20);
}
}
Use a micro-USB data cable (some cables only charge), install the CP210x or CH340 driver if no port appears, pick Tools > Board > ESP32 Dev Module and hold the BOOT button on the board until the upload starts.
Open the Serial Monitor and press a key: each press prints a code. If your remote's codes differ, type them into the key list at the top of the sketch.
Check that the data wire goes to the ring's DIN pad (not DOUT), that the ring has 5V and GND, and that RING_PIN is 18.
The remote flashes an invisible infrared code for each key. The IR receiver turns the flashes back into pulses, and the IRremote library decodes them into a key number. The sketch looks that number up: keys 1 to 6 pick a colour, up and down change brightness, 0 starts a spinning rainbow and OK switches the ring off.
Each key press prints its code in the Serial Monitor. Keys 1 to 6 colour the ring red, orange, yellow, green, blue and purple. Up and down change brightness, 0 spins a rainbow, OK switches off.
Yes. It is project 110 of 120 in the Geekobot Titan Kit, in level 16 (Wi-Fi, IoT and new sensors). 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 Titan Kit project is wired with jumper wires on the ESP32 expansion board and the breadboard.
6 parts: ESP32-WROOM-32 38-Pin Development Board, USB Cable, Dupont Jumper Wires (40 pcs), IR Receiver Module (VS1838B / TSOP), WS2812 RGB LED Ring and ESP32 38-Pin Expansion Board. 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 30 minutes. The build on this page has 5 steps.
No. This page has the complete, tested code (titan_kit_110_ir_remote_light_ring.ino).
About ₹720 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
How an infrared remote sends codes; Decoding keys with the IRremote library; Choosing an action with switch and case; Hue-based rainbow colours.
The ESP32 is a 3.3V board: never connect a 5V signal straight to a GPIO pin.
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.