In my last post I described setting up a development environment for working with the Arduino Uno micro controller.
This post describes my first project; getting an Arduino connected to a bluetooth modem to talk to my Android based cell phone. the parts I used for this project include:
- 1 x Arduino Uno,
- 1 x Sparkfun Electronics Bluetooth Mate Silver modem board,
- 1 x 40 pin connecter,
- 2 x 220 ohm resistors,
- 2 x 5mm LED’s (green, yellow),
- 1 x breadboard,
- wire connectors,
- 9 volt DC telephone wall transformer re-wired so that positive voltage is in centre of jack.
The following is an image (done with the Fritzing software package) of my breadboard layout for this project.
My first step was to solder a 6 pin connector (trimmed from the 40 pin connector) to the modem board. I used a straight pin connector, but it would make more sense to use a 90 degree connector I think.
After the connector was soldered to the modem board I laid out the circuit shown above.
My sketch (the code I used to control the Arduino is included. Click on this link (boardtest).
I tested the board layout and the code by initially leaving the Rx Tx lines to the modem board disconnected. I was then able to use the Arduino Serial Monitor to emulate sending and receiving data between the Uno and the modem. Remember to reset the Serial Monitor to communicate at the same baud rate as is set in the setup() function of the sketch (Serial.begin(115200);). Otherwise you will just see gibberish on the communication link.
The Sparkfun Electronics modem communicates at 115200 by default. Unless you change this speed you must match it (as is done in the setup() function). I struggled with this problem for a long time until I figured it out; the modems were paired and connected, but only gibberish was communicated between the two boards.
After the board was laid out and the sketch was uploaded and tested via the Arduino serial monitor I connected the Tx Rx lines to the modem and connected the Arduino to the external power supply. I then performed the following steps:
- On my cell phone I paired to the Arduino Modem board (passcode 1234),
- On my cell phone I launched the btterm application and connected to the modem board. (If this is successful the led on the modem board will go from blinking red to solid green),
- I then used the btterm application to send text to the modem and watched the LED’s change from low to high depending on what was pressed.
Eventually it all worked! The hardest part of this project was getting the modems communicating to each other.
Some references I found on the internet: