Posted: November 16, 2011
Updated: July 15, 2012
I was a bit curious about how easy it would be to make a Bluetooth circuit that an Android and iPhone/iPad could communicate with so I went to SparkFun and got this BlueSMiRF Silver Bluetooth module. This module uses the SPP serial port protocol which for some odd reason Apple doesn't support in iOS, so I started with the Android. The Apple version is going to require the HID version of this board which I should be getting soon.
So since I had a couple DS18B20 temperature sensors left over from another project, I figured it would be cool to make a little portable Bluetooth thermometer. I used an MSP430G2553 microcontroller which I programmed to talk to the 1-wire bus of the DS18B20. The temperature is read every second or so and sent over the MSP430G2553's UART which the Bluetooth module is connected to. This BlueSMiRF Silver is pathetically easy to wire up. I wired the RTS/CTS lines together since I'm not doing hardware handshaking and connected TX/RX to the micro. The Bluetooth module has internal functions (changing the PIN code, the baudrate, etc) but using the default values for all of this simply requires hooking it up to a micro and pretending it's an RS232 cable running at 115200 baud. All my code is assembled using my naken430asm assembler.
As a side note, I put this thing in my refrigerator and I can read the temperature with the thing closed. Pretty cool :).
The next step is writing an Android program. The Bluetooth API on the Android is also pretty pathetically simple. The first step really is to pair the Bluetooth device with the phone. That's all done through the Android's Bluetooth settings. After that, the BluetoothAdapter class will return a list of paired BluetoothDevice classes. using createRfcommSocketToServiceRecord(UUID.fromString("00001101-0000-1000-8000-00805F9B34FB") in this class I get an instance BluetoothSocket from which I can call connect(), getInputStream(), getOutputStream(), and then I'm talking to the microcontroller as if there was an RS232 type cable between them. Note that the UUID here is not random, the UUID here is the one that's needed to connect to a serial Bluetooth device.
Update: As I suspected this would happen, someone downloaded this app from the Android Market and gave it one star with a comment in Russian (easy to translate with Google translate) bitching that my project is "nonsense" because you have to build a device to make this work. My description on the store even says you have to build the device. Please don't be nice and don't give me bad ratings on programs I worked hard on just because you don't know how to read. Thanks.
iPad/iPhone iOS App
This app is on the Android Market so anyone can download it. The circuit built from the schematic and firmware should work with it.
Update April 12: - Posted an old version of the source for the Android app which had some 'derrrr' code in it.. posted the newest version now.
Copyright 1997-2013 - Michael Kohn