Skip to main content
Version: ACS CC

Weather-Based Mood Lamp

A decorative lamp that adapts its ambient color effects based on weather conditions.

info

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)

diagram

Log

Week 5 - 11 May

Week 12 - 18 May

Week 19 - 25 May

Hardware

  1. 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.
  2. ESP32 Dev Board B

    • Secondary microcontroller; simulates weather conditions by sending custom temperature and humidity values to the main controller via UART.
  3. 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.
  4. Push Button

    • Allows switching between online (API-based) and local (simulated) weather modes.
  5. Power Bank (5V / 2A)

    • Portable power supply for both ESP32 boards and the LED ring.

Schematics

diagram

Bill of Materials

DeviceUsagePrice
ESP32 cu WiFi si Bluetooth 4.2Main and secondary controller2 x 34,99 lei = 69,98 lei
WS2812 RGB LED Ring 24RGB lighting23,18 lei
DHT22 Temp/Humidity SensorOptional local sensor23,12 lei
Breadboard 830 pointsConnect all components4 x 9,98 lei = 39,92 lei
Jumper Wires M-M 30cmConnections7,98 lei
Jumper Wires F-F 30cmConnections9,99 lei
Jumper Wires M-F 20cmConnections7,99 lei
Capacitor 1000uF 35VLED spike protection2,99 lei
Micro USB CablePower + programming2 x 3,99 lei = 7,98 lei
10kΩ ResistorPull-up for sensor0,10 lei
470Ω ResistorSignal line protection0,10 lei
Enclosure BoxComponent protection
White Round ButtonMode switch1,99 lei
Power Bank PROMATE Bolt-20PDPower supply

Total: ~200 de lei

Software

LibraryDescriptionUsage
embassyAsync runtime for embedded RustUsed for async execution, Wi-Fi, and peripheral control
ws2812-rsWS2812 LED controlDrives RGB lighting effects
serdeSerialization frameworkUsed to parse JSON from API
serde_jsonJSON parsingParses weather data
esp-idf-halESP32 hardware abstractionFor pin, UART, and GPIO access
  1. OpenWeatherMap API
  2. WS2812 RGB LEDs Documentation
  3. Lab 03 - PWM & ADC
  4. Lab 07 - Wi-Fi
  5. ESP32 Rust Book