Thursday, May 16, 2013

Bluetooth Module Interfacing with Microcontroller

Bluetooth Module Interfacing with Microcontroller

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.


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.

Now connect the PC with Bluetooth module through RS232 over MAX232 or MAX233 level converter.
 
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.

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


 

No comments:

Post a Comment