Weather-Based Mood Lamp
A decorative lamp that adapts its ambient color effects based on weather conditions.
Author: Georgiana-Elena Ilie
GitHub Project Link: https://github.com/UPB-PMRust-Students/proiect-georgianailie109
Description
The Weather-Based Mood Lamp is a smart decorative device that changes its RGB lighting effects based on the weather outside. It uses two ESP32 microcontrollers: one that connects to the internet and fetches real-time weather information from the OpenWeatherMap API, and a second one that allows the user to simulate local weather by inputting custom temperature and humidity values.
This allows for both automatic operation and manual testing, with a button enabling the user to switch between real-time online data and locally simulated weather. The lamp uses a ring of individually addressable RGB LEDs (WS2812) to generate ambient lighting effects based on the current weather, such as sunshine, rain, snow, or clouds.
Motivation
I chose this project as a way to combine aesthetics with technology. It brings together microcontroller programming in Rust, real-time data interaction, and RGB lighting to create a decorative lamp that changes its appearance based on the current weather. The cloud-shaped design makes the lamp look friendly and relaxing, which means it can work not just as a smart decorative light, but also as a fun way for kids to learn about the weather or use it as a nightlight. The project also gives me a way to demonstrate communication between two microcontrollers and the integration of internet-based data.
Architecture
The project consists of two main components:
-
ESP32 A (Main Controller)
- Connects to the internet
- Fetches weather data from OpenWeatherMap API
- Controls the RGB LED ring
- Reads mode switch input (button)
- Communicates with ESP32 B via UART
-
ESP32 B (Local Weather Simulator)
- Allows the user to simulate weather via UART
- Sends temperature and humidity data to ESP32 A
Mode Switching:
- Controlled via a physical button connected to ESP32 A
- Toggles between ONLINE mode (API weather) and LOCAL mode (simulated weather)
Log
Week 5 - 11 May
Week 12 - 18 May
Week 19 - 25 May
Hardware
-
ESP32 Dev Board A
- Main microcontroller; connects to Wi-Fi, gets weather data from the internet using an API, controls the LEDs, and handles the mode switching.
- Communicates with the secondary controller via UART in local mode.
-
ESP32 Dev Board B
- Secondary microcontroller; simulates weather conditions by sending custom temperature and humidity values to the main controller via UART.
-
WS2812 RGB LED Ring (24 LEDs)
- Displays ambient lighting that changes based on the current weather (sunny, rainy, snowy, cloudy).
- Controlled by a single data pin from the main ESP32.
-
Push Button
- Allows switching between online (API-based) and local (simulated) weather modes.
-
Power Bank (5V / 2A)
- Portable power supply for both ESP32 boards and the LED ring.
Schematics
Bill of Materials
Device | Usage | Price |
---|---|---|
ESP32 cu WiFi si Bluetooth 4.2 | Main and secondary controller | 2 x 34,99 lei = 69,98 lei |
WS2812 RGB LED Ring 24 | RGB lighting | 23,18 lei |
DHT22 Temp/Humidity Sensor | Optional local sensor | 23,12 lei |
Breadboard 830 points | Connect all components | 4 x 9,98 lei = 39,92 lei |
Jumper Wires M-M 30cm | Connections | 7,98 lei |
Jumper Wires F-F 30cm | Connections | 9,99 lei |
Jumper Wires M-F 20cm | Connections | 7,99 lei |
Capacitor 1000uF 35V | LED spike protection | 2,99 lei |
Micro USB Cable | Power + programming | 2 x 3,99 lei = 7,98 lei |
10kΩ Resistor | Pull-up for sensor | 0,10 lei |
470Ω Resistor | Signal line protection | 0,10 lei |
Enclosure Box | Component protection | |
White Round Button | Mode switch | 1,99 lei |
Power Bank PROMATE Bolt-20PD | Power supply |
Total: ~200 de lei
Software
Library | Description | Usage |
---|---|---|
embassy | Async runtime for embedded Rust | Used for async execution, Wi-Fi, and peripheral control |
ws2812-rs | WS2812 LED control | Drives RGB lighting effects |
serde | Serialization framework | Used to parse JSON from API |
serde_json | JSON parsing | Parses weather data |
esp-idf-hal | ESP32 hardware abstraction | For pin, UART, and GPIO access |