I got bitten by a project bug about a year ago. I bought a swag of Raspberry Pi 5 units with the aim to make a cluster out of them, and along the way learned a few things…

I chose Gentoo Linux as the OS (because of course I did) and successfully built six of them into a computing collective, housed in a tower case from Core Electronics. To say they are a cluster is a slight exaggeration, since the only actual clustering they do is the use of distcc to reduce the time to compile packages.

The first node is the “controller”, and hosts NFS shares for the others. Compile jobs are initiated from this node and farmed out via distcc to the others. The build on this first node creates a binary package in one of the NFS shares; this package can then be easily installed (or in Gentoo-speak, “merged”) onto the other nodes. I wrote a very simple pair of Ansible playbooks to perform these two steps, both for single packages and for an entire system update.

The first thing I learned with this project is that, sometimes, the cheap Internet shopping site that is the butt of everyone’s jokes has some decent items. I made myself a power supply for my Pi tower using a repurposed USB hub and some DC-DC stepdown “bucks” from the site-that-will-remain-nameless, and they’ve worked exactly as designed and surpassed expectations.

Another aspect of my project bug affliction was the purchase of a number of small displays (think OLED and LCD) that interface using I2C (or IIC, or I2C). I2C is one of the many interface options offered on Raspberry Pi hardware, so I was keen to start connecting the devices together and experiment. The small OLED display was quite easy to get working, thanks to some prior art found on the Internet. The LCD (the 20×4 character dot matrix kind) promised to be a bit more difficult since the one I bought initially did not have a built-in I2C interface (I’ve since bought some that do have an I2C adapter pre-installed, along with a standalone I2C adapter to make use of that first LCD I bought).

While I was deciding what to do about interfacing that LCD, the MicroSD card on the “controller” Pi started suffering some read and write errors. Unfortunately this coincided with an escalation in my work travel, so I had to shelve the Raspberry Pis for a while.

The Pi tower, with my homemade power supply and a network switch. One of the OLED displays is attached to the controller node, with a static message.

I got back into them recently, and the first task was rescuing the controller node’s filesystem. ddrescue was my friend here, copying the dodgy card to a new one, although the damage was so severe that many of the files on the new card were unusable — files were the correct size, but viewing what should have been a text file (for example) showed corrupted text. I copied files from one of the other Pi’s known-good filesystems, but since this was the controller there were many files that were not present on the other Pi so I had to re-emerge a lot of packages to get things back in shape.

Which brings me to the next thing I learned: sometimes, the bargain on the Internet isn’t what it’s cracked up to be. These MicroSD cards were supposed to be name-brand, but out of the eight I’d bought I had one or two DOA. Of the six that made it into service in my Pis, two ended up failing after only limited use. I am starting to research netbooting the Pis to remove the dependence on MicroSD completely.

So, I got the tower running again. Next I wanted to experiment with more of the displays. I2C is a bus; several devices can be attached to the bus and addressed separately. My initial desire was to connect all the Pis to the same I2C bus, have all my small displays attached to that bus, and then have various Pis in the cluster writing to one or more of the common displays. One problem with this is that the displays I bought have a fixed address setting and can’t be easily changed — one of the OLEDs has a surface-mount resistor that can be resoldered into a different location to change the address, but my soldering skills were barely up to the task of assembling the Pi tower PSU! I am not under any illusion that microsoldering surface-mount discrete electronic components would be something I can achieve.

My new plan is to take advantage of the fact that each Pi has its own I2C interfaces (along with SPI and others). Where the display types facilitate it I will have multiple displays attached to a bus (for example the OLED and the 20×4 LCDs by default are address 0x3C and 0x27 respectively), but use a different bus (possibly on a different Pi) when needed.

In the next instalment I will talk in a bit more detail about the programs that talk to the displays!

Leave a comment