arduino/raspberry pi mandelbrot calculation cluster

Normally an Arduino project consists of only one Arduino and maybe some supporting electronics. I find Arduinos performing very well for what you pay for them so I thought: what if I create a beowulf-alike cluster of these? ("imagine a beowulf cluster of ..." was a meme on for a while).

The idea behind this project is to create a cluster of arduinos (I use pro minis running at 3,3V) that calculate the mandelbrot fractal, directed by a raspberry pi. The arduinos here function like a cluster of math co-processors for the raspberry pi. The raspberry pi displays the result (using SDL).

The Arduinos are connected to the Raspberry Pi via an i2c bus. They get their power via the 5V pin of the RPI (as that pin can deliver enough current for 4 arduinos). Of course for 3,3V Arduinos you then need to feed the 5V to the "RAW" pin of the Arduino or else it will fry the electronics.

I use pin 3, 4 and 5 to select an i2c address: for example node 0 has all three pins low, node 1 has pin 3 high and 4 and 5 low, etc. I could've done that in software but with these external address selectors I can easily swap broken devices (none broke though) and also have one generic software image for them.

Pin 8 is used to light a LED when a node is calculating (blinkenlights!).

I used 3,3V pro mini because I can directly connect those to the i2c pins of the raspberry pi without the need for level shifters. No pull-up resistors are required: the raspberry pi has them already.

This file contains the arduino sketch-file as well as the Linux source code. It requires the SDL software to compile and link.
Do not forget the load the i2c-bcm2708 and i2c-dev modules to get i2c working on the raspberry pi. Model A raspberry pies need to have the file server.cpp adjusted: replace "/dev/i2c-1" with, I think, "/dev/i2c-0".

Here's a video with a demonstration:

The video was recorded at RevSpace, a Dutch hackerspace in The Hague.


arduino menu

The Lotter allows you to participate in lotteries from all over the world!