Arduino + Bluetooth Module Bringup

The Plan

I wanted to add Bluetooth communication capabilities to my Arduino projects.  I found a $5.01 Bluetooth module here… http://www.banggood.com/HC-06-Wireless-Bluetooth-Transceiver-RF-Main-Module-Serial-For-Arduino-p-80364.html.  This post shows the basic setup I did to get communications started.

The Hardware Setup

The voltage for the module from the supplier listed above was set for 3.6V – 6V so the Arduino 5V supply output is ok.

I found the data sheet for the HC-06 module here: http://silabs.org.ua/bc4/hc06.pdf.  Unfortunately the Tx and RX voltage is 3.3V still so I also purchased a cheap $1.82 level shifter here: http://www.banggood.com/Logic-Level-Converter-Bi-Directional-IIC-4-Way-Level-Conversion-Module-p-938774.html.

For the basic communication, I just hooked up the TX and RX through the level shifter to a SW UART on my Arduino UNO.  Here is the Fritzing diagram…

HC06BasicConnectCorrected

DIAGRAM UPDATED: Someone noticed that I had the HV and LV supply reversed in my original diagram.  I have corrected it.

Note: I used a HC-05 Fritzing symbol here (only one I could find).  The State and Key pins are not there on my HC-06 module.  Not sure what they should be connected to if it were a HC-05.

The Arduino Code

For the basic test, I am just using a basic pass through Arduino sketch…

/*
 Software serial test
 
 Receives from the hardware serial, sends to software serial.
 Receives from software serial, sends to hardware serial.

 */
#include <SoftwareSerial.h>

SoftwareSerial mySerial(7, 6); // RX, TX

void setup() 
{
 // Open serial communications and wait for port to open:
 Serial.begin(9600);
 mySerial.begin(9600);

 
}

void loop() // run over and over
{
 while (mySerial.available()>0 )
 Serial.write(mySerial.read());
 
 while (Serial.available()>0 ){
 mySerial.write(Serial.read());
 }
}

The Initial Test / Debug

I uploaded the Arduino sketch and opened the serial monitor and tried to send “AT” to the module.  Nothing came back.  Google’d around and found this post http://www.instructables.com/id/AT-command-mode-of-HC-05-Bluetooth-module/?ALLSTEPS.  One of the comments in the post said that you can’t send NL or CR in the serial communication to the HC-06 module.  Changed the serial monitor settings…

HC06SerialWindowBasicComm

Once I changed the serial monitor to not send any line ending, I was able to send AT+VERSION and get the response in the above screen capture.  Sending any line ending character resulted in no response.

The Next Post

I was able to Bluetooth pair the HC-06 with my Android tablet and write an Android app to send text back and forth to the Arduino.  That will have to be covered in a separate post.  I will post those development steps in my next blog post tomorrow (or sometime soon).

Advertisements

3 thoughts on “Arduino + Bluetooth Module Bringup

  1. In your fritzing you say the 5v side of logic level converter goes to HC-06 and the 3.3v side to Ardu… other way round, is not it? or am I wrong :)? And THANK YOU for your blog sharing knowledge … waiting for your nexts posts

    Like

    Reply
  2. Pingback: Simple Android to Arduino Bluetooth Communication | PetesTechProjects

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s