This document details an ESP32-based RGB LED control system with the following capabilities:
- π 2-channel PWM control for red and green LED strips
- π Automatic relay control after 19:00 based on Turkey/Istanbul time
- π± Web interface and physical button control
- π HC-SR04 presence detection for energy saving
- π€οΈ LED dance mode based on Turkey/Ankara weather conditions
| Component | Qty | Notes |
|---|---|---|
| ESP32 DevKit v1 | 1 | Other versions compatible |
| IRFZ44N MOSFET | 2 | For red and green LEDs |
| 5V Relay Module | 1 | Room light control |
| HC-SR04 | 1 | Distance measurement |
| 128x64 OLED (I2C) | 1 | GPIO6 SDA, GPIO7 SCL |
| 10K Potentiometer | 2 | GPIO4 and GPIO5 |
| Button | 3 | GPIO8, GPIO9, GPIO10 |
| 10K Resistor | 5 | For pull-up |
| Breadboard | 1 | Prototyping |
| Jumper Wires | 20+ | For connections |
graph TD;
ESP32-->|GPIO4|POT1[Potentiometer 1];
ESP32-->|GPIO5|POT2[Potentiometer 2];
ESP32-->|GPIO8|BTN1[Button 1];
ESP32-->|GPIO9|BTN2[Button 2];
ESP32-->|GPIO10|BTN3[Button 3];
ESP32-->|GPIO12|MOSFET1[IRFZ44N Red];
ESP32-->|GPIO13|MOSFET2[IRFZ44N Green];
ESP32-->|GPIO21|RELAY1[Relay];
ESP32-->|GPIO7|OLED_SCL[OLED SCL];
ESP32-->|GPIO6|OLED_SDA[OLED SDA];
ESP32-->|GPIO14|TRIG[HC-SR04 Trig];
ESP32-->|GPIO15|ECHO[HC-SR04 Echo];
MOSFET1-->LED1[Red LED Strip];
MOSFET2-->LED2[Green LED Strip];
RELAY1-->LIGHT[Room Light];
pie
title Power Consumption (Maximum)
"ESP32" : 120
"LED Strip (12V)" : 2000
"Relay Module" : 80
"HC-SR04" : 15
"OLED Display" : 25
-
Core Libraries:
Adafruit_GFX(v1.10.12)Adafruit_SSD1306(v2.5.7)WiFi(v2.0.0)ESPAsyncWebServer(v3.1.0)
-
Time and Weather:
NTPClient(v3.2.1)ArduinoJson(v6.19.4)HTTPClient(v1.2)
/RGB-Control-System-with-ESP32-C6
βββ /web-server
β βββ config.php
β βββ connect.php
β βββ color.php
β βββ relay.php
βββ /includes
β βββ functions.php
βββ index.php
βββ /src
β βββ main.ino
βββ βββ settings.h
-
In Arduino IDE:
- Tools > Board > ESP32 Dev Module
- Flash Mode: "QIO"
- Flash Size: "4MB (32Mb)"
- Partition Scheme: "Default 4MB"
-
Custom settings:
#define WIFI_SSID "YourSSID" #define WIFI_PASS "YourPassword" #define OWM_API_KEY "YourAPIKey"
- PWM Specifications:
- 8-bit resolution (0-255)
- 5kHz PWM frequency
- Control:
- POT1 for red LED adjustment
- POT2 for green LED adjustment
- Turkey/Istanbul timezone (GMT+3)
- Relay activates after 19:00 based on HC-SR04 data:
- Person in room: ON
- Person leaves: OFF
- Ankara weather (OpenWeatherMap API):
GET https://api.openweathermap.org/data/2.5/weather?q=Ankara,TR&appid=YOUR_API_KEY&units=metric&lang=en
- BTN3 dance mode: LEDs synchronize based on weather conditions.
graph TD;
A[Main Menu] --> B[LED Values];
A --> C[Relay Status];
A --> D[MOSFET Status];
B --> B1[Red: 0-255];
B --> B2[Green: 0-255];
C --> C1[ON/OFF];
D --> D1[PWM Setting];
D --> D2[ON/OFF];
| Button | Single Click | Double Click | Usage |
|---|---|---|---|
| BTN1 | Menu down | Relay status | POT1 value adjustment |
| BTN2 | Menu up | MOSFET status | POT1 value adjustment |
| BTN3 | Confirm selection | Dance mode | Toggle operations |
- Endpoints:
/ # Homepage /relay/on # Relay on /relay/off # Relay off
-
LEDs not lighting:
- Check MOSFET gate resistor (10K-100Ξ©)
- Verify 12V power supply adequacy
- Reduce PWM frequency (try 500Hz)
-
HC-SR04 incorrect measurements:
// Correct settings: #define TRIG_PULSE 10 // 10ΞΌs trigger pulse #define MAX_DISTANCE 400 // Maximum 4m
-
WiFi connection issues:
- Use
WiFi.mode(WIFI_STA); - Channel setting:
WiFi.begin(ssid, password, 6); // Channel 6
- Use
# System info
> SYSTEM INFO
# LED test
> LED TEST RED 255
# Relay test
> RELAY TOGGLE
# Sensor test
> SENSOR READ| Address | Data | Size |
|---|---|---|
| 0x00 | WiFi SSID | 32 byte |
| 0x20 | WiFi Pass | 64 byte |
| 0x60 | LED Settings | 16 byte |
| 0x70 | Timing | 32 byte |
- License: CERN-OHL-S-2.0
As the backbone of our hardware supply chain, Elecrow delivered:
- Mission-critical components: IRFZ44N MOSFETs, 10K resistors, HC-SR04 sensors
- Lightning-fast logistics: 72-hour emergency delivery for prototyping phases
- Engineer-to-engineer support: Customized circuit design recommendations
| Service | Capabilities | Maker Advantages |
|---|---|---|
| PCB Fabrication | 2-16 layer boards |
|
| Component Store | 10,000+ parts |
|
| Full Assembly | SMT & THT |
|
- [ ] **NEW20** β 20% off first order
- [ ] **FREESHIP** β Free shipping over $150
- [ ] **ASK10** β 10 free consulting minutes"When our MOSFETs failed during testing, Elecrow's team personally hand-selected replacement units and expedited shipping. This level of care makes them the unsung hero of hardware startups."
β RGB-Control-System-with-ESP32-C6, Project Lead
π Official Site | βοΈ Support | πΌ LinkedIn
Elecrow's engineering team reviewing our project requirements
π‘οΈ Trust Indicators:
β ISO 9001 & UL Certified
β PayPal & Escrow Protection
β 365-Day Quality Warranty
#ElecrowHeroes #HardwareMadeEasy #MakerMovement
Pro Tip: Show this badge on your project enclosure to get VIP treatment on future orders:

Our project thrives at the intersection of hardware and digital creativity β and Rhino 3D made that possible by delivering:
- Parametric modeling flexibility: Complex control enclosures and 3D-printable casing design
- Seamless compatibility: Export-ready formats for laser cutting, CNC milling, and 3D printing
- Precise prototyping: 0.01mm tolerance modeling ensured hardware alignment on the first try
With Rhinoβs powerful NURBS modeling engine, we achieved advanced geometric detail without compromising manufacturability or time-to-market.
| Feature | Contribution to Project | Bonus Insight |
|---|---|---|
| Grasshopper | Parametric casing & modular enclosures | Interactive adjustments in real-time |
| Mesh Tools | Optimized STL export for 3D printing | Zero mesh errors on slicing |
| Plugin Ecosystem | Kangaroo, LunchBox, Human UI | Integrated user interaction + form-finding |
| File Interoperability | Export to STEP, IGES, STL | Easy transition from design to fabrication |
Using Rhino 3D, we designed:
- Custom mount brackets for our ESP32-C6 DevKit
- OLED screen bezel that fits flush within laser-cut panels
- Modular RGB LED diffuser shells optimized for IRFZ44N-based control
All components were simulated, exported, and fabricated β without a single dimensional error.
"Designing precision-fit casings for embedded systems is often trial and error β but with Rhino, it became an exact science. Itβs not just a CAD tool, itβs our digital workshop."
β RGB-Control-System-with-ESP32-C6, Project Lead
π Official Website | βοΈ Support | πΌ LinkedIn
Design stages of our ESP32-based casing using Rhino 3D
Show your appreciation and let the world know youβre backed by professional design tools.
Badge Perks:
β Recognized by the Rhino 3D community
β Eligibility for early-access plugin invites
Tip: Add this badge on your GitHub Readme or 3D-printed enclosure label to boost your project's professional look.
π‘οΈ Trust Indicators:
β 25+ years of digital modeling legacy
β Global maker and architecture community
β Regular updates & academic access
#Rhino3D #ParametricDesign #HardwareWithStylee
- Email: info@makerpcb.com.tr
- Website: https://makerpcb.com.tr
- Issue Tracking: GitHub Issues
This document covers all project details. Follow the project GitHub page for updates:
π GitHub Repository
Project Versiyon: V1.5

