CPU Usage LEDs

This project has now become the AVR USB RGB LED Controller project. The CPU Usage LEDs host program can be found in the examples directory.

Having seen a few circuits around the web that light up LEDs depending on CPU load I decided to make my own since they do look pretty cool 😀 I was originally going to have it communicate with the PC using a USB to TTL serial converter, but then I found out about the V-USB library which eliminated the need for a converter and supports ATtiny25/45/85 without the need for a crystal, great!
The ATtiny45 has just enough flash and IO pins for the project, with just the reset pin left (2x for power, 2x for USB, 3x for the RGB LEDs). I obtained a 12V 15 LED RGB strip from Ebay for £5.45 and used ZVN4306A MOSFETs to control them, common transistors like 2N4401 or 2N3904 could have been used instead since each colour only draws around 90mA, but the MOSFETs are more efficient with less heat dissipation and allowing a little bit more current to flow.
The circuit was first made on strip board without the 12V zener diodes shown in the schematic, but one of the MOSFETs soon stopped working and was stuck on, I presume the gate was fried by static, this prompted for the addition of zener diodes at the MOSFET gates for the PCB version.


On to the uC firmware, timers 0 and 1 are used for PWM control of the LEDs running at 500Hz, timer0 is also used for keeping an approximate track of milliseconds which is used for idle timeout, EEPROM 4 second save delay to help increase EEPROM life and LED colour transition time, with the idle timeout when it doesn’t receive any data for 5 seconds it will start to transition through blue, green, red and back until it starts getting USB data again.
As well as being able to change colour based on CPU usage it can also be set to a single static colour, perhaps it’s a little dark in your PC case, you can set it to white :D. The settings are saved to the EEPROM so next time the PC is booted it will go back to the colour it had previously been set to.

Alternative components
If you use normal transistors instead of MOSFETs, R1, R2 and R3 should be changed to around 1K – 2.2K and the zener diodes D3, D4 and D5 can be removed. D3, D4 and D5 can also be removed if you use MOSFETs with internal zener diodes or if you just don’t want/need ESD protection. C1 filter capacitor can be any value from 100nF to 1uF and preferably ceramic.

Host program
The host program is written in C and available for Windows and Linux, though the Linux program is a bit limited in features at the moment, only the main function of sending the current CPU load has been implemented.

Latest downloads can be found HERE.

cpuUsageLeds_20121126.zip (1.11 MB)
Host programs and source, uC firmware and source, EAGLE schematic and board layout files
Downloaded 709 times

cpuUsageLeds_20120913.zip (5.31 MB)
Host programs and source, uC firmware and source, EAGLE schematic and board layout files
Downloaded 460 times
MD5: 5933054B76054A5D5AE03F634C82F8FA

cpuUsageLeds_20120911.zip (5.32 MB)
Host programs and source, uC firmware and source, EAGLE schematic and board layout files
Downloaded 480 times
MD5: 0DFA642477C4D8139667F0C0B5504DC6


Skip to comment form

    • Sebastian on December 17, 2013 at 2:04 pm
    • Reply

    I have a question, can this Chip perform the Core (CPU) – termperature in Led-lighting?

    1. The hardware part only controls the LEDs. The software running on the PC tells it what colour the LEDs should be, so if you make a program that can get the CPU temperature then you can make colour change based on that.

        • Zohaib Amir on November 29, 2014 at 2:19 pm
        • Reply

        You could hae actually attached a thermistor to the CPU heatsink base to get the temprature, and then get the arduino to change color, but that wouldnt be fancy/accurate

        1. It doesn’t measure temperature, it measures CPU usage 😛

    • Eugene on June 14, 2014 at 3:29 pm
    • Reply

    Hi. First of all sorry for my english. I am from Ukraine.
    I Have some problem. After reboot Windows (try XPx32 WIN7 x64 WIN8 x64 and three different PC) system not recognize the device, “unknown device” in device manager. LEDs are blinking Red. But if i replug everything ok – work properly.
    In schematic I only changed R4,R5 to 68R and Mosfets to ULN2003.
    Try and resaults
    – Two diode in succession on a +5 rail – “unknown device” when plug
    – One Zener Diod 3.6V on a +5 rail – “unknown device” when plug
    How can i conquer this bug?

    To try in future
    – cange tiny45 to 85

    1. This project has been replaced with AVR USB RGB LED Controller, which is a more general purpose RGB LED controller (and uses an ATtiny85).
      But if you want to stick with this one, the LEDs flash red when the watchdog timer makes the microcontroller reset. If you set CFG_WDT_DEBUG to 0 in config.h of the firmware then it will just do a normal reset which might fix your problem.

  1. That can convert my laptop into a Super Computer look alike 😀
    I will enjoy the blinking LEDs especially when my computer is on heavy load and everything is loading slowly.

Leave a Reply

Your email address will not be published.

Are you human? *