Jenkins Build Status on Arduino
I gifted myself an Arduino Starter Kit from Simplelabs to kill some time during the weekends. Needless to say, I felt really proud of myself once I got the LED blink example working without breaking anything.
My next project was a simple Jenkins build monitor, very popular amongst the Arduino beginners out there who write code.
Here is my version of this hack. In addition to the usual ‘traffic light’, I also plonked on a 16x2 LCD to the circuit which displays the build number along with the status. Scroll down to the end of this post to see this in action.
Schema
I used Fritzing to draw this schema and I know it’s a little bit ugly.
Anyway, successful builds turn on the Green LED; Unstable builds, yellow; Failed builds, red and my favorite of all, builds in progress makes the LEDs turn into KITT from Knight Rider :P.
Code
The code is pretty simple. There is a Python script that uses the Jenkins REST API to get the latest build and its status for a given a job. This is translated into a crude command for the Arduino board to pick up using the Serial interface.
Python side of things
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
|
The ‘Sketch’
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
|
In Action
Here it is in action. As you can see, the LCD displays the Job, the last build number and its state. The wiring is a huge mess, but hey, it works! :)
Components used
- Arduino UNO R3
- 5 220-ohm resistors
- 3 LEDs; Green, Red and Yellow
- A bunch of wires
- HD44780 16x2 LCD
Next step, maybe build a bigger housing for the entire system.