Building a Raspberry Pi Cluster – Part 2

The Grand Finale

In a previous post on Building a Raspberry Pi Cluster, I wrote about how we built a cluster  using several Raspberry Pis. This cluster was used for hosting the WSO2Con App. In this post we will take a look at the finishing touches & some interesting information from WSO2Con 2013.

The project was unveiled at WSO2Con 2013, London & was an instant hit. The team received many kudos from participants.Building a Raspberry Pi Cluster - Part 2

Power Supply

Like I mentioned in my previous post, we had to build a custom power supply that can cater to the voltage & current requirements of the Raspberry Pi cluster. Some readers also requested for the schematic diagram of this power supply. This power supply is built around the LM338 voltage regulator. Each power supply is capable of powering up to 16 Raspberry Pis in the cluster. To be on the safe side, we used one power supply per row in the rack, to avoid the power supply being the single point of failure. Each row in the rack consisted of 8 Pis.

USB Power Board

Shown below is the USB power distribution board which could power up to 8 Raspberry Pis, or a single row in the rack. Each USB power line contains an on/off (single pole – single throw) switch, connected in parallel with an indicator LED which was connected in series with a current limiting resistor.

The +5V & GND lines in the board were connected to the power supply.

Raspberry Pi Cluster Rack – the finished product

The rack had to be very lightweight, and being able to easily disassemble it was a prerequisites since we had to carry the setup from Colombo, Sri Lanka to London, UK. So we built it with Aluminium bars, and light plastic sheets. The setup could easily be assembled using nuts & bolts.

The rows containing the Pis were slanted at about 15 degrees for aesthetic reasons.

The final product, a 24 Raspberry Pi cluster, is shown below.
An Ammeter was added in series to the power line, and a Voltmeter was added in parallel. Each row in the rack consisted of such an Ammeter & Voltmeter pair. This allowed us to individually monitor the rows in the rack to get an idea of the power consumption, and get an indication if something was wrong.
As can be seen in the above diagram, at full operation, a row (8 Raspberry Pis) was consuming around 15W of power (P = V x I). That boils down to less than 2 Watts of power per Pi! We also observed that even though the Raspberry Pi model B spec says it draws a minimum current of 700mA, when no peripherals are attached, in practice, a network connected Pi processing a load draws between 350-400 mA of current.
In terms of power consumed per transaction, the Raspberry Pi is one of the most efficient out their.

Raspberry Pi Control Center

A screenshot from the completed Raspberry Pi Control Center is shown below. This simple yet powerful UI theme was developed by Chanaka, one of the UI technology experts at WSO2. We were able to track the load average, free memory & disk usage of each Pi in the cluster.Building a Raspberry Pi Cluster - Part 2 Schematic

Tracking Raspberry Pis using GPIO functionality

Locating a Raspberry Pi on the Control Center also became a requirement. This comes in handy when you need to power off a Pi or replace a defective Pi. We built a small circuit which consisted of an LED, normally off switch, and 3 resistors.
The diagram below show how a Raspberry Pi is highlighted in the Control Center when the switch is pressed.
  • S1 – normally off switch
  • R1 – 10K
  • R2 – 100R
  • R3 – 1K

As shown in the above diagram, we built a small board and at the bottom of the board, we have a 16 pin IC base, which is used to connect the board to the GPIO pins.

A Python script (switch.py), which continuously runs, observes the status of the switch, and makes an HTTP call to the Control Center if the switch was pressed. The Control Center then sets the status of the Pi to selected, and highlights the Pi. There is another process (blink.py) which periodically does an HTTP call to the Control Center to check if it LED should blink, and blinks it a few times if so. Blinking the LED can be done by turning it on in the Control Center.
The following software is needed in order to run GPIO Python scripts.
  • Python
  • Python Dev (apt-get install python-dev)
  • RPi.GPIO library

 

For more detail: Building a Raspberry Pi Cluster – Part 2

Scroll to Top
Read previous post:
IoT 101 Project: Stream Temperature from your Raspberry Pi

“Hello World!” – This is likely the output of the first program you ever wrote when learning how to code....

Close