Arduino to BlueSMiRF Silver

Some time ago I purchased a Roving Networks RN-42 module Sparkfun put together as a BlueSMiRF Silver board and I finally got around to playing with it. Unfortunately, I found Sparkfun's tutorial less than complete and had to go back to the datasheet to get things working.


First thing was to wire it up to an Arduino. Having been in Embedded Systems through UT Austin which uses a TM4C123 microcontroller and being in the pathways course to get my Masters in Electrical Engineering through University of Colorado Boulder with a focus on Embedded Systems using PSoC and the CY8CKIT, well Arduino was not my first choice, but that was what the Sparkfun tutorial I initially followed was using, so...



After much frustration and reading through the data sheet, it turned out this was a really bad setup. The first problem was communication between the microcontroller and the Smirf. The Smirf's default baud rate is 115200 bps, and the Arduino was setup with a SoftwareSerial connection, which can't handle that speed. The Arduino sketch does an initial setup to change the baud rate of the Smirf to 9600 bps when the sketch starts so any change to the baud rate after setup results in a loss of communication. All configuration changes to the Smirf require a reboot to take effect, but in rebooting you result back to the default 115200 bps. Additionally, because the Smirf is powered on the 5 [V] pin, it doesn't actually reboot when a new sketch is uploaded to the Arduino - power is not interrupted. My simple solution was to use a 2N3904 transistor the Arduino could control and moving the Smirf setup to a separate function in the sketch.



Pairing with a desktop computer was incredible easy and straightforward. Once pairing was done, you can look in Device Manager to see that there were two new COM ports in use by Bluetooth - one for incoming and one for outgoing. To figure out which was which, I had a look in Advanced Bluetooth Settings. Finally I opened two Tera Term terminals - one to replace the Arduino Serial Monitor (so that I didn't have to keep clicking "No new line" and "Newline" to get in and out of command mode) and one for the UART Bluetooth Communication. The Arduino sketch is just a pass-through sketch, whatever comes in its serial port is sent to BT and outputs on the computer and whatever comes through BT is sent to the Arduino's serial port.



Lesson is, always use the datasheet.