Introduction
Smartphones running BlackBerry 10 have many sensors that collect data about the phone’s external environment. Some are low-level, real-time sensors such as the accelerometer, and others are higher-level, event-driven sensors, like the holster sensor. The following sensors are present in Blackberry 10:
– Accelerometer
– Ambient Light
– Compass
– Gyroscope
– Holster
– Infrared Proximity
– Light
– Magnetometer
– Orientation
– Proximity
– Rotation
The accelerometer reports on changes to the acceleration of the phone along three axes. This sensor is particularly useful if your application is designed to handle motion input from a user. When the user moves the device, the accelerometer can sense the movement of the device in 3-D space along the x,y, and z axis. For example, in a racing game, the steering can be controlled by the user tilting the device from side to side.
Requirements
A 8051 robot “Robo-51” (could be a robot with any other micrcontroller) with serial bluetooth ZX-Bluetooth module, running a firmware for bluetooth control, and an account with App Inventor.
App Inventor Code
To be able to control the robot you will need to download the source code file AccelMote.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:
Downloading the Android apk
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. Once installed, the source code you will need to download the Android apk. The screen and app has been optimized for Z10 .
Converting apk to bar
The downloaded apk will have to be uploaded to Good Reader’s website to convert into BB10 bar file. The link to apk2bar online converter is:
http://apps.goodereader.com/apk-2-bar/
I have found Good Reader’s website to be friendly and easy to use. If you just want to use the bar app as it is, you can download clicking AccelMote_v1.0.1.bar kept at Bitbucket.
Side-loading the bar file into Blackberry 10 smartphone
The following Good Reader’s link has a tutorial on how to install bar app into your Blackberry 10 smartphone (my app is optimized for Z10): http://apps.goodereader.com/playbook/playbook-android-apps/?did=177 It has also a video on how to install in Z10. You will need to turn Development Mode On and select an easy to remember Password to be able to install the bar app.
The control program
The Blackbery 10 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. With the BlackBerry phone in landscape mode, tilting the phone forward, backward, to right or to left, the smartphone sends these commands to Robo-51 in order to control it. The following image of the BlackBerry shows the app’s icon (inside the red square) after it has been installed:
Pairing the Bluetooth module to Blackberry
Before running the application, you will need to pair the Bluetooth module on Robo-51 with your BlackBery’s Bluetooth:
Running the App
Next, when you run the app you will need to tell it which paired devices, your BlackBerry will it talk to by clicking Select Device:
Which in our case is the Spp device which you will select by clicking on it:
Note MAC addresses are not shown at all as I have blurred them. You will see your MAC addresses.
We will then connect, clicking the Connect button:
I have blurred the MAC addresses of my Bluetooth modules. Your will have your own MAC addresses. Once connected you will hear “I’m Robo-51 I’m at your command” and the screen will show the button Disconnect:
After clicking twice over Start button, you can control the robot tilting the phone forward, backward, to the right or to the left. Clicking twice over the Start/Stop button will stop the robot. At slightest tilt of the phone, the robot will move again
After you have played with the control of the robot, you can disconnect by clicking on Disconnect button on top right of BlackBerry screen. Clicking More at bottom right of your phone’s screen you will see the option to close the app:
By clicking Stop this application you will have be asked if you want to continue or go back to application:
Video demonstration
The following Youtube video demonstrates accelerometer on my BlackBerry 10 smartphone (Z10 4G LTE) controlling the robot (Robo-51) :
Conclusion
This project adds a new feature into existing Robo-51 projects. We have shown that the accelerometer in BlackBerry 10 can interact with external world, in this case a Robot. I can now tick as successful this project on acceleration sensor in BlackBerry 10.