Darth Vader build monitor
At work we use Continuous Integration to build and test our code as we check it in. It helps catc problems early and ensures we keep code standards up. We were using CruiseControl.NET but have now moved to TeamCity. Anyway, this is no use unless people take notice of broken builds and this was starting to slip. I decided that something fairly visible (but not too annoying) was needed. After spotting a Lego Dath Vader toy torch it seemed like a good solution.
The standard toy has a button on his chest that is used to switch on some while LEDs in his feet. There was also a red LED and a AAA battery in his lightsaber so it could be switched on. The plan was to add a servo to his arm so he could wave the lightsaber around and replace the red LED with a RGB one so that the colours could change. All of this under PC control of course.
Get out the Dremel
Remove the battery connectors
Rather than describe in detail exactly what was needed, maybe some photos of the progress will sum it up. First I had to get a servo in place operating his right arm. It required cutting away the battery compartment, filing the joint to make it a little easier to move and hot-gluing the servo in place.
Make a slot for the servo horn
Make room for the servo
The front just involved making a bit more room to glue the servo in. The a slot needed to be carefully added for the servo horn to drive the arm. The horn was later screwed to the servo. The connection between the servo horn and teh shoulder joint is just a push fit.
For the lightsaber, the battery, connectors, original PCB and LED had to be removed. The switch was glued in place as it wasn’t to be used but needed to fill the hole. As ther was no PCB to locate the new LED, it was glued into place.
Finished saber and hand
Running the 4 wires from the RGB LED involved carefully drilling a path through the side of the lightsaber, the hand, arm and shoulder joint. I had to be careful that the wires coming out of the shoulder didn’t limit the servo movement.
The next step was putting all this under PC control. I decided that the recently release MSP430F5529 Launchpad would make an ideal control system. It has built-in USB functionality and could easily handle a few PWM channels. All that was required was to connect ground, 5V and a PWM signal to the servo and 3 PWM signals to the channels of the LED. The photo also shows the clear acrylic base – cut using a 40W CO2 laser.
I intend to etch a small microcontroller board that will fit inside where the battery compartment was, but for the initial build uses the Launchpad externally, in a 3D printed enclosure.
The connection between the device and the PC is using a USB serial port. As far as what controls Darth Vader, I tried a number of options. Initial control was done from an ASP.NET MVC web page. Anyoen in teh office could control him with simple URLs like fredpc/Vader/Colour/Blue or fredpc/Vader/Position/0. The connection to TeamCity proved a little more difficult. I started work on a Java plug-in for TeamCity that woudl call these URLs, but it was a pain to get the plug-in installed and working in TeamCity. All the documentation I could find was out of date and incosistent – as is often the case with Java. I ended up going with a Windows service that polls TeamCity (using Rest APIs) every 10 minutes.
I you’d like to see it working, here are a couple of videos of it in action.