Bluetooth HC-05

A cheap UART to Bluetooth serial converter easily found on ebay, amazon, and alibaba

Hello World

Import programHC05_AT_mode

This program send an AT command to the HC05 module and shows the response into a terminal.

Library

Import libraryMODSERIAL

MODSERIAL with support for more devices. Added support for LPC4330

Notes

Where to buy

This module can be easily found on ebay, amazon, or alibaba .

What is it?

The HC-05 is a very simple UART to Bluetooth converter that accepts the AT Command set.

Product Specifications

  • Chipset CSR BC417143
  • Bluetooth version V2.0+EDR
  • Output power Class II
  • Flash 8Mbit
  • Power Supply 3.3V
  • Size 26.9mm*13mm*2.2mm

Pin Description

http://developer.mbed.org/media/uploads/edodm85/1-881-.jpg

Connectivity

HC05 pinMbed pin
1 - TxP10 - Rx
2 - RxP9 - Tx
12 - 3.3VVout - 3.3V
13 - GNDGND
31 - PIO8--
32 - PIO9--
34 - PIO11GND or 3.3V

AT command mode

In AT command mode you can configure and send control command to the HC05 device.

For enter into AT mode you must follow this steps:

  • Power off the mbed
  • Tie PIO11 to 3.3V (you can see it on the schematic below)
  • Power on the mbed
  • Open a serial monitor (Set the baud to 115200; choose "Both CR+LF" in the check box)

Schematic for AT command mode

http://developer.mbed.org/media/uploads/edodm85/at_mode_sch.jpg

Further Information

More information can be found on the original notebook page for this project here http://developer.mbed.org/users/edodm85/notebook/HC-05-bluetooth/.

Example

S2B(Serial to Bluetooth) Example

Import program

00001 /**
00002  ******************************************************************************
00003  * @project HC-05_HelloWorld_WIZwiki-W7500
00004  * @author  WIZnet
00005  * @version V1.0.0
00006  * @date    01-JUL-2015
00007  * @brief   Main program
00008 *******************************************************************************
00009 **/
00010 
00011 /* Includes ------------------------------------------------------------------*/
00012 #include "mbed.h"
00013 
00014 /* Private typedef -----------------------------------------------------------*/
00015 /* Private define ------------------------------------------------------------*/
00016 /* Private variables ---------------------------------------------------------*/
00017 Serial pc(USBTX, USBRX);
00018 Serial bt(PA_14, PA_13);
00019 
00020 /* Private function prototypes -----------------------------------------------*/
00021 
00022 /* Private functions ---------------------------------------------------------*/
00023 /**
00024    * @brief  Main Function
00025    * @param  None
00026    * @retval None
00027    */
00028 int main(void)
00029 {
00030     char ch;
00031     pc.baud(115200);
00032     bt.baud(115200);
00033     pc.printf("Hello World!\n\r");
00034     bt.printf("Hello World!\r\n");
00035     
00036     while(1)
00037     {
00038         if(bt.readable())
00039         {
00040             ch=bt.getc();
00041             pc.printf("%c",ch);
00042             bt.printf("%c",ch);
00043         }
00044         
00045         else if(pc.readable())
00046         {
00047             ch=pc.getc();
00048             bt.printf("%c",ch);
00049             pc.printf("%c",ch); 
00050         }
00051     }
00052 }