Connecting a PIC to a Bluetooth module opens up a lot of possibilities for robotics. Here is the test setup for Squid. In an earlier post, I was using a 4Mhz crystal I switched to a 20Mhz for the PICs clock. In the image below, I’m using a JY-MCU Bluetooth module the HC-5 version. The Bluetooth module is connected to the PICs USART pins with two 10k ohm resistors to divide the PICs TX voltage from 5 volt to 2.5 volt. A safe level for the Bluetooth module while still a high enough voltage to be a logic level 1.
![](https://cdn.hackaday.io/images/3794751527519979767.png)
In “int main” I added the following two lines of code to test the Bluetooth connection.
Usart_write(“b”);
_delay_ms(1000);
This will transmit a “b” every second, and since the interrupt is enabled, any characters sent to the Squid will mirror back to the computer that is connected through Bluetooth to the PIC.
![](https://cdn.hackaday.io/images/6080471527520047526.png)
Next, we need to “pair” the Bluetooth to a computer. Power up the test setup, and on the computer, go to the Bluetooth devices. Highlight HC-05 and click “pair”.
![](https://cdn.hackaday.io/images/3658251527520092878.png)
Enter the passcode for the Bluetooth module in this case “1234” and click “NEXT”.
![](https://cdn.hackaday.io/images/4272831527520137745.png)
And we are connected.
![](https://cdn.hackaday.io/images/7053141527520192193.png)
Next, we need to find our COM port. Open Bluetooth devices and click “Bluetooth Settings” and “COM ports”. There will be two COM ports--an incoming and an outgoing.
![](https://cdn.hackaday.io/images/3759791527520237592.png)
I’m using Putty as a terminal, so the next step is to open Putty and click the serial radio button, enter the outgoing com port and BUAD rate (speed).
![](https://cdn.hackaday.io/images/9296801527520316549.png)
If Putty fails to connect, try opening Putty and connecting to the incoming Com port then close Putty, open Putty again, and then try connecting to the outgoing COM port. I ran into this problem…I’m not sure why, but it worked.
Once connected, the below screen should appear. A “b” is being received every second, and every key I press is being mirrored back…SUCCESS!!!
![](https://cdn.hackaday.io/images/3174921527520414717.png)
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.