This time I went about building a small mobile robot that could be controlled using my Android phones bluetooth. The robot uses a Bolutek BC04 bluetooth module interfaced to an Arduino UNO.
Step 1: The BC04 Bluetooth module
The BC04 module can be interfaced to your designs using UART, using its RX and TX pins. It has two modes of operation, command mode and communication mode. In command mode, it can be configured using AT commands. After getting a connection the module goes into communication mode and serial data written to the RX pin is sent out over bluetooth to the other device. Data received over bluetooth is sent out serially through the TX pin.
There are two main documentation files available:
BC04 AT Commands
I bought my module from digibay.in
Step 2: Make a PCB for the module
This step is optional
Since I didn't have a break out board for my module, I made a PCB for the module.
Refering to the schematic, JP1 and JP2 bring out the extra functionality pins of the module. I left them unused on my PCB. To get started, first I configured my board to use a hardware selectable master/slave mode by placing a jumper between PIO(4) and GND at JP6. Then I set the board into slave mode by placing a jumper between PIO(5) and GND.
In slave mode the module allows a bluetooth client to connect to the module. In this case the bluetooth client will be my Android phone.
Here's a post I had written about getting started with the module:
Eagle Schematic and Layout
Eagle Library for the BC04 Bluetooth Module
Step 3: Building the robot
As a platform for the robot, I used a geared motor set from an old toy and attached it to a cheese tub. All my electronics will go into the tub :-P
I used the softwareSerial library on an Arduino Uno to communicate with the bluetooth module and an L293D IC as a driver IC for the motors (See the schematic)
Arduino Source code
Step 4: Android App
To connect my Android phone to the module, I wrote a custom Bluetooth client app.
Before proceeding, make sure the robot is turned on. The modules LED connected to PIO(1) should blink, indicating it has gone into pairable mode.
On the Android device, the user has to first turn on Bluetooth either from the devices settings or via the switch in the app. Then click on Connect to remote device and pick the module to connect to. The default bluetooth name of the module is Bolutek.
The app will then try to connect to the module. Once connected it will show the status as connected and the LED will remain in a steady On state.
Pressing the buttons Left, Right, Forward, Reverse or Stop will then move the robot accordingly.
Download the app APK
App Source Code
Step 5: Finish
Hope you were able to understand the instructable and find the codes useful.
There are two posts on my blog which might be helpful