Serial Communication

To communicate between the microcontroller and the Android phone, we used Bluetooth. Bluetooth was chosen over other methods such as hobby RC, Xbees and Wifi because it was deemed very cool to be able to control the boat using a cellphone. The transceiver used is a BlueSmirf Gold sold by Sparkfun. The transceiver is basically a virtual wire over with normal RS232 serial flows.

Therefore, on the part of the microcontroller, all that was needed was two wire, RX and TX to be connected between the microntroller and the BlueSmirf. Once the BlueSmirf got power (5V) and a ground connection, it was good to go. There is an indicator light on the BlueSmirf which blinks red at a steady rate when the device is turned on. Once the Bluetooth connection has been established, the light changes to a steady green.

The Bluetooth tranceivers's range is about 40 feet in open air. However, when the transceiver is enclosed in the protective box, the range drops substantially. Tests that we have performed are inconclusive, but keeping the phone and the transceiver within 20 feet is a good rule of thumb.

We designed a simple protocol for transmitting information from the phone to the microcontroller. This was necessary to prevent loss of information when transmitting and allow richer communication. The protocol relied on beginning every transmission with a '$' character, inserting the message and ending it with a '#' character. The first character of the message is used to distinguish what command it is. The subsequent commands can then be used as parameters for the command.

We did not end up using the flexibility of the commands as we mostly had boolean control. The motors would either be at full speed or turned off, valves open or closed and turret at certain discrete positions. This could definitely be an area of improvement for the boat.