Cooking with Bluetooth

by Carson Reynolds

The purpose of these informal notes is to explain the process used to make a wireless physiological sensor we call HandWave. It is my intention to document things in a way so that other folks wishing to make Bluetooth devices can use these notes as a rough guide to the process. HandWave is a device consisting of a Bluetooth transceiver, analog to digital converter, and signal conditioning circuitry specific to skin conductivity sensors. It is the result of nearly 10 months of development and the work of myself, Stephen Hughes, Marc Strauss, Ross O’Neill, Scott Eaton, Gary McDarby, and Rosalind Picard.

Preamble: Developing a skin conductivity sensor
An important, but sometimes overlooked part of the process of building a Bluetooth device is developing the component it will service. Previously, we had developed a skin conductivity (sometimes called GSR) sensor. We began by breadboarding a (somewhat flawed) prototype of the circuit and debugging it. This was then revised to integrate a PIC microcontroller to output analog to digital converter (ADC) values. After still more revisions, we arrived at a version that requires no calibration and uses an I2C ADC.

Step 1: Prototype with a development kit
Now that we had a stable sensor, we started the process of integrating it with the Bluetooth radio. Because of the small form factor, we chose to use the Cambridge Silicon Radio BlueCore 2 device. This has many implementations, but when starting one of the most useful is the Casira development kit. These are rather expensive and if you’re looking for a cheap alternative you might try’s BR-EC11A. Stephen Hughes has also developed a BlueCore Programmer/Debugger (SHBCP/D) that can be used to work with Mitsumi implementations of the BlueCore 2 like WML-C09, WML-C11, and WML-C20.

Once you’ve got your hands on a development environment, you’ll need to install some software tools. We developed using CSR’s BlueLab software. I have written up a quick HOW-TO for “Hello World” using BlueLab with the Casira or Stephen Hughes’ SHBCP/D. BlueLab is a hacked version of GCC that allows you to program the BlueCore’s virtual machine.

We hooked our I2C GSR sensor up to the Casira and later the SHBCP/D. More specifically, we powered our sensor from the development boards (using hack wires), and attached the sensor to the PIO pins associated with I2c. We developed code to address the specific I2C part for our sensor: the TI ADS1110. This was then debugged using an oscilloscope on the Bluecore’s PIO pins. A note of warning: CSR provides two I2C implementations. The old/i2c.h can be used with any PIO pin. The newer i2c.h is implemented in firmware and only works with PIOs 6 and 7. Certain devices (i.e. the WML-C09) do not expose PIO 6 and 7.

Step 2: Develop a PCB that integrates the BlueCore
We next developed a board which allowed our sensor to interface the BlueCore. Stephen Hughes devised a clever system for prototyping. He soldered WML-CXX module to a printed circuit board (PCB) that incorporates at Harwin plug on the bottom side. This plug can be used to program the module and to attach it to application printed circuit boards. Consequently, our designs feature a Harwin socket that interface’s with Stephen’s BlueCore Module Adapter PCB.

Our sensor went through many revisions before we correctly interfaced with the BlueCore module. The sensor board needs to provide the BlueCore not only with data, but also with regulated power. The schematic for the current revision shows the moderate complexity.

Step 3: Develop firmware for the device
Starting with the firmware we’d used on the Casira, we developed firmware for the HandWave sensor. At a high level, the firmware provides a serial port profile (SPP) which communicates with other bluetooth radios using the RFCOMM stack. From the perspective of client PCs, this makes the device appear to be a virtual serial port which can be written to or read from.

For our sensor, we integrated the I2C code into the firmware so that periodically a timer would read data over the I2C bus and transmit it over the radio. This was done by copying it into the memory sink associated with the radio.

Off and running
At this point we focused most our attention developing drivers for the client PCs, and different form factors for our device. Although much work is still ongoing, we’ve been very happy with the flexibility of the developing with the BlueCore. Even more importantly, Bluetooth radios are becoming pervasive. This saves you the trouble of engineering a base station. A very similar approach to the one detailed here was also employed by the AuraLingua device, building on this approach it was developed in 4 months.