pythonarduinobluetoothpyserialhm-10

Arduino and pyserial and ble


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)


Solution

  • 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:

    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.