How to connect to bluetooth 4.0 / bluetooth LE devices from Mac?

Is it possible to set up a bluetooth LE device as a serial port and use PySerial? Bluetooth 4 devices are not displayed according to the Bluetooth system settings.

In terms of python modules, pybluez cannot be installed on Mac, and I don't think lightblue supports bluetooth 4. The only module I found is pyble, which I cannot work with.

https://pypi.python.org/pypi/pyble/0.02

The sample code gives me the error "no module named bluetooth" on the code line:

from bluetooth import bluetooth

+3


source to share


1 answer


Most BLE devices do not implement the Serial Port Profile available in Bluetooth 2.1.

You can get modules that expose the serial port to the microcontroller, but on the bluetooth side this maps to a GATT attribute that is written / read to send and receive data from the microcontroller.



Other BLE sensor devices such as heart rate monitors etc. do not have serial port functionality, they just expose the GATT attributes.

The library you linked appears to be designed around the TI cc2540 module on the PC (for example, it mentions "COM3:") - recent Macs have built-in BLE support, exposed by the IOBluetooth framework, but as you say lightblue only supports legacy profiles ...

+3


source







All Articles