GitHunt
FI

fikrielektro21/WS2812B_ColorFX

Real-time RGB, HSV, and HSL color control for WS2812B on STM32 Blue Pill --[this is my first time trying to convert rgb led colors to hsl and hsv]

WS2812B Color Space Converter for STM32 Blue Pill

Real-time RGB, HSV, and HSL color control for WS2812B LED strips โ€” running natively on STM32F103C8T6 (Blue Pill) with zero external libraries and integer-only math.

Perfect for embedded projects where floating-point is unavailable or inefficient.

๐Ÿ’ก Why HSL? HSV gives vibrant colors, while HSL produces soft pastels โ€” ideal for ambient lighting, mood indicators, and artistic displays.


โœจ Features

  • โœ… Full RGB โ†” HSV โ†” HSL conversion in pure C (no float or math.h)
  • โœ… Per-pixel or global color control in any color space
  • โœ… Hardware-accelerated via PWM + DMA (non-blocking, timing-perfect)
  • โœ… Built-in animated effects:
    • Rainbow (RGB/HSV/HSL)
    • Smooth breathe
    • Fire flicker
    • Theater chase
    • Pastel wave (HSL-only)
  • โœ… No dependency on FastLED, Adafruit NeoPixel, or Arduino
  • โœ… Ready for real-time applications (e.g., sensor-driven color feedback)

๐Ÿ› ๏ธ Hardware Requirements

Component Notes
STM32 Blue Pill STM32F103C8T6 (72 MHz Cortex-M3)
WS2812B LED Strip Any length (tested with 8โ€“60 LEDs)
Level Shifter (Optional) Recommended for >10 LEDs (3.3V โ†’ 5V)
Power Supply External 5V for LED strip (do not power from Blue Pill!)

๐Ÿ”Œ Pinout:

  • WS2812B DATA IN โ†’ PA6 (TIM3_CH1)
  • Shared GND between Blue Pill and LED strip

๐Ÿ’ป Software Requirements

  • IDE: STM32CubeIDE (v1.15+)
  • HAL: STM32CubeF1 (v1.8.6+)
  • Clock: 72 MHz (HSE + PLL)
  • Timer: TIM3 in PWM mode
  • DMA: Channel for TIM3_CH1

๐Ÿ“ฆ No external libraries โ€” everything is self-contained!


๐Ÿ“‚ Project Structure

Languages

C89.3%Linker Script10.7%

Contributors

MIT License
Created November 30, 2025
Updated January 9, 2026
fikrielektro21/WS2812B_ColorFX | GitHunt