HC Series Bluetooth Serial Master mode
Introduction
The HC series is a very low cost serial connection over bluetooth, costing around $5.00 per device.
The HC04 and HC06 are set at the factory into master or slave mode, and can be ordered in either variation.
This page uses the HC05 which, like it's industrial use counterpart HC03, can be set to either master or slave mode using the PIO11 or 'STATE' pin.
You can purchase a few here: http://www.dx.com/p/hc-05-wireless-bluetooth-serial-pass-through-module-for-arduino-green-240417?tc=USD&gclid=CJjSs_PiwcECFTMQ7AodencAqA, among other places.
Hardware Required:
Two HC05 devices
Step 1: Commence the Wiring!
This is what the HC05 looks like
Note that you'll need the pin marked STATE on the HC05's breakout board is sometimes identified as PIO11
HC05 Master pin setup
| Column 1 | Column 2 |
|---|---|
| HC05 Master | Mbed |
| Tx | p10 |
| Rx | p9 |
| 3.3V | Vout |
| GND | GND |
| STATE | Vout |
HC05 Slave pin setup
| Column 1 | Column 2 |
|---|---|
| HC05 Master | Mbed |
| Tx | p14 |
| Rx | p13 |
| 3.3V | Vout |
| GND | GND |
| STATE | Vout |
Part 2: Configure the master device
We've set the master to AT mode by connecting the STATE pin to 3.3v. Now, we'll tell it to act like a server or master device. Run the set master example code.
#include "mbed.h"
#include "MC05.h"
#include <string>
void main(){
MC05 master(p13,p14);
master.set_master();
}
The HC05 will need to reboot to run in master mode, so power off the mbed.
Now, power back on a load the Hello World file
#include "mbed.h"
#include "MC05.h"
void main(){
MC05 master(p13,p14);
MC05 slave(p8,p9);
Serial compy(usbtx,usbrx);
master.connect("1234");
master.send("Hello World!");
String in();
in = slave.read();
compy.printf(in);
}
The MC05 is factory preset with password 1234. Since this is how the connect command is configured, if your module has a different password, you'll need to send that as a string in the connect call.
Congratulations! you just set up a bluetooth serial connection with your mbed! /media/uploads/centurium/20141101_001756.mp4
2 comments on HC Series Bluetooth Serial Master mode:
Please log in to post comments.

Hi I would like to Hc06 module as a slave. Will this HC Series Bluetooth Serial Master mode work for slave? Do I need to have any seperate library. Please let me know.
Regards
Hema