Visualising Docker on Pi with PiGlow
Docker, flashing lights, real time Python code, what more could you want?
In my last post I described how I set up a 5-strong Raspberry Pi Docker swarm. It wasn’t long before I realised I wanted some ambient way to see how they were performing which a) didn’t involve staring at a screen and b) would wind up the cat.
Luckily my friend Ben was round and he’s quite into tangible stuff so after rummaging in a few dusty boxes for inspiration we found a PiGlow and wondered if that would do the trick.
We stuck the PiGlow on top of the swarm and sure enough, thanks to the great Python PiGlow library from the pirates over at Pimoroni, we managed to get the LEDs to map the CPU usage. As ever the code is on GitHub and here is a video of it in action.
When the CPU usage is below 5 %, there is no light. As soon as the CPU climbs above 5%, the LEDs start to light up. At first only the central white/blue LEDs flash but there are occasional bursts of orange and red (CPU > 80%) light up and these intensify towards the end of the video as we kicked off Apache Bench.
The cat loves it :-(
So far, so good. But what other tangible user interfaces could we build? Luckily Ben is a bit of a craft knife guru…