My First Hardware Hack
This weekend I went to an absolutely amazing hackathon at Bloomberg’s offices in London. Organised by Major League Hacking, the event focused on learning something interesting and showing it off after 24 hours of hacking. This is exactly what the UK needs! I’ve moaned recently about not enough hackathons simply existing to allow developers to try out something new and focus on learning, not helping large companies solve their problems.
The venue was spacious for the 200+ people who attended and it was clearly organised well by MLH as there was plenty of sponsors, swag, WIFI bandwidth and most importantly - food!
The event also had a great mix of ages; from students as young as 13 attending their first hackathon and building some really great hacks.
I arrived at the event with my new Arduino Starter Kit which I recently bought, ready to take my first step into the hardware world. I’ve been wanting to try something completely new and after recently seeing Siddharth create our Arduino hack at the Tesco Hackathon, I wanted to give it a try myself.
My goal was pretty simple; I wanted to buy a cheap robot from Maplin, build it and then figure out how to invoke it using my Arduino board controlled by my laptop.
Little did I know the ‘simple’ robot I bought was actually a pretty serious kit which took most of Saturday to build, including running back to Maplin in the rain to pick up super glue as the wheels wouldn’t stick on!
Building My Robot
It was late afternoon by the time I finished building the main robot which was when the real work started! I had to figure out a way of somehow controlling it using my laptop.
So far my Arduino knowledge allowed me to simply upload sample code to make LEDs blink, I was confident that I could use the same code to kick off motors to move. It sounded simple at the time...
My original plan was to hack the IR controller and use that to control the robot wirelessly which didn’t work out thanks to the controller being too low powered to work at any usable range.
I spent a VERY long time trying to do this and managed to get my Arduino to talk to the controller at around 4am however the range simply wasn’t usable.
After taking a powernap I decided to give it another shot, I scrapped the idea of using the controller and mounted the Arduino onto the robot itself. This was quite entertaining; poking wires at the main circuit board to see what parts of the robot moved. I soon realised that the motors on the robot needed a lot more power to run off as they each had several gears and three wheels working off them.
This is where things suddenly started to work out... I managed to borrow a battery pack off Simon (who must be noted as super useful in giving me a hand with all of this) and used my Arduino Kit’s book to figure out that I could connect up a transistor to add additional power supplies. I linked each motor to a 9V battery and to my amazement it worked!
The programming-side wasn't too hard now; all I had to do was write an Arduino application in C to read serial data and move motors depending on what integer I sent it, I then had my laptop using good old .NET sending it data via serial.
Using .NET allowed me to build an API on Microsoft Azure which takes in requests and send them to my laptop. The commands were then sent to the Arduino which understood the commands and made the appropriate motors move.
The Morning of Stupid Ideas
During the night Laurence kept playing the annoying beginning to the song Turn Down for What which I decided to convert into a Chrome extension which would allow him to play it with one click instead of visiting YouTube every time. I used a simple YouTube to mp3 converter and cropped the audio to play just the main beginning of the song. It was hilariously stupid.
The idea now was to use Twilio to get the audience to vote on driving my robot into one of two bananas’ using the MakeyMakey kit. Once either banana was hit Laurence’s Chrome extension would open and play the stupid soundtrack. Alex built the amazing MakeyMakey and banana part using his lego kit and Eric returned after the night after building his Twilio voting system.
Building such a complex and fragile hack, we knew things wouln't work out perfectly so we made a quick vine showing a best-case-senario as a backup.
The hack was very far from perfect; for starters as I super-glued my wheels onto the robot it wouldn’t move in a predictable manor. As it moved it wobbled which gave it a lot of character and would hilariously charge into the bananas uncontrollably, this meant that our perfectly working (and impressively made) Twilio integration didn’t have much control over the robot.
These are what hackathons are all about though; showing off something awesome which we’ve all just learnt in a ‘sort of’ working manor. We showed off everything we made and as expected it fell apart as the crowed confusingly wondered why they were texting a robot to crash into a banana which shows Laurence’s face as it plays music in a Chrome extension. Perfect!
The most impressive part was how we all learnt something completly new; Eric had never used Twilio before and pretty much mastered it. Alex had never been to a hackathon before and managed to make a lego structure which dangled bananas which kicks off a circut. As for myself; I went out to try out my first ever hardware hack and although it really was a rollar-coaster ride, it worked out amazingly and I learnt a TON!