If you have problem about testing your deivce's ble function. the project will Help you test your device that contains BLE function.
A simple tool project with serial-tool communication using your Raspberry PI and python. the tool applied gatt and serial interface to communicate with your device.
These have some tools you need to pick up.
-
Raspberry Pi 3/4 *1
-
Serial devices *2
-
cable *1
in your Raspberry
sudo pip3 install gatt
sudo apt-get install python3-dbus
sudo apt-get install blueman
and please following gatt-python.
First time you need to connect your DUT by raspberryPi bluetoothctl
These instructions step : RPi connect to DUT with system
- open terminal
sudo bluetoothctl
scan on
scan off
connect [MACaddress]
- [enter passkey] or not
- reboot your system and devices.
- open this project
- cd RPi-GATT
python3 main.py
previous showing the uuids information when connect to DUT.
you can take the uuids information to write into the ProjectUUID.py
file.
def device1(self):
self.service = '0000xxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
self.chara1 = '0000xxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
self.chara2 = '0000xxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
self.chara3 = '0000xxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
the format of communication : ------ASCII------
- choose your project uuid
b0 p [project]
- connect to yourdevice
b0 c [macaddress]
- enter data to characteristic
b0 w [characteristic][data]
the project I reference gatt-python there contains example code and GATT SDK.