Bluetooth® wireless technology is becoming a popular standard in the communication. it is one of the fastest growing fields in the wireless technologies. It is convenient, easy to use and has the bandwidth to meet most of today’s demands for mobile and personal communications. Bluetooth technology handles the wireless part of the communication channel; it transmits and receives data wirelessly between these devices. It delivers the received data and receives the data to be transmitted to and from a host system through a host controller interface (HCI). The most popular host controller interface today is either a UART or a USB .Here, I will only focus on the UART interface, it can be easily show how a Bluetooth module can be integrated on to a host system through a UART connection and provide the designer an optimal solution for Bluetooth enabled systems.
The bluetooth module I will use today is HC-05 which is so familiar and cheap. It is easily available in local indian markets. You can go either offline or online. You may find in about ~600 ₹. May be if you search better, you can get as low as 450 ₹.
HC-05 Bluetooth Module is one of the most popular bluetooth module used in embedded projects. It can be easily interfaced with Arduino Board, Raspberry Pi, Microcontrollers through serial UART interface. HC-05 module is an easy to use Bluetooth SPP (Serial Port Protocol) module, designed for transparent wireless serial connection setup.
Serial port Bluetooth module is fully qualified Bluetooth V2.0+EDR (Enhanced Data Rate) 3Mbps Modulation with complete 2.4GHz radio transceiver and baseband. It uses CSR Bluecore 04-External single chip Bluetooth system with CMOS technology and with AFH(Adaptive Frequency Hopping Feature). It has the footprint as small as 12.7mmx27mm. Hope it will simplify your overall design/development cycle.
- Frequency : 2.4GHz ISM Band
- Bluetooth Protocol : Bluetooth Specification v2.0 + EDR
- Emission Power : ≤4dBm, Class 2
- Operating Voltage : 3.3V
- Input Power Supply : 3.6V ~ 6V
- Security : Authentication & Encryption
- Working Temperature : -20°C ~ +75°C
- Dimensions : 35.7mm x 15.2mm x 5.6mm
- 3.3V TTL Compatible
- Wide Input Voltage Range : 3.3V ~ 6V
- Supported Baud Rates : 9600, 19200, 38400, 57600, 115200, 230400, 460800
- Auto Connect to Last Device on power as default
- Supports Master and Slave Modes
This module works on AT Commands. Lets have a look at important AT commands.
- KEY: if set to HIGH module goes into command mode for configuration
- RXD: the RXD signal line – 5V safe
- TXD: the TXD signal line – 5V safe
- Vcc: connection for 5V supply voltage
- GND: Ground
- State : Not connected
The Module has two modes of operation namely,
- AT Command Mode.
It is a mode of the module where a set of commands (AT Commands) are used to setup and configure the module. In this mode, the module can’t be detected by other Bluetooth Devices. For this mode take Key pin to HIGH. All the Commands are sent to the module serially as a string. This string must be capital letters (case sensitive) and each command should be ended by “rn”. If the command is successfully understood by the module, the module will reply back with a response string usually contains the string “OK”. Otherwise, the module returns back the error string “ERROR()” with a specific code that defines the type of this error.
- Connection Mode.
In this mode the device can directly communicate with other devices. We can search this device on other devices and can connect via entering the passkey. The default passkey is ‘1234’. In this mode we cannot change its configuration serially, but can only communicate with it. Key pin should be NC for this case.
You can use any of your favorite microcontrollers, but the condition is it should be having atleast one serial port. I am taking widely used PIC microcontroller as an example here. The device code is PIC 16F887.
For that purpose i needed to configure my HC-05 first to be able to communicate with microcontrollers. Because the default baudrate of module was 38400 hence not easy to direct communicate with microcontroller. So i changed few of settings of HC-05 and changed its baudrate. I did it via my Laptop and a USB to TTL converter. You may use any it of any type such as FTDI, Prolific PL2303 or Scilab CP2021. Then we need a terminal program at Laptop side. For the i used RealTerm. You can use Putty, Terminal or HyperTerminal even. If you want download links for them here are some of them:
- RealTerm: http://realterm.sourceforge.net/
- Terminal: https://sites.google.com/site/terminalbpp/
Then connect as per shown below
The connections between HC05 module & the USB converter are simple as below :
HC – 05 MODULE USB-TTL MODULE
VCC ——> 5.0V
GND ——> GND
TXD ——> RXD
RXD ——> TXD
KEY ——> 5 V
So now we will be entered into the AT mode.
Then Open real term and connect the respective COM port with 38400 Baudrate.
Enable CR and LF after each line. Then in transmit window
Send ‘AT’. Then it should reply as OK if everything works fine.
Further you can check its version with command ‘AT+VERSION’. You can get its device address with ‘AT+ADDR?’. But our priority is to check the baudrate first. So enter ‘AT+UART?’ Then it replies as
Param1: baud rate( bits/s) value (Decimal)
Param2:stop bit: 0 —-> 1 bit
1 —-> 2 bits
Param3: parity bit
0 —-> None
1 —-> Odd parity
2 —-> Even parity
We have to set as 9600 baud rate 1 stop bit hence now we will set this configuration.
To set baudrate the syntax is ‘AT+UART=<Param>,<Param2>,<Param3>’
Hence we will send ‘AT+UART=9600,0,0’
So now our module is ready to be connected to microcontroller so remove HIGH logic at Key pin to exit AT mode. Now we are ready to work with microcontroller. Here the schematic is shown with one 16×2 LCD and a serial port connection.
Our task is to type a message on Android device and it should be displayed on LCD of our Hardware. So Lets see the PIC microcontroller program for that below. Later on we will download app for Android to communicate.
//Initialize USART with baud rate 9600
TRISD = 0x00;
USARTWriteString(“Hii.. Bluetooth is readyrn”);
//Get the amount of data waiting in USART queue
uint8_t n= USARTDataAvailable();
//If we have some data
if(ch == ‘n’)
Like we use the Hyperterminal utility to send data over serial in PC, there are similar kind of very useful apps for smartphones also. But they send this data over Bluetooth to other devices. Most of platforms are having this kind of apps. I am focusing on Android here. Phone which i tested was Micromax Canvas HD (Model No: A116) It runs on Android Jelly Bean. But generally speaking most of android phones are capable to do it via these apps.
I used the app called ‘Bluetooth Terminal’ Checkout at PlatStore: https://play.google.com/store/apps/details?id=ptah.apps.bluetoothterminal&hl=en . Check the logo below
Download the app and follow on screen instructions. Now search devices, You will find device named as ‘HC-05’. Connect it with.
Now reset your microcontroller.On your mobile app ,you should see the text as ‘Hii.. Bluetooth is ready’.
Now type any message on your screen and the press send the text will be displayed on the LCD of our hardware board.
See the final view in the app:
I simply needed to say thanks yet again. I am not sure the things that I might have followed without those strategies shown by you directly on this subject. It previously was a very horrifying setting for me, nevertheless being able to see the professional form you processed it made me to weep with gladness. I will be grateful for this help and hope you realize what an amazing job that you’re accomplishing educating people thru your blog post. I am sure you have never come across any of us.
We are a gaggle of volunteers and starting a brand new scheme in our community. Your website provided us with valuable info to work on. You’ve done an impressive process and our whole group will likely be grateful to you.
I gotta favorite this site it seems very useful handy
Hello There. I found your blog using msn. This is a very well written article. I’ll make sure to bookmark it and come back to read more of your useful information. Thanks for the post. I will certainly comeback.
There are definitely plenty of details like that to take into consideration. That may be a great level to bring up. I provide the thoughts above as normal inspiration however clearly there are questions like the one you bring up the place crucial thing can be working in sincere good faith. I don?t know if greatest practices have emerged round issues like that, but I am positive that your job is clearly identified as a fair game. Each girls and boys really feel the impression of just a moment’s pleasure, for the rest of their lives.
It’s really a great and useful piece of info. I am satisfied that you simply shared this helpful info with us. Please stay us up to date like this. Thanks for sharing.
Wow! This can be one particular of the most useful blogs We’ve ever arrive across on this subject. Basically Magnificent. I am also an expert in this topic therefore I can understand your hard work.
Pretty section of content. I just stumbled upon your website and in accession capital to assert that I get actually enjoyed account your blog posts. Anyway I’ll be subscribing to your feeds and even I achievement you access consistently fast.
An excellent read. I’ll certainly be back.
I have recently started a website, the info you offer on this website has helped me greatly. Thank you for all of your time & work. “Patriotism is often an arbitrary veneration of real estate above principles.” by George Jean Nathan.
This is incredibly open-handed with you to present freely exactly what many of us would’ve made available for an ebook to end up making some cash on their own, certainly now that you might well have tried it if you ever desired. The suggestions also acted to be the good way to be certain that other people have the same passion much like my very own to learn lots more on the topic of this issue. I am sure there are some more pleasant situations up front for people who take a look at your site.
Hi there friends, its impressive paragraph regarding teachingand fully explained, keep it up all the time.|
I’ve recently started a web site, the info you offer on this website has helped me greatly. Thanks for all of your time & work. “It is a great thing to know our vices.” by Cicero.
Hello! I simply want to give you a huge thumbs up for your excellent info you’ve got here on this post. I am returning to your blog for more soon.|
I like the efforts you have put in this, thanks for all the great content.
Generally I don’t learn post on blogs, however I would like to say that this write-up very pressured me to try and do so! Your writing taste has been surprised me. Thanks, very great article.
Hi there colleagues, how is everything, and what you desire to say concerning this article, in my view its genuinely awesome designed for me.|
Hello! Someone in my Facebook group shared this website with us so I came to give it a look. I’m definitely loving the information. I’m book-marking and will be tweeting this to my followers! Wonderful blog and amazing style and design.|
I have fun with, lead to I discovered just what I was taking a look for. You have ended my four day lengthy hunt! God Bless you man. Have a great day. Bye
Great site you have here but I was curious if you knew of any message boards that cover the same topics discussed here? I’d really like to be a part of group where I can get suggestions from other knowledgeable people that share the same interest. If you have any recommendations, please let me know. Appreciate it!
I’m not sure where you are getting your information, but great topic. I needs to spend some time learning much more or understanding more. Thanks for great info I was looking for this information for my mission.
What’s Going down i’m new to this, I stumbled upon this I’ve found It absolutely helpful and it has helped me out loads. I am hoping to give a contribution & assist different customers like its aided me. Good job.
I merely have to share it with you that I am new to putting up a blog and extremely adored your information. Likely I am prone to remember your blog post . You definitely have excellent article information. Appreciate it for telling with us all of your website article
Have you ever considered about including a little bit more than just your articles? I mean, what you say is fundamental and everything. Nevertheless think of if you added some great visuals or videos to give your posts more, “pop”! Your content is excellent but with images and video clips, this website could undeniably be one of the most beneficial in its field. Wonderful blog!
Hello there, just became alert to your blog through Google, and found that it’s really informative. I’m going to watch out for brussels. I will appreciate if you continue this in future. Numerous people will be benefited from your writing. Cheers!
Hey, I think your website might be having browser compatibility issues. When I look at your website in Chrome, it looks fine but when opening in Internet Explorer, it has some overlapping. I just wanted to give you a quick heads up! Other then that, great blog!
You certainly should read through this document! I couldn’t feel it possibly till I look at it!
Great web site. Plenty of useful info here. I am sending it to several pals ans also sharing in delicious. And certainly, thanks in your sweat!
Pretty great post. I just stumbled upon your blog and wished to mention that I’ve truly enjoyed surfing around your blog posts. After all I’ll be subscribing in your rss feed and I am hoping you write once more very soon!
At this time it appears like Expression Engine is the preferred blogging platform available right now. (from what I’ve read) Is that what you’re using on your blog?
Great post, I conceive blog owners should larn a lot from this web blog its really user genial .
Helped me a lot, just what I was looking for : D.
What i don’t realize is if truth be told how you’re no longer actually much more neatly-favored than you may be now. You’re very intelligent. You know therefore considerably on the subject of this matter, made me in my opinion consider it from so many various angles. Its like women and men don’t seem to be fascinated until it is one thing to do with Woman gaga! Your own stuffs nice. All the time take care of it up!
Perfect just what I was searching for! .
It’s a pity you don’t have a donate button! I’d definitely donate to this superb blog! I guess for now i’ll settle for book-marking and adding your RSS feed to my Google account. I look forward to new updates and will talk about this site with my Facebook group. Talk soon!
I simply want to say I am newbie to blogs and certainly savored your web-site. Likely I’m planning to bookmark your website . You absolutely have incredible writings. Thanks for sharing your webpage.
First off I want to say fantastic blog! I had a quick question that I’d like to ask if you don’t mind. I was interested to find out how you center yourself and clear your head prior to writing. I have had a difficult time clearing my mind in getting my thoughts out there. I truly do take pleasure in writing however it just seems like the first 10 to 15 minutes tend to be lost just trying to figure out how to begin. Any ideas or tips? Thanks!
Μy spouse ɑnd I aƄsolutely love your blog
and find ɑ lоt of yօur post’s to be just աɦat I’m lоoking foг.
Do yօu offer guuest writers tοo wrdite ϲontent іn youг case?
I wouldn’tmind publishing a post оr elaborating onn a lot of tҺe subjects you write abouyt here.
Again, awesome weblog!
Havе ɑ look att my weblg … protein weight-loss