Ads

miércoles, 4 de julio de 2018

Bluetooth module HC - 06 on Raspberry Pi

On my last blog I published an easy way to use your smartphone as a GPS module using a Bluetoth module to communicate with different boards, but I realize that some people doesn´t know how to configure and connect the Raspberry Pi to the HC - 06 module. So, in this blog that´s what we are going to do.

Materials:
  1. Raspberry PI
  2. HC - 06 Bluetooth module
  3. Wires
  4. Computer with ssh connection program.

Buy here:

Process: 

First we are going to configure our UART port on our Rasberry Pi, this is because by default raspbian has configured its baud rate to 115200 bps and our module use 9600 bps.

Following some instructions from Miguel Bringerg and his very useful blogs I did it in this way:

NOTE: The instruction to open and edit files is: sudo nano -file direction-
  1. First, we are going to open the file /boot/cmdline.txt , and change the options console and kgbdoc  from 115200 bps to 9600 bps.
  2. Now we go to a second file /etc/inittab and also change the property of the port that has 115200 bps to 9600 bps.
All we have to do next is to write some example code, I use the pyserial library from python, you can install it using the next instruction:

sudo pip install pyserial

You can find more information about this library in: 

In this example I configured my serial port and then I read some data that came with letters to detect the variable that is receiving the module:

NOTE: Your device might be called ACM0 intead of AMA0, to check the devices connected to you board use ls /dev/tty*

The right connection of the module is shown next:



Comment and share if you find this useful.

No hay comentarios:

Publicar un comentario

Understanding I2C: The Versatile Communication Protocol for Connected Devices

In the fast-paced world of technology, seamless and efficient communication between electronic components is vital. As devices become increa...