The Bluetooth module is the bridge between the Android app and the Arduino.Circuit
Before you start you need to check the voltage requirement for your module. Many of these modules require 3.3V which the Arduino can provide without problem but the digital Tx output pin on the Arduino is 5v so you will have to build a simple level shifting voltage divider. Before you build the shifter solder leads onto the Bluetooth module. You need a lead on the Rx, Tx, 3.3V, and GND pins. Now for the level shifter grab the 10 and 20 kOhm resistors. Attach one leg of the 20 kOhm resistor (or 2x 10kOhm resistors in series) to ground, and the other to one leg of the 10 kOhm resistor. Add the end of the Bluetooth modules Rx pin to the connection between the two resistors. Finally connect the the other leg of the 10kOhm resistor to the Arduino's Tx pin. The last three connections from the Bluetooth module are simply GND to Arduino GND, 3.3V to Arduino 3.3V, and Tx to Arduino Rx. Once again the Arduino's headers are covered by the motor controller on the final build. Thanks to a1r
, without whose Instructable
I would have probably cooked my first Bluetooth board.
In the end I got a different Bluetooth module off of ebay that had the Vcc, GND, Tx, and Rx lines boken out to header pins and included a header cable. This unit was also 5v meaning the level shifter was not necessary. If you have a 5v module simply connect Vcc to the Arduino 5v pin, GND to Arduino GND, Tx to Arduino Rx, and Rx to Arduino Tx.Test
This test program for the Bluetooth also doubles as the test program for the Android app. A simple test you can run before getting into the Android stuff is to simply check if your phone can pair and connect to the Bluetooth module. The actual test code below blinks the led slow for 10 seconds when up is pressed in the app, and blinks the led fast when down is pressed in the app. It also cancels the led if either button is long clicked. Remember that the Bluetooth needs to be unplugged from the Arduino while you upload the sketch.