April 25, 2014

Some Technical Stuff: Fun with Bluetooth

Hi everyone,

Since I recently got Bluetooth communication working with the Arduino board, I'll be sharing the details of my progress. Before sending any data over a Bluetooth connection, I first had to connect the Bluetooth module to the board. A quick Google search brought me to a tutorial (http://makezine.com/projects/connect-an-arduino-to-a-7-bluetooth-serial-module/), which explained that digital pins 0 and 1 on the Arduino correspond to TX and RX (transmit and receive), respectively. This meant that, with the corresponding pins on the Bluetooth module connected to the board, the data sent over a USB connection would be the same as that sent over a Bluetooth connection. Therefore, using Serial.print() within the code would send the same data over both types of connection.

Here's a diagram of how the Bluetooth module was wired:

Now, after powering the Arduino, the LED on the Bluetooth module started flashing, indicating that it was receiving power. I then attempted to connect to the device using my computer's Bluetooth connection. It quickly located the device, and was able to establish a connection.

Using the Tera Term software (available at http://ttssh2.sourceforge.jp/index.html.en), I attempted to receive data from the Arduino (which would simply be the ECG data that I had set up earlier to be sent over the USB connection). Instead, the terminal simply showed a jumble of random characters.

Another trip to Google revealed a manual for the HC-06 Bluetooth module that we are using (http://makezineblog.files.wordpress.com/2014/03/hc_hc-05-user-instructions-bluetooth.pdf). Reading through, I saw that the default rate of communication for the module is 9600 baud (or symbols per second). In the code, the value for serial communication had originally been set to 57600 baud, using Serial.begin(57600). I changed this value, re-ran the software, and finally got the same output I had been receiving with the serial monitor in the Arduino software.

The next step was to see if this same output could be communicated to a smartphone. Searching through the Google Play Store revealed an application called "Android Bluetooth Terminal," which I determined would be sufficient for testing purposes (app available here: https://play.google.com/store/apps/details?id=arduino.bluetooth.terminal). I connected to the device using my phone's Bluetooth connection, ran the app, and successfully received the output.

Now that the device is set up to send a Bluetooth signal to a smartphone, development of the Android application can begin. Before getting started on this, however, the group plans to first complete an initial version of an algorithm for detecting irregularities in the ECG signal. This is already in progress, so look forward to my upcoming post detailing the specifics of the math and programming that are going into it.

Anyway, that's all I've got for now!

1 comment:

  1. It's really a nice Blog, I got a lot of correct information here thanks for sharing this amazing Blog with us. keep it up. Heart Monitoring Device

    ReplyDelete