Android App for remote control (App Inventor):
An open source demo app is availabe at the App Inventor Gallery (you must be logged in). It is also available at Google Play under the name of Hortduino. This App uses Bluetooth to comunicate to the Arduino board and it uses a simple protocol.
The App interacts with Arduino by sending the actuator states and receiving sensor states.
Following instructions has been implemented:
To read: An[enter] => Reads analog n pin. Example: A0[enter]
n[enter] => Reads digital n pin. Example: 2[enter]
To write: An=value => Writes value to analog An pin Example: A2=255[enter]
n=value => Writes 1 to digital n pin Example: 3=0[enter] (or 3=1[enter])
Tn=value => Writes 1 to digital n pin during t seconds Example: T3=10[enter]
Sn=value => Writes value angle to digital n servo pin Example: S10=90[enter]
This protocol is implemented in a specific program (firmware) that must be installed in the Arduino board. This firmware can be downloaded here, and it depends on the standard Servo library and on the Simple Timer library, which is not included into the default Arduino environment but it has been included in our firmware distribution bundle.
Installing the Firmware into your Arduino
The firmware is a piece of software you need to install into your Arduino board to be able to communicate with it from App Inventor.
- Download and install the Arduino environment by following the instructions on http://arduino.cc/en/Main/Software. Take in account Arduino Uno requires at least version 0022.
- Download our firmware bundle from here
- Connect your Arduino board to a USB port in your computer
- Open the firmware file (BluetoothFirmwareTimersServo.ino) from the Arduino environment
- In the Tools menu, select the board version and the serial port where the board is connected
- Load the firmware into your board through Tools > Upload
Setting up your HC-06 Bluetooth module
In the following post a documentation can be found in order to set up the HC-06 Bluetooth module. 38,400 baud is a good value to communicate with Android devices.
Once configured the Bluetooth module, the protocol can be tested using a Bluetooth Terminal like BlueTerm: