Jump to content
Sign in to follow this  
danielhuber

Bluetooth module HC-05

Recommended Posts

I have a MSP-EXP430G v1.5 launchpad with a M430G2553

 

I wanted to try my hands on Bluetooth and bought a module with a HC-05 chip. This can be bought in china for less than $4.

Info about HC-05 can be found e.g.:

 

www.linotux.ch/arduino/HC-0305_serial_module_AT_commamd_set_201104_revised.pdf

http://www.rcscomponents.kiev.ua/datasheets/hc_hc-05-user-instructions-bluetooth.pdf

 

Then I banged my head for a full day to make it work. The Bluetooth connection posed no problems, but the serial communication with the launchpad gave me a headache. 

My idea was, to set up a software serial connection for the HC-05 and use the HW UART for debugging.

Now I have to tell a bit about the(strange)  power up of CH-05.

 

If the ENA(able) pin (also called KEY) is connected to LOW, the HC-05 starts in data mode, 9600 baud, the mode you use for data transmission.

If the ENA pin  is held HIGH during power up, the HC-05 starts in AT command mode1 with 38400 baud. I tried this for a long time, but  I could

never get a connection.

If you hold ENA LOW during power up , and subsequently pull it HIGH the HC-05 starts in AT mode2 with 9600 baud. With this setting I got a very unstable connection with characters garbled and missing. After I long search I finally found:

 

https://ssihla.wordpress.com/2013/01/04/adding-bluetooth-to-the-msp430-launchpad/

 

Well, the baud rate of the energia library "SoftwareSerial" is not accurate enough (5% error) for the HC-05!!!

I then connected the HC-05 to the HW UART. Note that the HW UART is 9600 baud and so must  the HC-05 be.

For this, you remove the RDX/TDX jumpers on the launchpad and connect theTDX pin of HC-05 to P1.1 (pin 3) on the launchpad and the RDX pin of HC-05 to P1.2 (pin 4). This worked fine.

But now debugging is difficult because you do not have a serial monitor. To fix this you can connect the serial monitor to a software UART. The serial monitor seems less picky about accurate baud rate. The procedure for this:

 

First, choose which pins you want to use for the RDX/TDX of the software UART. Then look at the launchpad, component side, USB plug at top. From the 4 emtpy jumper pins, we connect the pin at upper right to the RDX software UART pin. The jumper pin at lower left is connected to the TXD software UART pin. 

 

On the pictures I chose P1.6/P1.7 as RDX/TDX for the software serial port. The HW UART is connected to the HC-05 module. I powered the HC-05 directly from the launchpad with 3.3V. This seems to work, even when the minimal Voltage is specified as 3.6V

 

With this setting it works quit reliable.

cheers, Daniel

post-37208-0-62348900-1455283403_thumb.jpg

Share this post


Link to post
Share on other sites

Thanks for posting this as this question / problem is posted here from time to time. It's the same for connecting ESP8266 or GPS modules etc if you want a second (software) serial for debugging. Maybe you could add a picture of the setup to make it even clearer ...

 

Kind regards

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×