Elecrow's 2nd Electronics Design Contest is Heating Up! Win $6,000 cash + Maker products + Official sponsorship! Share your designs today! [Learn More]

user-img

Hamza Deniz Yılmaz

  • 1 Projects
  • 2 Followers
  • Apr 06,2025
+ Follow

RGB Control System With ESP32-C6

RGB Control System With ESP32-C6

RGB Control System With ESP32-C6
 
  • thumbnail-img
 

Story

RGB LED Strip Control System – Special Project Guide

🌟 PROJECT OVERVIEW
This document outlines an ESP32-based RGB LED control system with the following features:

  • 2-channel PWM control (for red and green LED strips)

  • Automatic relay control after 7:00 PM (based on Turkey/Istanbul time)

  • Web interface and physical button control

  • HC-SR04-based presence detection for energy saving

  • LED dance mode based on Ankara weather data

🛠️ HARDWARE DETAILS

🔧 Required Components:

  • ESP32 DevKit v1 (1 unit)

  • IRFZ44N MOSFET (2 units - for red and green LED strips)

  • 5V Relay Module (1 unit - room light control)

  • HC-SR04 (1 unit - distance measurement)

  • 128x64 OLED (I2C) (GPIO6 SDA, GPIO7 SCL)

  • 10K Potentiometer (2 units - GPIO4 and GPIO5)

  • Push Button (3 units - GPIO8, GPIO9, GPIO10)

  • 10K Resistor (5 units - for pull-up)

  • Breadboard (1 unit)

  • Jumper Wires (20+ units)

🎛️ Pin Mapping:

ESP32 --> GPIO4 --> POT1 (Red LED control) ESP32 --> GPIO5 --> POT2 (Green LED control) ESP32 --> GPIO8 --> BTN1 ESP32 --> GPIO9 --> BTN2 ESP32 --> GPIO10 --> BTN3 ESP32 --> GPIO12 --> MOSFET1 (Red LED) ESP32 --> GPIO13 --> MOSFET2 (Green LED) ESP32 --> GPIO21 --> RELAY1 (Room Light) ESP32 --> GPIO7 --> OLED_SCL ESP32 --> GPIO6 --> OLED_SDA ESP32 --> GPIO14 --> TRIG (HC-SR04 Trigger) ESP32 --> GPIO15 --> ECHO (HC-SR04 Echo) MOSFET1 --> LED1 (Red LED Strip) MOSFET2 --> LED2 (Green LED Strip) RELAY1 --> LIGHT (Room Light)

Power Management:

  • ESP32: 120mA

  • LED Strip (12V): 2000mA

  • Relay Module: 80mA

  • HC-SR04: 15mA

  • OLED Display: 25mA

💾 SOFTWARE SETUP

📥 Required Libraries:

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)

⚙️ Code Structure:

/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

🔄 Flashing Process (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"

🎛️ SYSTEM FEATURES

💡 LED Control System:

PWM Features:

  • 8-bit resolution (0–255)

  • 5kHz PWM frequency

Control:

  • POT1: Red LED intensity

  • POT2: Green LED intensity

⏱️ Time-Based System:

  • Timezone: Turkey/Istanbul (GMT+3)

  • Relay activation based on HC-SR04 after 7:00 PM:

    • Person detected: ON

    • No presence: OFF

🌤️ Weather Integration:

  • 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 (double click): Activates dance mode — LEDs synchronize based on weather

🖥️ USER INTERFACE

📺 OLED Menu Structure:

  • Main Menu

    • LED Values → Red: 0–255 / Green: 0–255

    • Relay Status → ON/OFF

    • MOSFET Status → PWM Setting / ON/OFF

🕹️ Button Controls:

BTN1:

  • Single Click: Menu Down

  • Double Click: Relay Status

  • Usage: POT1 Value Adjustment

BTN2:

  • Single Click: Menu Up

  • Double Click: MOSFET Status

  • Usage: POT1 Value Adjustment

BTN3:

  • Single Click: Confirm Selection

  • Double Click: Dance Mode

  • Usage: Toggle Options

🌐 Web Interface:

Endpoints:

  • / → Homepage

  • /relay/on → Turn Relay ON

  • /relay/off → Turn Relay OFF

🔧 TROUBLESHOOTING GUIDE

🚨 Common Issues:

LEDs Not Working:

  • Check MOSFET gate resistor (10K–100Ω)

  • Verify 12V power supply

  • Lower PWM frequency (try 500Hz)

HC-SR04 Inaccurate Readings:

#define TRIG_PULSE 10 // 10μs trigger pulse #define MAX_DISTANCE 400 // Max 4 meters

WiFi Connection Problems:

WiFi.mode(WIFI_STA); WiFi.begin(ssid, password, 6); // Use channel 6

📊 Serial Monitor Test Commands:

  • SYSTEM INFO → System Information

  • LED TEST RED 255 → LED Test

  • RELAY TOGGLE → Relay Test

  • SENSOR READ → Sensor Test

📈 ADVANCED SETTINGS

⚙️ EEPROM Configuration:

  • 0x00: WiFi SSID (32 bytes)

  • 0x20: WiFi Password (64 bytes)

  • 0x60: LED Settings (16 bytes)

  • 0x70: Timing (32 bytes)

📜 LICENSE:

  • CERN-OHL-S-2.0

🤝 SPONSORS

📞 CONTACT & SUPPORT

 

 

This document covers all project details. For updates, follow the GitHub project page:
🔗 https://github.com/hamzadenizyilmaz/RGB-Control-System-with-ESP32-C6

Code
  • ESP32 Code

    https://github.com/hamzadenizyilmaz/RGB-Control-System-with-ESP32-C6/tree/main/src
    View
  • ESP32 Web Server

    https://github.com/hamzadenizyilmaz/RGB-Control-System-with-ESP32-C6/tree/main/web-server
    View

RGB Control System With ESP32-C6

RGB Control System With ESP32-C6

82
 
2
0
0
These revenues will go back into supporting creators, contests, and the open source ecosystem, and more.

Share your project on social media to expand its influence! Get more people to support it.

  • Comments( 0 )
  • Like( 2 )
/1000
Upload a photo:
You can only upload 1 files in total. Each file cannot exceed 2MB. Supports JPG, JPEG, GIF, PNG, BMP

You May Also Like

View All
Add to cart
Board Type : GerberFile :
Layer : Dimensions :
PCB Qty :
Different PCB Design
PCB Thickness : PCB Color :
Surface Finish : Castellated Hole :
Copper Weight : 1 oz Production Time :
Total: US $
As a sharing platform, our community will not bear responsibility for any issues with this design and parameters.

PCB Assembly

PCBA Qty: BomFile:
NO. OF UNIQUE PARTS: NO. of Components:
Assembly Cost: US $
As a sharing platform, our community will not bear responsibility for any issues with this design and parameters.
Add to cart
3dPrintingFile : Size :
Unit : Volumn :
3D Printing Qty : Material :
Total: US $12.99
As a sharing platform, our community will not bear responsibility for any issues with this design and parameters.
Add to cart
Acrylic Type : AcrylicFile :
Dimensions: Engrave:
Acrylic Qty :
Acrylic Thickness:
Acrylic Color:
Total: US $12.99
As a sharing platform, our community will not bear responsibility for any issues with this design and parameters.
Add to cart
CNC Milling File : Size:
Unit: Volumn:
CNC Milling Qty : Material:
Type of Aluminum: Surface Finish:
Tolerance:
Surface Roughness:
Total: US $12.99
As a sharing platform, our community will not bear responsibility for any issues with this design and parameters.
Add to cart
Item Price Qty Subtotal Delete
Total: US $0.00
Certified Product | Supported Purchase: Full After-sales Protection