August 27, 2015

3D printed guys and Arduino boards at our office

Adding a hardware notification channel to your build server

Like most other software companies, we, at willhaben, use a build server to support our continuous integration development environment. A lot of developers check in their code in our git repository and sometimes the build is broken because of compilation errors or tests that do no longer pass. Build servers like QuickBuild or TeamCity have notification systems that are able to e.g. send information about a broken build to the developers via email or other channels.

As we love to play with technical stuff we have built a new channel for these notifications that show us the build status even if you don't have your mail client running or desktop notifications are not enabled. This channel looks like this:

As long as the build is working the guy is happy and shows a happy smiley face. As soon as the build is broken, the face becomes unhappy. See this video to view what happens if a build fails:

A lot of software developers stay away from "hardware development" for no reason - it's a lot of fun! Using components like an Arduino UNO, a DOT display and 5 cables you are ready to build your own build indicator.

This blog post should give you an idea of the simplicity of developing office gadgets. There are a lot of resources out there that cover Arduino development, 3D printing, etc. in-depth. We won't get into details.

What you need

Putting it all together it looks like this:

How does it work

Most build servers provide an API or access via RSS feed to the build status of the projects. In our case we use QuickBuild that provides a simple RSS feed as shown below:

<rss xmlns:dc="" version="2.0">
<title>builds of QB/messaging/develop</title>
This feed lists recent bulids of configuration QB/messaging/develop.
ID: 24837<br>Status: successful<br>Triggered By: whrescha (Rene Schakmann)<br>Duration: 10 minutes 8 seconds<br>Begin Date: 2015-08-27 09:29:16<br>
<pubDate>Thu, 27 Aug 2015 07:39:25 GMT</pubDate>
ID: 24834<br>Status: failed<br>Triggered By: whrescha (Rene Schakmann)<br>Duration: 2 minutes<br>Begin Date: 2015-08-27 09:27:11<br>
<pubDate>Thu, 27 Aug 2015 07:29:11 GMT</pubDate>

This RSS feed can be parsed on a our Arduino UNO. All we need to do is to connect the Arduino board to the network. For this reason we need the Ethernet shield. Using the Ethernet shield is as easy as socket programming in JAVA. There is a library available that does the heavy lifting for us.

A simple web request is just a couple of lines of code:

Creating Ethernet Client

EthernetClient client;

Internalize network card

Ethernet.begin({ 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED });

Connect to server

Ethernet.begin(mac, ip);

Make a HTTP request:

client.println("GET / HTTP/1.1");
client.println("Connection: close");

Receive data

if (client.available()) {
char c =;
// do something with the data

The full example can be found here.

Parsing the data depends on your build server. As soon as you know the status of the build the DOT display needs to display some indicator like a smiley. There are display drivers that can address dot displays over a serial interface like MAX7219. This way you only need 5 cables, otherwise you need a lot of them. Another advantage of display drivers is the simple API that is provided for Arduino.

A 8x8 DOT display is controlled just by turning single dots on and off. A picture that is displayed can be stored in an array like this:

byte off[8] = {

Zero means the dot is off, one turns the dot on. This matrix will display the smiley on the first picture of this article. Getting this picture to the display is just a couple of lines using the LedControl library:

Initialize the display - 4, 3, 2 are the pins the display is connected and 1 is the amount of displays

LedControl lc = LedControl(4, 3, 2, 1);

Printing the image above to the display row by row

lc.setRow(0, 7, off[0]);
lc.setRow(0, 6, off[1]);
lc.setRow(0, 5, off[2]);
lc.setRow(0, 4, off[3]);
lc.setRow(0, 3, off[4]);
lc.setRow(0, 2, off[5]);
lc.setRow(0, 1, off[6]);
lc.setRow(0, 0, off[7]);

That's all you need to know - getting data from the network and display something on a display. It's as easy as this. The code for the complete project can be found on our github repository:

More hardware hacking at willhaben can be found here.

1 comment: