Electronic dice on an LED matrix
Press to roll: the pips tumble and slow down before landing on a number.
Shop by category
Shop all componentsA 16-LED ring inside a frosted jar or lampshade makes a lovely mood light. Remote buttons cycle through warm white, cool white, a rotating rainbow and a slow breathing effect, and adjust brightness.
Tick anything you already have and the total updates.
38 kHz infrared receiver that decodes button codes from almost any TV or AC remote.
Sixteen individually addressable RGB LEDs on one data wire.
Follow the colours: red is power, dark grey is ground, blue is a signal.
ir_remote_mood_light.inoVerify & upload in Electrolark// Remote-controlled RGB mood light
// Geekobot project library · board: Arduino Nano
// Wiring diagram, parts list and build steps: Geekobot project page "ir-remote-mood-light"
#include <IRremote.hpp>
#include <Adafruit_NeoPixel.h>
// ---- pins ----
const uint8_t IR_PIN = 2;
const uint8_t RING_PIN = 3;
const int RING_LEDS = 16;
Adafruit_NeoPixel ring(RING_LEDS, RING_PIN, NEO_GRB + NEO_KHZ800);
const uint16_t CMD_NEXT = 0x40; // map these to your remote (see Serial Monitor)
const uint16_t CMD_BRIGHTER = 0x46;
const uint16_t CMD_DIMMER = 0x15;
const uint16_t CMD_OFF = 0x45;
int mode = 0; // 0 warm, 1 cool, 2 rainbow, 3 breathing, 4 off
int brightness = 60;
uint16_t hue = 0;
void showLevel(int pct, uint32_t color) {
int lit = constrain(pct, 0, 100) * RING_LEDS / 100;
for (int i = 0; i < RING_LEDS; i++) ring.setPixelColor(i, i < lit ? color : 0);
ring.show();
}
void render() {
ring.setBrightness(brightness);
for (int i = 0; i < RING_LEDS; i++) {
uint32_t col = 0;
if (mode == 0) col = ring.Color(255, 120, 30);
else if (mode == 1) col = ring.Color(120, 180, 255);
else if (mode == 2) col = ring.gamma32(ring.ColorHSV(hue + i * 65536L / RING_LEDS));
else if (mode == 3) { int v = (sin(millis() / 600.0) + 1) * 110; col = ring.Color(v, 0, v / 2); }
ring.setPixelColor(i, col);
}
ring.show();
}
void setup() {
Serial.begin(115200);
IrReceiver.begin(IR_PIN);
ring.begin();
ring.setBrightness(40);
ring.show();
}
void loop() {
if (IrReceiver.decode()) {
uint16_t cmd = IrReceiver.decodedIRData.command;
IrReceiver.resume();
Serial.print(F("IR 0x")); Serial.println(cmd, HEX);
if (cmd == CMD_NEXT) mode = (mode + 1) % 5;
else if (cmd == CMD_BRIGHTER) brightness = min(255, brightness + 25);
else if (cmd == CMD_DIMMER) brightness = max(5, brightness - 25);
else if (cmd == CMD_OFF) mode = 4;
}
hue += 200;
render();
delay(20);
}
The sketch above runs here on a simulated Arduino Nano. Move the sliders for the sensors and buttons it reads, and watch the Serial monitor, display and outputs change.
Point the remote straight at the receiver, check the OUT pin, and try a fresh remote battery.
Add the 330 Ω resistor in series with DIN and share GND with the board.
Open the Serial Monitor at 115200 baud and check for messages. Make sure you chose the right board and port in the Arduino IDE.
Close other programs using the serial port, try another USB cable (some are charge-only) and press reset just before uploading.
Yes. Most of the code works unchanged on an ESP32 with the ESP32 board package. Watch for 5 V modules: ESP32 pins are 3.3 V, so 5 V output signals need a resistor divider.
Use a 5 V USB phone charger or a power bank into the board's USB port.
6 parts: Nano CH340 Development Board (Soldered), Digital 38kHz Infrared Receiver Module, WS2812 RGB LED Ring (16 LEDs), Resistor Assortment Kit (30 Values), Solderless Breadboard (830 points) and Dupont Jumper Wires (40 pcs). Tools: Digital Multimeter and Wire Stripper and Cutter. 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 1 hour. The build on this page has 7 steps.
No. This page has the complete, tested code (ir_remote_mood_light.ino). Install these libraries first: IRremote and Adafruit NeoPixel.
Yes. The Run it panel under the code runs this exact sketch on a simulated board. Move the sliders or press the buttons for the sensors it reads, and the Serial monitor, display and outputs react as they will on the real build. It is a simulation, so real readings depend on your parts and wiring.
About ₹375 for the parts at the prices on this page, plus tools if you do not have them. Quantity price breaks lower the cost when you build several.
Addressable LEDs and colour mixing; Infrared remote protocols (NEC).
Ideas that reuse this build: Music-reactive LEDs. They are listed under Take it further on this page.
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.
Time, date and an alarm you set with one button.
Learning project. Check every circuit and the datasheet of each part before you power it up.
A simulation of the sketch above, so you know what to expect. Real readings vary with your parts and wiring.