4.Putting it all together and the Android Application

To put it all together, the picture below shows all the components connected.

The 9 volt battery powers the Arduino Uno, the Bluetooth module, and the L298's logic circuit. The 5 AA batteries power the motors. They are connected to the screw terminals on the Motor shield. The front and back motors are also connected to these screw terminals. The jumper wires coming from the LED circuit are connected to the Arduino 's pins 4 and 7. The Bluetooth module's RX pin is connected to Arduino's TX pin. And the Arduino's RX pin is connected to the Bluetooth module's TX pin. The Bluetooth module's VCC is connected Arduino's 5V pin, and the GND pin is connected to the Arduino 's ground pin. The Bluetooth module's RTS and CTS are connected together. Remember to connect the ground jumper from the LED circuit to the Arduino's ground. And this completes the connections.

As you can see in the pictures above, I used card board to create a platform for the circuit. I ended up using a small breadboard as well. I connected the Bluetooth module, and the ON/OFF switch to the breadboard. Since the wires I soldered to the Bluetooth module were vertical, I used a 6 hole Arduino header with bent legs. And this completed the project.

The Android Application:

The application is based on the Bluetooth Chat API demo found on the Android API's. I first created an application that enables the use of two buttons simultaneously. I used this tutorial on multi-touch:

I then combined this code with the Bluetooth communication part of the Bluetooth Chat demo.I used this tutorial for the colorful seek bar and this other for the animated LED. This is what I ended up with:

After this I added a couple of toggle buttons for the back and front lights, and the accelerometer control feature:

The updated version 1.6 lets you choose between streaming a character every 50ms, and streaming a character on touch. The continuous stream feature was added because it can be used to determine when the car has gone out of range.

What the application does is pretty much send an ASCII character to the Arduino. It then processes the character and controls the rc car's motors.

These are the characters used:

Forward---------------------F

Back-------------------------B

Left---------------------------L

Right-------------------------R

Forward Left--------------G

Forward Right------------I

Back Left------------------H

Back Right----------------J

Stop-------------------------S

Front Lights On---------W

Front Lights Off---------w (lower case)

Back Lights On---------U

Back Lights Off---------u (lower case)

Speed 0-------------------0

Speed 10-----------------1

Speed 20-----------------2

Speed 30-----------------3

Speed 40-----------------4

Speed 50-----------------5

Speed 60-----------------6

Speed 70-----------------7

Speed 80-----------------8

Speed 90-----------------9

Speed 100---------------q

Everything OFF--------D

You can get the application from the Google Play market:

https://play.google.com/store/apps/details?id=braulio.calle.bluetoothRCcontroller&feature=search_result

(Please don't ask for the Android code)

I have provided the code of a simple application that can communicate through Bluetooth. It is composed of a spinner and button. This is a great starting point for anyone that wants to create a similar application. It is within the zip folder called "BluetoothSendCharSpinner". It can be found at the bottom of the site. Click on the arrow pointing down to download it.

The Demonstration: