πŸ”§ Xiao ESP32C6 LED Controller - Hardware Guide

Complete wiring and connection instructions for the LED control system

πŸ“‹ Xiao ESP32C6 Overview

The Xiao ESP32C6 is a compact WiFi-enabled microcontroller with improved capabilities:

Specification Details
Processor ESP32-C6 (Dual Core, 160MHz)
RAM 400KB
Flash 4MB
WiFi 802.11 b/g/n (2.4GHz)
USB USB-C
GPIO Pins 11 total (we use 4 for LEDs)
Power Supply 5V USB or 3.3V external

πŸ“Œ Pinout Diagram

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Xiao ESP32C3 Pinout β”‚ β”‚ β”‚ β”‚ USB-C Port (Top) β”‚ β”‚ ──────────────── β”‚ β”‚ β”‚ β”‚ 5V GND GPIO0 GPIO1 β”‚ Left Side β”‚ ● ● ● ● β”‚ β”‚ β”‚ β”‚ GPIO4 GPIO5 GPIO6 GPIO7 β”‚ Right Side β”‚ ● ● ● ● β”‚ β”‚ β”‚ β”‚ GND 3.3V GPIO2 GPIO3 β”‚ Bottom β”‚ ● ● ● ● β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
Note: Exact pinout may vary. Verify with official Seeed documentation for your specific board revision.

πŸ’‘ LED Pin Configuration

In this project, 4 LEDs are controlled using the following GPIO pins:

GPIO 0
LED 1 (Red)
Pin 6 on physical board
GPIO 1
LED 2 (Cyan)
Pin 7 on physical board
GPIO 2
LED 3 (Blue)
Pin 11 on physical board
GPIO 3
LED 4 (Orange)
Pin 12 on physical board
⚠️ Important: If these GPIO pins are already in use or conflict with your setup, modify the LED_PINS array in the Arduino code:
const int LED_PINS[4] = {0, 1, 2, 3}; // Change these numbers

πŸ”Œ LED Wiring Guide

Components Needed (per LED)

Wiring for Each LED

GPIO Pin (from ESP32C3) β”‚ β”œβ”€β”€β†’ [220Ξ© Resistor] β”‚ β”œβ”€β”€β†’ (+) LED Anode (Long Leg) β”‚ └──→ (-) LED Cathode (Short Leg) β”‚ └──→ GND (Ground from ESP32C3)

Full Connection Schematic

Xiao ESP32C3 Breadboard β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ GPIO 0 ────┼─────[220Ξ©]β”€β”€β”€β”€β”€β”Œβ”€(+)LED1(-)─┐ β”‚ GPIO 1 ────┼─────[220Ξ©]β”€β”€β”€β”€β”€β”œβ”€(+)LED2(-)── β”‚ GPIO 2 ────┼─────[220Ξ©]β”€β”€β”€β”€β”€β”œβ”€(+)LED3(-)── β”‚ GPIO 3 ────┼─────[220Ξ©]β”€β”€β”€β”€β”€β”œβ”€(+)LED4(-)── β”‚ β”‚ β”‚ β”‚ β”‚ GND β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
πŸ’‘ Tip: Use a breadboard to organize connections neatly. This makes troubleshooting easier and prevents accidental short circuits.

πŸ‘£ Step-by-Step Connection Instructions

Step 1: Prepare the LEDs

βœ“ Identify the long leg (anode/+) and short leg (cathode/-) of each LED

βœ“ Bend the legs if needed for easier breadboard insertion

Step 2: Connect Power and Ground Rails

βœ“ Connect Xiao's GND pin to the ground rail on the breadboard

βœ“ This creates a common ground for all LEDs

Step 3: Install Resistors

βœ“ Insert a 220Ξ© resistor into the breadboard for each LED

βœ“ One end connects to the GPIO pin, other end to LED anode

Step 4: Connect LEDs

βœ“ Connect LED anode (+) to the resistor output

βœ“ Connect LED cathode (-) to the ground rail

Step 5: Verify Connections

βœ“ Double-check each LED cathode is connected to ground

βœ“ Verify resistors are in series between GPIO and LED

βœ“ No loose wires should touch each other

Step 6: Power Up

βœ“ Connect Xiao ESP32C3 to computer via USB-C

βœ“ LEDs should not light up initially (GPIO pins are LOW)

πŸ”¬ Resistor Selection

The 220Ξ© resistor limits current to safe levels for the GPIO pins and LEDs.

LED Color Typical Forward Voltage Recommended Resistor
Red 2.0V 220Ξ© - 470Ξ©
Green 2.2V 220Ξ© - 470Ξ©
Blue/Cyan 3.2V 150Ξ© - 220Ξ©
Yellow 2.1V 220Ξ© - 470Ξ©
Calculation for Red LED: - ESP32 GPIO Output: 3.3V - LED Forward Voltage: 2.0V - Voltage Drop Across Resistor: 3.3V - 2.0V = 1.3V - Desired LED Current: ~20mA - Resistor Value: R = V/I = 1.3V / 0.02A = 65Ξ© Practical values (use nearest standard resistor): - 220Ξ© for safety (brighter = less resistor, dimmer = more resistor) - 470Ξ© for dimmer LEDs - 150Ξ© for maximum brightness (not recommended for safety)

⚑ Power Consumption

Component Current Draw
Xiao ESP32C3 (Idle) ~20mA
Xiao ESP32C3 (WiFi Active) ~100-200mA
Single LED (with 220Ξ© resistor) ~15mA
All 4 LEDs ON ~60mA
Total (WiFi + 4 LEDs) ~260mA Maximum
πŸ’‘ Note: A standard USB port provides 500mA at 5V. Your setup will work fine with USB power. For battery operation, use at least 1000mAh capacity.

πŸ”§ Troubleshooting

❌ LED doesn't light up

❌ LED always on (won't turn off)

❌ LED is dim

❌ Multiple LEDs interfere with each other

⚠️ Safety Precautions

DO NOT:
  • Connect GPIO pins directly to 5V without a resistor
  • Reverse LED polarity (can damage the LED and GPIO pin)
  • Use resistors smaller than 150Ξ© (excessive current can damage GPIO)
  • Allow bare wires to touch each other (short circuit)
  • Connect high-current devices (motors, relays) directly to GPIO
DO:
  • Always use appropriate resistors in series with LEDs
  • Connect a common ground between ESP32 and all circuits
  • Use a breadboard to organize connections neatly
  • Test connections before powering on
  • Keep WiFi antenna away from high-current wiring

πŸ§ͺ Testing Your Setup

Test 1: Hardware Test with Arduino IDE

Upload this simple test sketch to verify GPIO pins work:

void setup() { Serial.begin(115200); pinMode(0, OUTPUT); pinMode(1, OUTPUT); pinMode(2, OUTPUT); pinMode(3, OUTPUT); } void loop() { digitalWrite(0, HIGH); delay(500); digitalWrite(0, LOW); delay(500); // Repeat for pins 1, 2, 3 }

Test 2: Check WiFi Connection

Ensure ESP32 connects to your WiFi network and verify the IP address via Serial Monitor

Test 3: Test API Endpoints

Use curl or web browser to test endpoints:

# Check device is reachable ping 192.168.1.100 # Test API curl http://192.168.1.100/status curl http://192.168.1.100/led1/on curl http://192.168.1.100/info

Test 4: Full System Test

Open page 1.html in browser and test all LED buttons

πŸš€ Advanced Modifications

Add More LEDs

The Xiao ESP32C3 has enough GPIO pins for up to 8 LEDs. Modify the code:

// In esp32_led_controller.ino const int LED_PINS[8] = {0, 1, 2, 3, 5, 6, 7, 21}; // Up to 8 LEDs

Use PWM for Brightness Control

Replace digitalWrite with analogWrite for brightness control:

// Brightness 0-255 analogWrite(LED_PINS[0], 128); // 50% brightness

Add Button Control

Connect a physical button to GPIO pin 4 for manual LED control

Temperature Monitoring

Add temperature sensor (DHT11/BME280) to monitor environment


Version: 1.0 | Device: Xiao ESP32C6 | Last Updated: 2026-05-04