LED

AVR USB RGB LED Controller Project

This project uses an ATtiny45 microcontroller to control an RGB LED strip based on CPU usage. It’s a cool-looking project that uses the V-USB library to communicate with the PC without needing a USB-to-TTL serial converter.

AVR USB RGB LED Controller 

Hardware

The project uses an ATtiny45 microcontroller and ZVN4306A MOSFETs to control the RGB LED strip, with each color consuming only about 90mA of current. The MOSFETs are more efficient and produce less heat, allowing for more current to flow.

Firmware

The firmware uses Timer 0 and Timer 1 to implement PWM control of the LED strip at 500Hz, and Timer 0 also keeps track of milliseconds for idle timeout. The EEPROM saves the delay setting every 4 seconds, which helps extend the lifespan of the EEPROM and the LED color transition time. When the idle timeout is reached, the LED strip starts cycling through blue, green, and red colors until it receives USB data again.

Host Program

The host program is written in C and is compatible with Windows and Linux. It can set the LED color based on CPU usage or set a single static color. The setting is saved to the EEPROM, so it will restore to the previous setting when the PC is restarted.

Alternative

LED Flashing Circuits Design

Apart from using LEDs as power indicators or Joule thieves, I haven’t really used them much, so maybe it’s time to create something really fancy! 😊

I searched for some LED flashing circuits that can control at least 4 LEDs with minimal components, and finally found two circuits that I liked, both using Schmitt trigger oscillators, one that makes LEDs fade in and out, and another that feeds BCD to a 7-segment driver IC, making 7 LEDs flash randomly. 

Fader [HERE]
Random flasher [HERE]

Push-Pull Circuit

The push-pull circuit uses one Schmitt trigger for each LED, and since Schmitt trigger ICs usually have 6 triggers, it’s no problem to make 6 LEDs fade in and out at different rates. The downside of this circuit is that it will never fully turn on the transistor/LED, with a maximum current of only 4mA through the LED.

Since I want the LEDs to fade in and out at different rates, I couldn’t use the same resistor/capacitor values for all oscillators. Here is the table of resistor values used for each oscillator, with all capacitors having the same value (2.2uF / 22uF).

LeadR1R2R3
1100k4.7k47k
215k+27k2.2k15k
327k+47k4.7k47k
447k+100k4.7k47k