Tuesday, 4 November 2014

HC-05 Bluetooth AT commands configuration




We have been using the serial SPP(Serial Port Profile) Bluetooth modules to interface our embedded hardware and robots to Laptop or a smart phone... hear is an example of Bluetooth controlled POV LED display and a smart phone turned into an intelligent robot....




So this HC-05 is very much useful if you want to make some thing cool like this. So it will be helpful if we are aware of the configurations commands to work with the module. 

AT commands:

AT commands stands for attention commands with which we communicate with the module and alter it's performance.

There are TWO modes of working with HC-05 module. To check with the module you will need a serial port on your PC or laptops. But nowadays our PC won't come with an inbuilt RS232 serial interface  so you can use any USB to serial converters like CP2102 or FT232 devices. After connecting the device to the PC we need any serial terminal software in case of  windows7 and 8 like "Teraterm" or "Putty" .But in case of windows XP you got hyper-terminal. 

In my case i got a CP2102 with me. connect Bluetooth to the CP2102 UART pins (RX and TX)

  
 There is one important thing that you need to keep in mind is....
 "your Bluetooth module logic voltage levels" mine is 3.3V but it got tolerance up to 5V so no problem with my device. and my CP2102 is direct TTL and I am not using any MAX232 in this. so make sure of your device before powering it.

 after connecting the Bluetooth to your serial port device like the one in the picture above. 
connect the device to your PC and power it up...now you will see an LED blinking very fast on your Bluetooth module. This is the normal serial data mode.

Now remove the power. Press and hold the mode button and connect the power. Then the LED will start blinking very slowly...which indicate that you Bluetooth is now in "AT command"mode.

open the serial terminal software and select the "COM" number of your serial port module and configure the following                                
baud rate as"38400"
hardware    "none"
parity          "none"
databits       "8"
stop bits      "1"

better enable local echo in your terminal software...

type "AT" and press <enter> switch you will get response "OK" it means your device is working in AT mode successfully..once if you disconnect the power then the you Bluetooth will be back to serial data mode.

NOTE: in AT mode the baud rate will be 38400. but in serial data mode many baud rate values can be  used.

few of the useful AT commands:

AT    <enter>   it gives the response OK continuously so press <enter> again to stop

AT+NAME?  <enter> it displays the name of Bluetooth module

AT+NAME=new_name  <enter> changes module name to "new_name"

AT+PSWD?  <enter> displays password to enter while pairing with this device

AT+PSWD=4321 <enter> changes the password to 4321
( only 4 digit number is accepted as password )

for more info regarding AT commands refer to the data sheet.

   





2 comments:

Unknown said...
This comment has been removed by a blog administrator.
Ecosens said...

This is really interesting blog on PIR Sensor, You are a very skilled blogger. I've joined your rss feed and look forward to seeking more of your excellent post. Also, I've shared your web site in my social networks! Thank You!!!

Post a Comment