Bluetooth module HC-05 interfaced with PIC: great latency and wrong data

bluetoothpicuart

I am using a PIC16f887 oscillating on an external crystal of 20MHZ

The code is simple

void main() {
    uart_init();
    while (1) {
         uart_puts("test for bluetooth connection", 0);
         uart_puts("success", 0);
    }
}

The Bluetooth module is on 9600 Baud rate.

And I've used both BlueTerm on Android and HyperTerminal on PC, all I got was either no data at all or truncated data for only serveral seconds before it went freezed again.

I wanna know what's causing this?
Is it because the Bluetooth module is broken in some way?

Best Answer

Connect the module to a computer with a FTDI or similar cable. Power the module on. Then connect pin 34 to VCC. This will put the module into command mode at 9600 baud. If you connect the pin before the module powers on, it will be at 38400 baud.

Use hyperterminal to connect to the module over the correct COM port. Make sure your terminal application is set to send LF+CR at the end of a line. Send the command "AT" and you should get a reply of "OK". Next, send the command "AT+INIT" and now the module should be setup for bluetooth communication.