Tuesday, 1 May 2012

Ayana12 - Hackathon idea: Android-Arduino-Bluetooth-Twitter-thing

The open source group in our college hosted a 24 hour hackathon last week called Ayana 2012. We'd heard that they were allowing hardware hacks too, we were totally excited about it and decided to check it out! 

After a couple of days of idea spit-balling at Akshay's place, we decided to go ahead with making an Android-controller thingy that lets us use a phone like a steering wheel or however you wanted to use it. After dabbling around with TCP, UDP, Telnet, SSH, and all those other wonderful wonderful networking protocols, we decided to go ahead with bluetooth. 
Now again, we just couldn't figure how to send sensor data directly from the phone to the computer we were using. Until Shyam found out that we could use a bluetooth module on the arduino to receive sensor data from the phone using The Amarino App on Android. The arduino, once receiving, can send some serial message back to the computer and that in turn generates a keyboard event.  

Now this app is amazing simply because of it's amazingly simple interface that easily connects to our bluetooth module and send sensor values serially to the computer! It's amazing! 

So the next part we thought was pretty simple.

  1. Read sensor values.
  2. Setup a threshold to send a serial message.
  3. Convert serial message into a keyboard event.
Not that simple. The code was still buggy even after working on it for several hours. We'll put it up once it's nice and all. But it's loosely based on This Instructable (which I think is really cool and shall definitely try out as soon as I get the time)

And after that part was kinda down, we needed to create keyboard events. Again, not so simple. But after Google searching for several hours looking at Java libraries and all that, we came across: 


Not many times does a google search lead you to jump around in a manic fashion cursing happily, but this did. And something about this software is kinda buggy too, or maybe we still don't know how to use it. But it's brilliant! 

All we had to do was change the hex values in the protocol.txt file to ASCII values and we were good to go! 


would make the cursor go up, up, up! It was awesome. 

But the reason I keep saying it was buggy because when we tried it on a game, we'd go left, and then we'd go right and then, yeah, we'd be stuck there. It just wouldn't go the other way. But it worked fine on notepad! DAMN. 

Pissing off, man. 

Anyway, I went and bought a bulb from somewhere and thought we could use it to demonstrate how we can turn on and off appliances using the phone. We got it working after a while, using the proximity sensor on the phone.
It would just toggle on and off though, we couldn't get it to stay on or off. 
We'll post the code once we fix that. 

We also wrote a little python code that let us turn on and off the bulb using twitter! :D The time delay was terrible though, I'll write another post about it soon, as I have a lot more to say about it. 

Overall, Ayana12 was a terrific experience. The atmosphere was humming with creativity and laptop fans. I managed to click a few pics too! 

Shreya, Surabhi, and Aditi. Trying to look cool. 

They had BEAN BAGS!!!!

Shyam hooking up the bluetooth module to the Arduino.

Anjana and her team, Vivek and Kiran. 

Vincent. Showing off. He single-handedly won the whole thing later anyway.  :P

Our station. 

This guy had wireless-ly interfaced a 3x3 array of LCD screens and  was playing Die Hard 4 on them.
It looked awesome!


No comments:

Post a Comment