Arduino and pyserial and ble

665 Views Asked by At

Actually i can send data from pyhton(pyserial) to arduino through cable,but i want to do that with hm-10, normally bluetooth module which is the hc-05 ,hc-06 u can find port, With wire or wirelles(hc-05) com7 port:

arduino = serial.Serial("COM7", baudrate=9600,timeout=.1)"

But hm-10 is ble. what i need to write instead of com7? or how can i solve that problem? (windows 10)

1

There are 1 best solutions below

0
ukBaz On BEST ANSWER

The pySerial library will not work with the HM-10 module because the module uses Bluetooth Low Energy (rather than Bluetooth Classic).

This means you will have to create a GATT Client to interact with a BLE GATT Server. Typically you would have the Arduino in the Peripheral role (server) and the Windows PC in the Central role (Client).

A quick internet search suggests that the GATT service on HM-10 module has the following values:

  • Service UUID: 0000FFE0-0000-1000-8000-00805F9B34FB
  • Characteristic UUID: 0000FFE1-0000-1000-8000-00805F9B34FB

You can check this using a generic Bluetooth Low Energy scanning and exploration tool such as nRF Connect

There are a limited number of Python BLE Central libraries with Bleak probably being the pick of the bunch and has good examples of how to use it.