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.
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 Components
If you use a regular transistor instead of a MOSFET, you can change R1, R2, and R3 to 1K-2.2K and remove diodes D3, D4, and D5. If you use a MOSFET with an internal Zener diode or don’t need ESD protection, you can also remove D3, D4, and D5. The C1 filter capacitor can be any value between 100nF and 1uF, and it’s best to use a ceramic one.
Downloads
Latest downloads can be found HERE.
OLD | cpuUsageLeds_20121126.zip (1.11 MB) Host programs and source, uC firmware and source, EAGLE schematic and board layout files MD5: BEAB5F4ECD29CBDD8F10C8ECFC908DB1 |
OLD | cpuUsageLeds_20120913.zip (5.31 MB) Host programs and source, uC firmware and source, EAGLE schematic and board layout files MD5: 5933054B76054A5D5AE03F634C82F8FA |
OLD | cpuUsageLeds_20120911.zip (5.32 MB) Host programs and source, uC firmware and source, EAGLE schematic and board layout files MD5: 0DFA642477C4D8139667F0C0B5504DC6 |