This weekend I traveled to Yale with friends for YHack, Yale’s huge hackathon. This hackathon was serious. The hackathon takes over a 3 story office building and teams spread out throughout the building. There were a lot of great companies there and some great hacks.
I worked with Kiana and Josh to make a Pebble smart watch the controller for both mouse input and also drive a robot around. It was a good balance of technically challenge yet feasible for us. It was a lot of fun. I worked primarily handling the sensor data and controlling the mouse based off the data we were sending in. It wasn’t pretty. Our initial code and prototype were extremely slow. We had 15 seconds of latency in our system at one point. But we kept reducing the time until updates were possible approximately once a second.
Here are some interesting problems I ran into while working on this:
Problem: Linux Bluetooth: I was trying to pair the Android phone with my laptop so that I could reliably send accelerometer and button data and commands over Bluetooth. Linux is tricky for setting up Bluetooth though I could set it up a couple times it wasn’t reliable are easily repeatable. Josh and I collectively wasted over 4 hours trying to get Bluetooth to computer to work and we never did. Solution: In true hackathon fashion we used a hack to make things easier and sent the Android data to a Bluetooth module on an Arduino Mega and then used the the second serial port of the Arduino to send the commands over USB to the laptop. This worked but isn’t ideal and probably added some major latency to the system.
Problem: Unreliable serial data. With how I originally wrote the code, updating the data loaded onto anything was easy. We only did it when we were trying to update the mouse position. One problem we ran into was that the message would randomly drop a select few characters without warning. This made for unreliable and error check full code. We could never figure out what caused the dropped characters. Solution: To get around this I threaded the process that checked whether there was new information with serial and every time there was a line I read it. It worked great and allowed for more real time updates of information.
I had many more problems but don’t have time to list them all.
At the end of the hackathon we had a rough working prototype with mouse movement, right clicks and left clicks. We also had the ability to move the robot but didn’t demo it. As the judging happened we got to show off to a lot of different people and people really seemed to dig the idea and appreciate it a little. As the announcement went out that the judging time was over and it was time to announce the winners we were freaking out. Pebble had never even visited us. The only API we really used and it we weren’t even in the running for an award. Halfway through the general awards Pebble stopped by to checkout our project and it was our smoothest demo yet. The Pebble engineer seemed to really enjoy our app and told us he hoped we kept developing it.
When the API awards were announced we were shocked to hear our name for the Best Use of the Pebble SDK award and we won a second award from Thinkgeek for Craziest Hack Award. It was awesome! We were super pumped and came home with a Pebble Steel per team member and a bag of swag to share. Awesome weekend and can’t wait for our next hackathon!
Our Project can be viewed here on Challenge Post