AVR USB RGB LED Controller

While working on an update for my CPU Usage LEDs project I thought why not just make it into a universal RGB LED controller? The CPU Usage LEDs controller took a value between 0 and 255, worked out what colour it should be and then fade to that colour. This was very limiting; changing what colours it used and how it fades required a firmware update. With this universal RGB LED controller the host software does all the work and the controller is simply told what brightness the red, green and blue LEDs should be.

To make it as easy as possible to interface with the controller I created a library which deals with all the LibUSB stuff. Only 10 lines of code is needed to get something basic running.

#include <rgbledctrl.h>
int main()
	s_rgbled_device* rgbLed = rgbledctrl_open();
	rgbledctrl_setR(rgbLed, 200); // Set red value to 200
	return 0;

The library also has support for reading and writing to the EEPROM of the controller. Class wrappers for C++ and C# .NET are also provided.

Download from GitHub


Skip to comment form

    • Euge on January 12, 2015 at 7:50 pm
    • Reply

    Hi. sorry for my English
    can anyone compile a firmware for attiny45. Iam traid but Atmel studio say
    Error builtin_avr_delay_cycles expects an integer constant. f:\program files (x86)\atmel\avr studio 5.1\extensions\atmel\avrgcc\\avrtoolchain\bin\../lib/gcc/avr/4.5.1/../../../../avr/include/util/delay.h 152 28 usbLedController

    error at row __builtin_avr_delay_cycles(__ticks_dc);

    Try attiny85 – works perfect

    Thank you for your help.

    1. It may be because you’re using an old version of Atmel Studio. v6.2 compiles successfully for both ATtiny85 and 45. You could also try removing the delay() calls in usbLedController.c.

    • Volodymyr on January 19, 2016 at 3:56 pm
    • Reply

    CPU Usage LEDs sprint-layout data ???? email

    1. Sorry, I don’t have Sprint-Layout.

  1. I flashed my Attiny85, but when connected it to PC I got “Unknown device” descriptor failure
    I tried old versions also. What I doing wrong?

    1. Have you set the correct fuse values on the ATtiny85?

  2. I cant compile cpuUsageLeds project without makefile
    make: *** No rule to make target `all’. Stop.

    Also Imposible to start this exe file without window (hidden to the tray only)

    1. Hey Pavel, you need to use Atmel Studio to compile the project. The program can be started hidden, but you’ll need to edit the source and compile it with the appropriate changes.

Leave a Reply

Your email address will not be published.

Are you human? *