Sunday, November 17, 2013

Working with BlueTooth

After some false starts with a couple of HC-06 BlueTooth modules (slave only), we received a HC-05, which can be set for master or slave. Future articles will show two such equipped Arduino's passing data back and forth. Out of the box, it's set for 9600 baud, and a pairing code of 1234. I connected TX on the BT module to Pin 10 on the Arduino, and RX to Pin 11. I connected 5.0 on the BT module to Arduino 5v, and Gnd to Gnd. Some BT modules require a voltage divider to bring the 5v down to 3.3v. This module does not need it, it's 5v friendly.

One of the first things I noticed, was that no LED's light up, but since the device showed up when discovering BT devices, I pushed forward.

Since I'm running Windows 7, I downloaded TerraTerm to connect to the BT Module wirelessly. If your laptop does not have BlueTooth, you can get a $2 USB adapter here.

First, make sure you pair successfully. HC-05 showed up in my discovered bluetooth device list. My Terraterm found two com ports, 11 and 12, but uses 11 to receive data from the Arduino.

I uploaded the following sketch to the Arduino which is transmitting data from the Arduino wirelessly to my laptop (and to my android smartphone as well):

#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX

int x=0;

void setup()

  // set the data rate for the SoftwareSerial port


void loop() // run over and over

Re-programming the HC-05 -

Uploading sketches over Bluetooth -