Tuesday, 10 January 2012

History - Bluetooth temp sensor - Redux

In my last post I described my Bluetooth temperature sensor. In the project I connected my Bluetooth module to pins 2/3 on the Arduino and used SoftwareSerial to communicate over the Bluetooth connection.

I did this so that I could still use the normal Serial connection in parallel. In fact I spent some time trying to write a library that would output data to both a Serial and SoftwareSerial connection. In the end this turned out to not work for reasons that I never got to the bottom of. The only solution I couldLink come up with was to use a #define to allow me to quickly switch between a Serial and softwareSerial connection. Worse, the softwareSerial connection only worked when I reduced the baud rate to 9600.

This is a crap solution. Why not just connect the Bluesmirf module to pins 0/1 and get the hardware Serial support to do it magic. So I've tried this and it works!

Interestingly, with the Bluetooth module connected to pins 0/1 I can cannot to the module and send/receive data to the Arduino. However, I can't connect over the USB Serial port unless I disconnect the Bluetooth module. I don't even need to restart the Arduino!

The result of all this fiddling is that I can now connect at 115200 instead of 9600! Thats a 12 times speed up!