Switch branches/tags
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.


light_apa102 v1.1

Light weight library to control APA102 and SK9822 based LEDS and LED Strings on 8-Bit AVR microcontrollers. This is a companion library to the light_weight_ws2812 library and uses an identical interface.

To convert your code from the light_ws2812 lib to the light_apa102 lib simply do a search and replace of "ws2812" with "apa102".


This is a small Ansi-C library to control APA102 based RGB LEDs and strings. This library uses a software based SPI implementation for maximum compatibility. If you want maximum performance, you should build your own hardware-SPI based version.

  • Compatible to all AVR MCUs since it does not rely on special periphery.
  • Arbitrary CPU clock

Please see the following article for more background on controlling the APA102: Understanding the APA102

See here for a write-up on the changes to improve compatibility to the SK9822: SK9822

Usage C - Interface

  • Add "light_apa102.c", "light_apa102.h" and "apa102_config.h" to your project.
  • Update "apa102_config.h" according to your I/O pin.
  • Call "apa102_setleds" with a pointer to the LED array and the number LEDs.

Examples are provided in the Examples folder. You can build them with the supplied makefile.

Release History

  • v1.0b 2014/11/30
    • Initial release
  • v1.1 2016/11/27
    • Added reset frame to fix SK9822 update issue. Changed reset frame to 0x000000.
    • Added apa102_setleds_brightness function which allows to set global brightness as well.

Tested Combinations AVR

Device 4 MHz 8 MHz 9.6 MHz 12 MHz 16 MHz 20 Mhz
ATtiny 85 (Standard Core ) X

Please find updates on https://github.com/cpldcpu/light_ws2812

bug reports etc: cpldcpu@gmail.com