Accelerometer and gyrometer are costly. And they were
necessary for my master project (the one I mentioned in Last blog) . Spending
money to buy them and then a microcontroller for interacting with them would
have cost me heavily.
![]() | |
| Android <> PC interaction |
I knew most of android phones have these sensors in-built.
So instead of spending ( around 10k rs) I thought of studying android api , and
then building an app which would send sensor data to the computer.
Android was surprisingly easy to learn. Luckily, because we
had learned Java in 3rd semester. I started building small apps and
was able to fetch and display sensor data. But then came the difficult part
“making a connection to a remote computer”. There are many modes of
communication, but I preferred 2 of them Bluetooth and WLAN.
I didn’t have any android phone. I was trying out my apps on
Micromax Funbook p275 , a cheap but useful tablet. It didn’t have Bluetooth
module, so I had to go with wifi. It took me some time to learn Sockets because
I had no freaking idea how computer networks worked. And yeah Java doesn’t allow sockets to be
created on main thread, so I had to learn thread programming too.
I preferred Java on
remote server (your PC) because it has a common VM for linux, windows or OSX.
When I was browsing through Java library, I came across an
awesome class ‘Robot’. Its functionality is as cool as its name , It can
simulate mouse movement and key presses……..
I already knew ‘making connection with a remote computer’ ,
‘sending data’ and Robot class gave me
the idea of controlling my computer with my tablet. I implemented it ,
and here’s the output..
I continued working on this project for 2-3 months and added
features like automatic server detection (requires UDP broadcasting), Bluetooth
support and what not!



