Remote-controlled RGB mood light
Warm, cool, rainbow or breathing: cycle lighting moods from your sofa.
Shop by category
Shop all componentsThe LM35 measures the temperature and the Uno mixes the RGB LED to match: blue at 20 degrees or below, through green, to red at 40 and above. Hold the sensor between your fingers and watch the colour change.
Every main part of this project is an item on the public Package 1 equipment list, so a school lab that already owns Package 1 can build it without buying anything extra.
See the full Atal Tinkering Lab packages →
Geekobot is an independent shop, not endorsed by or affiliated with NITI Aayog or the Atal Innovation Mission. Item names follow the public AIM equipment list.
Tick anything you already have and the total updates.
Connects the Uno to your computer to upload code and power it
Analog temperature sensor that outputs 10 mV for every degree Celsius, so no library or calibration table is needed.
Three LEDs (red, green, blue) in one package; mixing their brightness makes any colour.
Classic 16-character, 2-line LCD with an I²C backpack, so it needs only two signal wires.
One 220 ohm resistor in series with each colour leg
Follow the colours: red is power, dark grey is ground, blue is a signal.
atl_rgb_temperature_lamp.inoVerify & upload in Electrolark// RGB temperature lamp
// Geekobot project library · board: Arduino Uno
// Wiring diagram, parts list and build steps: Geekobot project page "atl-rgb-temperature-lamp"
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// ---- pins ----
const uint8_t LM35_PIN = A0;
const uint8_t RGB_R = 3;
const uint8_t RGB_G = 5;
const uint8_t RGB_B = 6;
const int ADC_MAX = 1023; // 10-bit analog input
const float VREF = 5.0f;
LiquidCrystal_I2C lcd(0x27, 16, 2);
// ---- latest readings ----
float tempC = 0;
const float COOL_C = 20.0; // blue at or below this
const float HOT_C = 40.0; // red at or above this
unsigned long lastRead = 0;
float readLm35C() {
long s = 0;
for (int i = 0; i < 20; i++) s += analogRead(LM35_PIN); // average out the noise
return (s / 20.0f) * VREF * 100.0f / ADC_MAX; // 10 mV per degree C
}
void setRgb(uint8_t r, uint8_t g, uint8_t b) {
analogWrite(RGB_R, r);
analogWrite(RGB_G, g);
analogWrite(RGB_B, b);
}
void setup() {
Serial.begin(115200);
pinMode(RGB_R, OUTPUT); pinMode(RGB_G, OUTPUT); pinMode(RGB_B, OUTPUT);
lcd.init();
lcd.backlight();
Serial.println(F("RGB temperature lamp ready"));
}
void loop() {
if (millis() - lastRead < 500) return;
lastRead = millis();
float t = readLm35C();
float f = constrain((t - COOL_C) / (HOT_C - COOL_C), 0.0f, 1.0f); // 0 = cool, 1 = hot
setRgb((uint8_t)(255 * f), (uint8_t)(120 * (1.0f - fabs(f - 0.5f) * 2)), (uint8_t)(255 * (1.0f - f)));
lcd.setCursor(0, 0);
lcd.print(F("Temp "));
lcd.print(t, 1);
lcd.print(F(" C "));
Serial.println(t);
}
The sketch above runs here on a simulated Arduino Uno. Move the sliders for the sensors and buttons it reads, and watch the Serial monitor, display and outputs change.
Keep the sensor away from the board regulator and warm parts, and add a 100 nF capacitor from OUT to GND.
The sketch already averages 20 samples. Add the capacitor and shorten the wire.
The legs are in a different order on your LED. Touch each leg in turn to find red, green and blue and re-wire.
Adjust the contrast pot on the backpack. If still blank, change 0x27 to 0x3F.
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. Analog readings run 0–4095 instead of 0–1023, which the ADC_MAX constant handles.
Use a 5 V USB phone charger or a power bank into the board's USB port.
8 parts: Uno R3 CH340G ATmega328p Compatible Development Board, Arduino USB-A to USB-B Data Cable for UNO/MEGA, LM35D Analog Temperature Sensor Module – Analog Voltage Output, 5mm RGB LED (Pack of 10), LCD1602 16x2 Character LCD (blue, with I2C adapter), 3 × 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 intermediate project and takes about 2 hours. The build on this page has 8 steps.
No. This page has the complete, tested code (atl_rgb_temperature_lamp.ino). Install this library first: LiquidCrystal I2C.
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 ₹707 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.
Analog temperature sensing and ADC resolution; Character displays and I²C backpacks; Colour mixing with PWM.
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.
RGB temperature lamp ready 150.05 150.05 150.12 150.10 150.15
A simulation of the sketch above, so you know what to expect. Real readings vary with your parts and wiring.