Introduction: Raspberry Pi Zero Cluster Case
So, you were lucky enough to get your hands on 8 Raspberry Pi Zeros. What to do? Well, you could make 8 robots. Or, for a little more than the cost of a single 4-core 1gb Raspi Model 2B, you could make an 8-core 4gb Supercomputer! We'll be recreating the first picture, only on a smaller scale, in the second picture!
You don't need to be a computer scientist to be able to learn today's technology, but will will be, if you stay curious enough.
Caveat: This is a work in progress, so expect changes as I get further along. You can also follow along on Thingiverse at http://www.thingiverse.com/thing:1350845
and Hackaday at https://hackaday.io/project/9576-8-leaf-pi-zero-b...
My Hackaday entry is more of a log than anything else, if you would like to see some of my rants.
And please don't forget to add a vote for my entry in the Raspberry Pi or Digital Life 101 Contest!
Step 1: Decide on a Form Factor
There are many types of cluster designs, from a impromptu series of connections to some really beautiful geometric shapes. I've always been partial to the last image, only much MUCH smaller.
Step 2: Design Around the Components
This is how I wanted to end up. So, I took measurements of my Zero, laid out what I thought would be the least complex with regard to hardware and wound up with many iterations till I came up with the pictures you see now.
I used Google Sketchup for the whole design process.
Step 3: Build the Case Around the Components
Once I had a design I liked for the CPUs, I then moved on to building a case. I stuck with the slidey-railey thingy, and once again, Sketchup to the rescue...
By the way, I designed the back to allow for development of a combination backplane/Power-connecting unit.
Step 4: Build Your Prototype
I'm lucky enough to have gotten a 3D Printer for Christmas. At the same time, I had heard that a new $5 computer was out from RaspberryPi.org. having always been fascinated with clustering, I KNEW there was no way my wife could argue against finally building a cluster. 5 bones a node, plus networking!
Step 5: Revel in the Glory of Clustering
Hook up power and networking and you are on your way to uber-geek status!
Step 6: Build Your OSes
Here, you build a single node and then make copies to put into each node.
On another computer use the usual method from RaspberryPi.org to acquire an image like Jessie or Jessie Lite and move the image to a lower sized SD card.
Once it's on the card and you've run through raspi-config, allowing SSH and allocating 16mb to the GPU, expand the image to the whole card. NOTE: If the head CPU is to have a larger card, just expand the filesystem again as a last step in this whole process: for instance, I specifically purchased 4 SD cards at 16gb and a single 32gb card. the 32 gb is for the Head.
using an existing Pi (I have an older Model B with the same CPU, not like the 2B), download all the latest software updates and then do the following:
apt-get install mpich2
This is the clustering software.
Step 7: Setup Networking
next setup your networking (this will vary depending on the network interface) for static IPs
Make sure /etc/hosts has the machine name and IP of every node.
Make sure the Pi you use for the Head is serving a unique subnet to the nodes in order to keep outsiders from easily seeing the nodes. If you have a fast network, it's okay to use it, just know how to distinguish between nodes.
Step 8: Create a User
Create a user that will be the Cluster user.
Step 9: Setup Secure Communications
Setup the latest SSH.
generate the necessary keys.
Step 10: Copy the Settings
Once you have everything set generically, shutdown the CPU you built with, take the SD card out and copy the image of it. I used Linux:
dd if=/dev/sdd of=/[base location]/[image name].iso
When pushing the image to another card, just swap the if and of values and add a block setting:
dd if=/[base location]/[image name].iso of=/dev/sdd bs=4096
Step 11: Make Node by Node Changes
Once you have a node ready, hook up the network and power and let it go!
Now, if you did all your nodes at once, there could be many packet collisions, because we haven't made the nuanced changes yet.
you have to change the IP and hostname, and then generate the ssh-keys
Step 12: Time to Geek Out!
At this point you should be able to reboot all the systems and they should report their own information. use the code in the picture to test. This should report for each node plus the head.

Participated in the
Digital Life 101 Challenge

Participated in the
Raspberry Pi Contest 2016
17 Comments
7 years ago
Wish I could get hold of even one zero, never mind enough to cluster lol. Actually, I dont want to cluster zeros, but I do want the case to have a handful doing diffrent jobs :)
Reply 7 years ago
Yeah, I know what you mean. though the problem becomes a no start one very quickly, getting parts to even use them. The computer is the cheapest part of the whole deal, LOL!
7 years ago
@ThomasK19...I believe it was 2012, Cambridge did one with 64 RPi's and Legos.
Reply 7 years ago
That sounds about right. Wish I could EASILY get my hands on a bunch of the originals. Cheaper than the new Model 2B. Anyway, I just saw on Hackaday that Arm is improving their chips. it's predicted we will see a significant improvement at this level in 18-24 months. so, expect the Zero THEN to be where the 2B is now.
7 years ago
i know about pc's but not to this extreme but what is the bonus of a cluster of pies over a quad core pc ?
Reply 7 years ago
Just the general cost for learning about clustering. Unless you can afford a couple thousand of these babies, I don't think your ROI for real world use will be very attractive.
There are other alternatives now for clustering that may be more attractive like the parallela. but even those can't hold a candle to FPGAs and the like, for something like bitcoin mining.
The only other benefit here is like what I said in the instructable: you can get a 4-core 1gb Pi 2B for about $35 l think. For another $5, you'll have 8 similar Pi Zeros with more cores and more memory (after tying them together). on specific tasks, the cluster will be more efficient. Its up to us as geeks to figure which situations to do that.
Reply 7 years ago
ah i see and yeah i figured they wouldent be a match power wise but cost wise for sure i was thinking the zero due to its very low power draw even with a wireless adatopr is less then other pi plus the bit coin miner so the zero and the bitcoin miner been a pool member the unit would run from solar and a battery bank that i allready have and make little use of so thoght ok i know it would be slow to do so but mine a few coins
Reply 7 years ago
Like was already said an FPGA would murder a pi cluster on both watts per mip and cost. Heck even a quad i5 would murder them on the same accounts.
Reply 7 years ago
i was talking a single pi zero with bit coin miner for low enargy
Reply 7 years ago
I know and not arguing that but in that case watt per mips would still make the pi unusable. It would literally take you 10 years to make 1 coin using a pi zero. FPGA are very good at set parallel tasks and even beat out top end intels using a fraction of the power. The pi's arm cpu has a very weak fpu and gpu so it's just not well suited to the task at all.
Reply 7 years ago
ah i dident mean using the pi gpu i mean having a usb asic miner the holle idea is to run of a small solar set up
Reply 7 years ago
In that use case for sure it makes all the sense. Low power usage / lots of io and can run a gp os.
Reply 7 years ago
gp os ?
Reply 7 years ago
general purpose
Reply 7 years ago
the pi just runs for code for the asic miner and keep the pool updated i was not thinking of solo mining
7 years ago
If you look at the VA Tech "Seemore" article on clustering (Where I got that pretty Pi sculpture bigger than people), they spent something like 9000 on 256 Pos. and not the 4 core ones. in this case you would definitely win out. for. the original cost of the 256 Pis, now you can get 1024!
7 years ago
i been thinking of using the zero to build a small bitcoin miner