In my last post I showed the new case for my MySQL server. The original case had two 10-segment LED bar graph displays that showed CPU and disk utilization. Now I have added a similar display onto the new case.
I chose to only display CPU usage but after I do some testing, I may change it to show disk I/O instead. This is a simple change to the configuration file of the utilization app. One issue with showing CPU is that the Pi 2 has four CPUs and typically only one will be maxed out. In the image above two of the CPUs are maxed out so the utilization shows 50 percent. The most I normally see is 25 percent since I seldom have more that one client querying the database.
The hardware used is very straightforward. I used a MCP23017 GPIO extender with ten of its pins wired directly to the LEDs. This chip uses an I2C bus connection so it only requires four pins on the Pi - power, ground, SDA, and SCL.
A couple of notes on the build:
1 - a resistor network would have been much neater than 10 separate resistors. I didn't have one handy but I do have a huge amount of single resistors.
2 - don't use ribbon cable. Just don't. It looks nice but it is normally used with press on connectors and is not intended for soldering. As soon as you touch the soldering iron to the wire an inch of the insulation melts away. Even with my super nice soldering iron turned to the minimum setting it was a pain to use. I won't make that mistake again.
If you want to use my code for the utilization display, I will be putting it on github. Check the comments for the address.
I chose to only display CPU usage but after I do some testing, I may change it to show disk I/O instead. This is a simple change to the configuration file of the utilization app. One issue with showing CPU is that the Pi 2 has four CPUs and typically only one will be maxed out. In the image above two of the CPUs are maxed out so the utilization shows 50 percent. The most I normally see is 25 percent since I seldom have more that one client querying the database.
The hardware used is very straightforward. I used a MCP23017 GPIO extender with ten of its pins wired directly to the LEDs. This chip uses an I2C bus connection so it only requires four pins on the Pi - power, ground, SDA, and SCL.
A couple of notes on the build:
1 - a resistor network would have been much neater than 10 separate resistors. I didn't have one handy but I do have a huge amount of single resistors.
2 - don't use ribbon cable. Just don't. It looks nice but it is normally used with press on connectors and is not intended for soldering. As soon as you touch the soldering iron to the wire an inch of the insulation melts away. Even with my super nice soldering iron turned to the minimum setting it was a pain to use. I won't make that mistake again.
If you want to use my code for the utilization display, I will be putting it on github. Check the comments for the address.