# WiFi-Controlled RGB Power Lamp

This repository documents the design and implementation of a WiFi-controlled RGB lamp using discrete power electronics and embedded systems. The lamp is based on 3× 5W LEDs (RGB), driven by LM3404 constant-current drivers, monitored by INA226 current sensors, and controlled by an ESP8266 microcontroller via a custom web interface.

---

## Overview

- **Microcontroller**: ESP8266 (ESP-12E)
- **LED Drivers**: LM3404, one per color channel
- **Current Sensors**: INA226 (I²C), one per channel
- **Power Supply**: 24V DC input, regulated to 5V and 3.3V
- **User Interface**: Web application hosted on ESP8266 for RGB control and power monitoring

---

## System Architecture


**Block Diagram:**

![Block Diagram](assets/block-schematic.png)

---

## Web Interface

- RGB control using Vue-based color picker
- Adjustable brightness slider (mapped to PWM)
- Real-time current monitoring (INA226)
- Basic animation mode (rainbow sequence)

**Web UI Screenshot:**

![Web UI](assets/webapp.png)

---

## PCB Design

- 2-layer FR4 PCB with thermal copper pours and via stitching
- Test points for PWM, switch nodes, and sense lines
- FFC interface for external programmer
- Custom CH340C programming board (USB → UART)

**gerber View:**

![PCB gerber](assets/gerber.png)



**3D Render:**

![3D PCB Render](assets/render.png)


**3D Render:**

![ PCB ](assets/pcb.png)

---

## Testing and Analysis

### Thermal Imaging

- Thermal images captured using Fluke thermal camera
- Red LED remains coolest; green and blue require better cooling
- Thermal deviation from calculated values due to PCB/slug bonding

**Thermal Measurement Example:**

![Thermal Image](assets/thermal.png)

### Oscilloscope Measurements

- Switching ripple observed and confirmed within expected range
- DCM ringing noted at switch nodes; no impact on operation


---

## Known Issues & Improvements

- **DIM Pin Fix**: Initial circuit caused full brightness during MCU boot. Fixed with pulldown resistor.
- **I²C Line Reversal**: SDA/SCL reversed in layout; resolved via software GPIO reassignment.
- **Thermal Solution**: Future revisions should consider external heatsink or aluminum-core PCB.

---


## Full Report

All design calculations, schematics, measurements, and references are available in the final report:

[📄 Project_RubenSchoonbaert.pdf](docs/Project_RubenSchoonbaert.pdf)

---

