in General

Goal:

send messages between the HM 11 BLE modules and my Raspberry PI 3 with its onboard BLE.

How:

Bluez comes installed with the raspbian distro.

Wiring is basic UART for connecting the HM 11 to the Arduino. In my case, I am using a Teensy 3.6 programmed using the Arduino IDE.

Use this serial proxy sketch for getting started. if you have Arduino IDE, open this file. Teensy serial ports are on 0 and 1. I kept it software serial so its easy to adapt for any other board by just changing the pins used for the UART.

Thats all you need to setup on the Arduino side. Everything should work now.

May be try a few AT commands. AT should give you OK if the module is used for the first time. if not OK+LOST which means that the module was connected previously which was lost. I would, either way, try the three AT commands just to be on the safer side. AT+RENEW, AT+RESET, AT.

If you make a PR request for adding a new line after every response from the HM 11 module, it would be great

Next step is to set up the raspberry pi, everything should be available directly up setting up an RPi with a new SD card. Be sure that you are using Raspberry Pi 3 and newer versions which have onboard BLE.

With Commandline:

With Python:

you should know the HM 11 Mac address. you should know it if you did it through command line. if not, you can do AT+ADDR? and add “:” after every two characters.

Install system dependencies, Go into the directory, Install the python dependencies. Before starting the python program, change the address that you want to connect. After you did that, start the program, it should send Hello world once to the device and wait for any messages. If you enter in the serial monitor, it will be printed out by the python program.

# sudo apt-get install build-essential python-pip3 git
# git clone https://github.com/akrv/BLEserialbridge
# cd BLEserialbridge
# pip3 install -r requirements.txt
# python3 serial_bridge.py
below is the AT Commands I sent since setting up the module.


Write a Comment

Comment

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.