Skip to content

Hey-Salad/xiao-esp32c3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

LED Ring Control for Xiao ESP32C3 🌈

Powered by Seeedstudio's Grove RGB LED Ring

The Grove RGB LED Ring (20 - WS2813 Mini) is a versatile LED display solution that combines powerful WS2813 addressable LEDs with Grove's plug-and-play simplicity. Perfect for creating stunning visual effects and indicators.

⚡ Key Features of Grove RGB LED Ring

  • 🎨 20 Individually Addressable RGB LEDs
  • 💡 WS2813 Chipset with Built-in Controllers
  • 🛡️ Intelligent Reverse-connection Protection
  • 🔄 Signal Break-point Continuous Transmission
  • 📊 256 Gray Levels
  • 🎨 16,777,216 Colors

🔍 Hardware Specifications

  • Operating Voltage: 3.3V/5V
  • Quiescent Current: 0.7mA/LED
  • RGB Channel Current: 16mA/LED
  • Refresh Rate: 2KHz
  • Operating Temperature: -25℃ to 85℃

🚀 About The Code

This project implements three stunning LED patterns with smooth transitions:

1. Rainbow Cycle Pattern

void DisplayRainbowPattern() {
  for (int i = 0; i < kNumLeds; i++) {
    int hue = (g_position + (i * 65536 / kNumLeds)) % 65536;
    g_ring.setPixelColor(i, g_ring.gamma32(g_ring.ColorHSV(hue)));
  }
}

Creates a smooth rainbow effect by:

  • Calculating unique hue values for each LED
  • Using HSV color space for smooth transitions
  • Applying gamma correction for natural-looking colors

2. Chase Pattern

void DisplayChasePattern() {
  const uint8_t kTrailLength = 5;
  for (int i = 0; i < kTrailLength; i++) {
    int pos = (g_position - i) % kNumLeds;
    uint8_t intensity = 255 - (i * 50);
    g_ring.setPixelColor(pos, color);
  }
}

Implements a "comet" effect with:

  • Leading bright pixel
  • Fading tail of 5 pixels
  • Smooth circular movement

3. Breathe Pattern

void DisplayBreathePattern() {
  float brightness = (exp(sin(millis()/2000.0*PI)) - 0.36787944)*108.0;
  g_ring.setBrightness(brightness);
}

Creates a pulsing effect using:

  • Sinusoidal brightness calculation
  • Exponential scaling for natural-looking fade
  • Synchronized LED brightness control

🛠️ Setup Instructions

  1. Hardware Connection

    • Connect LED Ring data pin to GPIO 6
    • Connect VCC to 3.3V/5V
    • Connect GND to ground
  2. Software Setup

    # Create project directory
    mkdir LED_Ring_Control
    cd LED_Ring_Control
    
    # Create main sketch file
    touch LED_Ring_Control.ino
  3. Library Installation

    • Open Arduino IDE
    • Go to Tools > Manage Libraries
    • Search for "Adafruit NeoPixel"
    • Click Install

⚙️ Configuration Options

Key parameters you can modify:

const uint8_t kLedPin = 6;        // Change pin number
const uint8_t kBrightness = 50;   // Adjust brightness (0-255)
const uint32_t kPatternDuration = 10000;  // Pattern duration in ms

📝 License

MIT License - Use as is, no liability to the Author and Partners

☕ Support

If you find this code useful, please consider supporting us!

Buy Me A Coffee QR Code

Buy Me A Coffee

🤝 Contributing

We welcome contributions! Areas for improvement:

  • New pattern designs
  • Performance optimizations
  • Additional configuration options
  • Documentation improvements

🔧 Troubleshooting

Common issues and solutions:

  1. LEDs not lighting up

    • Check power supply voltage
    • Verify data pin connection
    • Ensure correct PIN number in code
  2. Colors not displaying correctly

    • Check power supply current capacity
    • Verify LED ring model compatibility
    • Check for correct color order (RGB vs GRB)

Made with ❤️ by HeySalad

About

Simple Example to control LED Ring lights wit Seeeduino Xiao ESP32C3

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages