LED CPU usage with ledstats

Originally posted sometime around 2009

This page will show you how to construct your own electronic CPU monitor out of LEDs. To complete this project, you will need eight LEDs – 7 to show CPU load, and one status LED. For added effect, I used different coloured LEDs to show different load levels (two green, two yellow, two orange and one red). You will also need seven 1k resistors (1/4 watt should do). Overall, the components for this circuit (excluding the parallel cable, which I already had spare) cost me less then AU$10.

Before starting, be sure of the following:

  • You are running Linux
  • You have a free printer port on the back of your computer
  • You have a printer cable you can pull apart (see image below for correct type)
  • You have ‘ledstats’ installed and running
  • You can solder with reasonable skill, and are able to find common circuit faults such as bridges, short circuits and bad connections
  • You know to have the circuit disconnected from your PC while working on it (otherwise you might fry your PC)
  • A board on which you can assemble your circuit
DB25 male to Centronics.

This is the type of cable we need to pull apart.

Not all hope is lost for Windows users, it is still possible to use this circuit, just you will have to code the software part of the project. To help get you started, the parallel port pins seem to be activated by sending a bitmask to the port. Here are the masks I have found for the pins

  • LED0 – 1
  • LED1 – 2
  • LED2 – 4
  • LED3 – 8
  • LED4 – 16
  • LED5 – 32
  • LED6 – 64
  • LED7 – 128

To code such a program, you will need a DLL called input32.dll, this solves some privilege problems encountered on NT based releases which denied programs the use of certain functions required to interface with things connected to the parallel port. If coding such a program in TCL, you will find the lpttcl library quite useful.

Before we start pulling things apart, here is the circuit diagram we are going to use:

Circuit diagram
Circuit diagram

Assuming you have followed the instructions above, you should now be ready to pull apart the parallel cable. Start by removing the cover from the CENTRONICS (36 pin, plugs into printer) end of the cable. You should now be able to see all of the individual wires going into the back of the plug.

Centronics pinout
Centronics plug (pin side)

The picture above shows a view of the CENTRONICS plug from the pin side, NOT the wire side!
Using the pin numbers shown above, cut and label the wires according to the table below:

Pin numberLabel
2D0
3D1
4D2
5D3
6D4
7D5
8D6
9D7

Also choose a wire between pin 19 and 30 and label it ‘GROUND’.

You can now start constructing your circuit from the circuit diagram given earlier in the page. Remember to consider how you want to mount your meter when arranging componets in the circuit if you choose to mount it in some sort of enclosure or on some sort of panel. Remember (when using ledstats) that LED0 to LED6 (in that order) will show CPU load from lowest load to highest while LED7 is simply a blinking status light to show that ledstats is running.

I don’t have a picture of my finished unit here, because it is pretty much a mess of duct-tape and hot glue – not really something to show off. If you take more care than I did, you should be able to make something that looks nice.

Leave a Reply

Your email address will not be published. Required fields are marked *