Bluetooth® wireless technology is becoming a popular standard in the communication arena, and 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.

Here,I will show two examples of  hardware interface between Bluetooth wireless technology and UART.One example shows an interface between an  Bluetooth module and a PC via UART, and the other example shows an interface between a Bluetooth module and a  Microcontroller via UART.

I have a used WT32 bluetooth module.To know more click here.

WT32 Bluetooth module

Supply voltage at VCC  pin can vary between 1.8 V and 3.3 V. VCC and BTEN  combined to a single 3.3 V supply voltage.

Interface between an  Bluetooth module and a PC via UART

Now connect the PC with Bluetooth module through RS232 over MAX232 or MAX233 level converter.

Bluetooth module Connection with PC

Now,Test  the connection with hyperterminal or any serial port communication software .Here,I have used hyperterminal for test.

Hyperterminal settings

 

– 9600 baud
– no parity
– 8 databits
– no flowcontrol
– 1 stopbit

You can be change this settings via hyperterminal with WT32 bluetooth module command.See more in user guide.

Interface between an  Bluetooth module and a Microcontroller via UART

Connect the bluetooth module with microcontroller.Here,I have used PIC16F887 microcontroller.

Now,Test the Communication between PC and Microcontroller Device.You can use the following code that is written in C using mikroC PRO for PIC.

Source Code

char uart_rd;
void main() {
ANSEL  = 0;                     // Configure AN pins as digital
ANSELH = 0;
UART1_Init(9600);               // Initialize UART module at 9600 bps
Delay_ms(100);                  // Wait for UART module to stabilize
while (1) {                     // Endless loop
UART1_Write_Text(“TEST”);
Delay_ms(2000);                  // Wait

}
}

Output

Now,you can be see the Data “TEST” on Hyperterminal that will send by microcontroller via Bluetooth Module.

Hyperterminal

Comments on: "Bluetooth Module Interfacing with Microcontroller" (54)

  1. it s very interesting & useful site . I am final year student, studying Electronic & Telecommunication Engineering. now I am doing final year project. in my project i need to use bluetooth module to send the data from PIC to mobile phone. but it s very difficult to write a code for PIC micro controller for bluetooth connection. but i have a code for mobile part. can you help me to write a code for PIC part?

    if you have program code for bluetooth connection of PIC 16F877, can you send it to my email? please!!!

    bye.
    kajan

    • hi kajan…i m electronic and telecommunication student too..^^ can u give me the code for mobile part? and email it to me? wat application u do?

      • hey dude i want to send data from microcontroller to mobile phone via bluetooth module ( iam using atmega 128 (AVR MICROCONTROLLER ) and hc-05 bluetooth module…….. pls help me how to do that… pls reply fast am out of time

    • hi kajan and ting.

      i also did the same application and concept. my apps need to use bluetooth module to send the data from PIC to mobile phone.

      can we share the our idea and source?

    • hey bro help me ” i want to send data from microcontroller to mobile phone via bluetooth module ( iam using atmega 128 (AVR MICROCONTROLLER ) and hc-05 bluetooth module…….. pls help me how to do that… pls reply fast am out of time

    • hi kajan…i m electronic student ..can u give me the code ? and email it to me? wat application u do?

  2. Hi,

    Where did you buy the WT-32 module ?

  3. See this site: http://www.sparkfun.com/products/8952
    You can buy from there.

  4. jignesh said:

    if i used bluetooth module and microcontroller by which we connect any pc(with blue tooth dongle) aor any mobile than which service is provided by this or how can i set my choosen service because there are something 7 service in whic file exchange,object exchange,fax etc. are involed

  5. jignesh said:

    which is compatible microcontroller with this module?

  6. Choose bluetooth serial port service.See this link http://www.geekzone.co.nz/content.asp?contentid=1286

    And any serial port supported microcontroller is compatible with this module.

  7. hello.
    i wanted to know more about interfacing bluetooth module & microcontroller,as i am using it in my project.

    can you please send me detail about the module & the controller which can be used for such a purpose ?
    what are the devices that is needed to achieve such task?

  8. ENgg . StuDent said:

    Hello.
    i want to know more about “interfacing of Bluetooth devices with controller,”
    as i wanted to use it in my final year project ;
    where i have to use receiver-micro controller to capture image and transfer it via Bluetooth to transmitter-micro controller.

  9. Nilesh Patel said:

    Hellow.
    i want to know more about “interfacing of Bluetooth devices with controller,”
    my input data rate is 8kb/s can bluetooth is transmmit this file through microcontroller….
    which controller can i use……also give me code

  10. HI!!!

    i have the same problem with this other student above,,, but i will be using
    PIC16F690???
    CAN U HELP ME??

  11. Anonymous said:

    sir?? can i ask???what kind of UART did you use?? where can i buy it???

  12. i want to interface an android OS based phone to bluetooth can u guide?

  13. SIR I NEED HOW TO INTERFACE BLUETOOTH TO AT89S52 FOR MY PROJECT PLEASE HELP US……..

  14. Hellow i’m a student in studying electronic too,,
    can u explain with me how to know the ptotocol in bluetooth done..?
    please help me,, ^_^

  15. how to interface BC417 (bluetooth module) with AVR microcontroller???

  16. Hi manju here ,where is the socket open() listen() and close() functions here you just written a UART program please help me.

  17. Hello ,

    I have a doubt,I want to send a trigger message from 8051 via bluetooth to a pc.I want to do this wirelessly ,I mean my pc is bluetooth enabled and i dont want to use RS -232.I want to have a bluetooth (usb dongle connected to my hardware section)and this should send to trigger signal across to my pc.

    do I need some PIC ic? how will the interfacing be done?can you give me some guidelines?

    Thanks!!
    Arora

  18. fazil siddique said:

    hello,
    am doing a project abt “device control using bluetooth”..am using microcontroller at89c51 and bluetooth module rn 42..i wana interface it via symbian os mobile..can i get the layout design for our circuit..?i din found the spice file for bluetooth module..wat are the steps in interfacing bluetooth module with microcontroller via mobile..

  19. hi kanj i am also student of electronics and communication engineer i am completed this project but now i want mobile part programming so can you please send me this code in my email sagarnena@yahoo.com. i am controling home applinces with laptop bluetooth

  20. Thanks a lot for the very Interesting and helpful post !
    I tried it out with a cheap chinese bluetooth module.
    Check it out here . http://wp.me/pIPr6-23

  21. by sending data with only 9600 baudrate by controller ,can we directly receive data on pc by bluetooth device or
    there are specific protocol for bluetooth interface with controller.
    please tell me if any have worked on it.

  22. hi kajan, ting and kang.

    i also did the same application and concept. my apps need to use andriod mobile phone to sent data to bluetooth module, then send the data to PIC.

    can we share the our idea and source?

    using PIC 16F877A, can you send it to my email? please!!!

  23. can you post a demo on how to interface the bluetooth module to a microcontroller. .??

  24. Kishore Pegu said:

    sir,i want to interface a moblile with microcontroller using bluetooth module.which module should be use for this?a message will be sent to the mobile via bluetooth.

  25. sir,i am working on audio streming using ivt bluetooth modual.i am using atmega32 microcontroller.i want to know bluetooth program code for receive mp3 data file.

  26. hey guys i want to send data from microcontroller to mobile phone via bluetooth module ( iam using atmega 128 (AVR MICROCONTROLLER ) and hc-05 bluetooth module…….. pls help me how to do that… pls reply fast am out of time

  27. Hi,
    We are using HC-05 low cost bluetooth module for our project but finding difficult in configuring the module at the hyperterminal. its not giving any response for the AT commands to chnage name ,password etc.we tried using the TTL to RS232 convertor also but it dint work out.the module is getting detected and paired by its default password and name.Please help .

  28. spandana said:

    sir i want to know how to test a bluetooth chip

  29. i wonder one thing, the basics, as a foreigner to the concepts here and want to ask plainly those;
    1- does a processor, or micro controller unit, as itself connect to the circuit unit that sends em-waves wirelessly via bluetooth or wi-fi tech to a mobile phone or another device?
    2-on a circuit does a unit called “bluetooth module” has to have a micro controller of its own other than the one it will be connected to or it is just an emitter or antenna that is wired to the micro controller? same question for wifi modules and 3g modules?
    3-and i wonder if two or three of this wireless connectivity will be used in one circuit do they connect to a mcu as central or with their own microcontroollers on themselves they can co-operate, and is this case must?
    simply what is the minimal material-device requirements to build a circuit with a processor with bluetooth and wi-fi connection, while saying minimal i do not imply any economical context, technical i imply. thanks.

  30. Hi would you mind letting me know which hosting company you’re utilizing? I’ve loaded your blog in
    3 completely different web browsers and I must say this blog loads a lot faster then most.
    Can you suggest a good hosting provider at a honest price?
    Cheers, I appreciate it!

  31. Yes it is possible to communicate an Android application with a PIC microcontroller via Bluetooth also. Check that post here every thing written so descriptive and i test the code, they are given, it simulate in proteus.

    http://www.nbcafe.in/interfacing-android-with-pic-microcontroller-via-bluetooth/

  32. Anonymous said:

    i want to send the commands from my android device to micro controller through blue tooth HC05.is it necessary to write a code for blue tooth device.

    • Anonymous said:

      Yes you have to write code in the micro controller to receive data. It is a pretty simple code which just receives the data using UART/any other way.

  33. Can you please tell me how to do communication between two arduino and at what speed can we transfer.

  34. […] Bluetooth Module Interfacing with Microcontroller | – Mar 20, 2011 · Hello , I have a doubt,I want to send a trigger message from 8051 via bluetooth to a pc.I want to do this wirelessly ,I mean my pc is bluetooth enabled and …… […]

  35. Nice explanation. Looking forward more such pots on other microcontrollers like AVR, PIC and Arduino

  36. can i directly connect the abtum 20 blutooth module to pc having windows 7 os???
    If i connect it to pc, it gives OK response during only power ON.not for further commond sequence.

  37. education system. where we want the outcomes only. 😛

  38. sanjana manoj said:

    hi.
    ec student here again.
    i wanted to know if you could help me interface pic16f877a ‘s output to a HC05 bluetooth module using uart.
    we used the pic with an ultrasonic sensor to calculate distance and we want to relay that information onto the HC05 so the visually impaired can get the information wirelessly.
    it would be great if you could help us out.
    -sanjana.

  39. hello. how i connect bluetooth module to pic? can u give me an example of code?

  40. Anonymous said:

    sory guys, am new in this discussion but i need help from u. i use micro pro compiler, i want to to automate the home appliances with bluetooth module, when i write the letter as i commanded in the code, no response. the codes are as bellow
    sbit LCD_RS at RD2_bit;
    sbit LCD_EN at RD3_bit;
    sbit LCD_D4 at RD4_bit;
    sbit LCD_D5 at RD5_bit;
    sbit LCD_D6 at RD6_bit;
    sbit LCD_D7 at RD7_bit;

    sbit LCD_RS_Direction at TRISD2_bit;
    sbit LCD_EN_Direction at TRISD3_bit;
    sbit LCD_D4_Direction at TRISD4_bit;
    sbit LCD_D5_Direction at TRISD5_bit;
    sbit LCD_D6_Direction at TRISD6_bit;
    sbit LCD_D7_Direction at TRISD7_bit;

    ANSELB;
    char x;
    #define FAN PORTB.F0
    #define MOTOR PORTB.F1
    #define ON 1;
    #define OFF 0;

    void main()
    {

    ANSELB=0;
    lcd_init();
    lcd_cmd(_lcd_cursor_off);
    lcd_cmd(_lcd_clear);
    lcd_out(1,2,”automater”);
    lcd_out(2,2,”welcome”);
    TRISB=0;
    UART1_Init(19200);
    delay_ms(100);

    while(1)
    {
    if(UART1_Data_ready()==1)
    {
    x=UART1_read();
    UART1_write(x);
    lcd_cmd(_lcd_clear);
    }
    if(x==’A’)
    {
    FAN=ON;
    UART1_write(12);
    lcd_cmd(_lcd_clear);
    lcd_out(1,1,”fan is on”);
    }
    else if(x==’C’)
    {
    FAN=OFF;
    UART1_write(12);
    lcd_cmd(_lcd_clear);
    lcd_out(1,2,”fan is off”);
    }
    else if(x==’B’)
    {
    MOTOR=ON;
    UART1_write(12);
    lcd_cmd(_lcd_clear);
    lcd_out(1,2,”motor is on”);
    }
    else if(x==’D’)
    {
    MOTOR=OFF;
    UART1_write(12);
    lcd_cmd(_lcd_clear);
    lcd_out(1,3,”motor is off”);
    }
    x=’\0′;
    }
    }

  41. rubben maduhu said:

    am rubbe. the help seeker above

  42. Jay kishan Singh said:

    Loved it !

Leave a reply to murlidharshenoy Cancel reply