DEV Community

John  Ajera
John Ajera

Posted on

Getting RGB LED Working on ESP32-C3 DevKitM-1 / Rust-1

Getting RGB LED Working on ESP32-C3 DevKitM-1 / Rust-1

This guide shows how to configure Arduino IDE for the ESP32-C3 DevKitM-1 / Rust-1 board and control its onboard WS2812 RGB LED using GPIO2.


1. Configure Arduino IDE for ESP32-C3

  1. Go to File → Preferences and add the ESP32 board URL:

    https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
    
  2. Open Tools → Board → Board Manager, search for esp32, and install it.

  3. Select Tools → Board → ESP32 Arduino → ESP32C3 Dev Module.

  4. Under Tools, choose the following:

    Setting Value
    Upload Speed 115200
    CPU Frequency 160 MHz
    Flash Frequency 80 MHz
    Flash Size 4 MB
    Partition Scheme Default 2 MB app, 2 MB SPIFFS
  5. Select the COM port under Tools → Port where the board is connected.


2. Install Required Library

Open Sketch → Include Library → Manage Libraries, search for Adafruit NeoPixel, and click Install.


3. Final RGB Blink + Serial Test Sketch

This sketch drives the onboard WS2812 RGB LED connected to GPIO2.
Open Serial Monitor at 115200 baud to see which color is active.

#include <Adafruit_NeoPixel.h>

#define LED_PIN 2  // ESP32-C3 DevKitM-1 / Rust-1 onboard RGB LED pin
#define LED_COUNT 1

Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  Serial.begin(115200);
  delay(1000);
  Serial.println("✅ RGB LED test started on GPIO2");

  strip.begin();
  strip.setBrightness(50);
  strip.clear();
  strip.show();
}

void loop() {
  Serial.println("RED");
  strip.setPixelColor(0, strip.Color(255, 0, 0));
  strip.show();
  delay(500);

  Serial.println("GREEN");
  strip.setPixelColor(0, strip.Color(0, 255, 0));
  strip.show();
  delay(500);

  Serial.println("BLUE");
  strip.setPixelColor(0, strip.Color(0, 0, 255));
  strip.show();
  delay(500);
}
Enter fullscreen mode Exit fullscreen mode

4. Expected Behavior

  • The LED will cycle red → green → blue every 1.5 seconds.
  • Serial Monitor will print the current color name.
  • If colors look swapped, change NEO_GRB to NEO_RGB in the strip declaration.

5. Troubleshooting

  • No light? Make sure you installed the Adafruit NeoPixel library and selected the correct COM port.
  • Dim light? Increase strip.setBrightness(50) to a higher value (0–255).

Demo Video: ESP32-C3 RGB LED Blink Demo

With this setup, you can easily verify that your ESP32-C3 DevKitM-1 / Rust-1 board is configured correctly and its onboard RGB LED is working.

Top comments (0)