Search This Blog

Sunday, March 13, 2011

Controlling Amiro (the name I have baptized the car) from an Android phone (HTC Desire)

While the Java PC application is useful for testing and controlling the robotic car while sitting in a chair, for on the field fun a more practical solution had to adopted. So using a popular platform that Android is, I decided to port the (Java Swing) application I already had, to run on any Android phone with a accelerometers and a Wifi connection. As the car behaves like an access point, all it is necessary is to associate the phone to it, and run the application.

Just about as fun as it is to drive it, coding the client in Android was quick an fun experience.
The interface had to contain just the essential elements. While the target hardware has abundant resolution (480x800), like in any mobile platform, screen real estate is always a concern. As such I had to economize on the components to be displayed. The result was a relatively simple UI:

It shows the data from the different active sensors (speed, 3 obstacle range values, temperature and battery status). One slider controls the throttle (the vertical one), and another slider controls the intensity of the LED headlights (also enabling the switching between white and UV LEDs).

The video below shows the car in action, this time controlled by the Android phone:


digfish said...

Well done Luis !
I felt very curious about your experiment and I have some doubts about your funny work:
* why you chose WiFi over Bluetooth ? (it was because, perhaps you already posessed the WiFi devices, all you have done was only port your already existent software from the swing application to Android!) ! Anyway, doesn't Bluetooth offered and cheaper and low comsumption implementation over the WiFi one !? I say this because when I turn on the WiFi connection on my phone the battery levels drops very highly.
* where you buy your material? Can you point me some directions ? You shop online or do you prefer to go in person to the physical shops !?

Any way, I like to see the you invest in your hobbies working ! :)


lteixeira said...

Hello Samuel,

"why you chose WiFi over Bluetooth ?" - correct, in the first place wifi was the more readily available technology to use (using bluetooth would add the extra cost and effort of selecting bluetooth hardware for the car, and writing extra software and firmware); and secondly wifi provides better response times and throughput, important for this type of application.

Regarding consumption for sure bluetooth would be a better option. This is equally relevant for both the client (the handset) and the server (the car), as both are battery powered.
The device performing the main processing in the robot is based on wifi router, which has a reasonable amount of resources (cpu, memory). Would this device also feature a bluetooth interface, and I would have chosen this option. It is in fact a bit power hungry - it consumes nearly 1 Amp at 5 Volts. For a decent autonomy, a dedicated 3000 mAh battery is added to the vehicle.

"where you buy your material?" - I have bought materials from several suppliers, most of which online. These include, sparkfun, among others. I have also bought many electronic components (IC's, resistors, capacitors, veroboards, etc) from a local store (radipeças) for the custom modules.

"You shop online or do you prefer to go in person to the physical shops !?" - I would prefer to go to the physical shops, but most of the time it is virtually impossible, as shops with the necessary parts in Portugal are either too distant or do not exist!

Developer said...

Very well done !

I would suggest to increase the ratio between the tilt angle versus stearing angle.
Currently its a little bit cumbersome, to tilt the phone that much to turn so little, with the unwanted effect of stopping to see the screen.