Step 4: Why Connect the Phone Via Bluetooth?
The only way a Android phone can connect to the arduino via the serial (USB) port of the phone is if the phone is rooted. I didn't want to take the risk or live with the consequences of breaking into my own phone. The alternative is to connect by Bluetooth.
When selecting a Bluetooth modem I choose one that had extended range so I could use it for other projects. You don't need a class 1 (350 feet). For this application a class 2 (33 feet) will work just fine. I used the USB modem found here...
I used the following instructable on how to wire it...
Note: Whenever you need to upload you code to the arduino you need to first disconnect the positive lead of the bluetooth modem from power. If you don't the uploader will error. The bluetooth modem uses the same pins that are used by the USB connection on the Arduino.
OK, this takes care of the wiring but it doesn't tell you anything about actually using the modem. We will get to that in a later step. The thing to remember is that the communication speed (baud rate) of the modem by default from the factory comes as 115200. So you will need to change your arduino to match. I'll get into that in a later step as well.
The picture is borrowed from the manufacturer because mine is buried too deep to show.
While the modem has 6 wiring points you only need 4 for the arduino - +5v, Ground, RX (receive), TX (transmit). The Arduino pins 1 and 2 have RX and TX on them as well. The wiring is reversed so that the receiving side listens to the transmitting side RX to TX and TX to RX. I recommend either using 22 gauge solid core copper wire for the leads, so they can be pressed into the arduino, or wiring in some male leads.
For the sake of clarity, the phone and the modem both ride on the bot so the distance between them is very short.