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.
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:
Below is my notes. If I recall either Android or the RPI didn't like the 6 digit PIN
— Greg Bray (@GBrayUT) February 21, 2019
//Setup HM-10 BLE module (See datasheet-HM-10-BLE.pdf)
//Use serial to send OK (no line ending)
//AT+PASS? to view pin (currently 001122)
//AT+TYPE? 2= bond with pin, use AT+TYPE0 to disable
With Python:
you should know the HM 11 Mac address. you should know it if you did it through
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
Hello,
the python script works verry well with my HM10 Bluetooth module (BLE).
But on my screen i receive only 20 charaters per line.
How can i change the script that ic see more charaters perline ?
Thank you
Hi,
The module has a proprietary protocol that allows you to send only 20 chars.
It prints what is sent over the air.
if you want to print all char in a single line, you should read all the messages and print them as a single string.