Basic gesture of swipe to control movements of a robot can be quite interesting, and may add intuitive interactive dimension to electronic projects.
I have published in this blog several tutorials on 8051-based robot controlled with bluetooth-enabled cell phone. Also most recently I have published a tutorial for Android phone using button images on device’s touchscreen.
Android being open-source, attracts a large following, and hence there are many different ready-made solutions. With a little bit of coding, and imagination, one can design different projects using solutions that are already available, or modifying or improvising on them.
App Inventor Code
To be able to control the robot you will need to download the source code file Bluemote2_0.zip kept at Bitbucket, an unlimited free private repositories’ site. If you already have an App Inventor folder, you can download the source code by scanning the following QR barcode:
All you need is your Android’s camera and a barcode scanning application. You may use Barcode Scanner app from ZXing Team. It’s available as a free download from the Android Market and works with all versions of Android.
If you are absolute beginner with App Inventor, the excellent resources and tutorials found at MIT’s App Inventor site are very good and easy to follow.
The control program
The Android application controls Robo-51 from Inex, with the following bluetooth send commands:
Key letter “d” results in forward movement of the robot, “a” in backward, “c” in turning leftward, “b” in turning rightward and “s” in stopping. The following icon (inside the red circle) shows when the apk has been installed (after compiling in App Inventor, and downloading into your Android phone):
Before running the application, you will need to pair the serial device on Robo-51 with your Android’s bluetooth. Next, when you run the app you will need to tell it which paired device will it talk to:
Press the Select Device button to select the paired bluetooth device you have already paired with your Android phone:
On clicking the device our first screen will come up with MAC address of the bluetooth device:
On clicking Connect, you will hear if everything is OK “I’m robo-51… I’m at your command!”. Connect button will change to Disconnect
You can control the robot with gestures of swipe with the finger to the left, or to the right, or forward (up finer swipe gesture) and backward (with down finger swipe gesture) , and you will hear in your Android phone voice of corresponding “forward”, “backward”, “turning left” etc. and the robot will move accordingly leftward, rightward, forward and backward. The Reset/Stop button will stop the robot.
After you have played with the control of the robot, you can disconnect by pressing Disconnect button on top right of Android screen. Clicking the menu button of your phone you can close the app.
This project adds a new feature into existing Robo-51 projects. The main objective of this actual project was to achieve, with little work, similar results to those obtained with Java-based Nokia N97 and Blackberry Bold 9700. I can now tick as successful this project on basic gestures of swipe for Android.