Closed Thm14 closed 1 month ago
What happens when you run the service_explorer.py
example with this device?
Does it work if you use 128-bit UUIDs on the arduino instead of 16-bit UUIDs?
Dlech thanks for your comment!
I tried both UUID settings.
When using service_explorer.py, the message is:
usage: service_explorer.py [-h] (--name
You need to provide the correct command line parameters so that the script will connect to your device.
I see, I'm new to python, I don't know much about the nomenclature, I understand that it should be: python service_explorer.py--IMU--7E:36:B3:47:6F:DA ?? which would be the name: IMU and the address: 7E:36:B3:47:6F:DA, I don't know if it is with those hyphens, if it has a space or not, or if some other input parameter is missing to perform the scan...
python service_explorer.py--IMU--7E:36:B3:47:6F:DA ??
python service_explorer.py --address 7E:36:B3:47:6F:DA
or
python service_explorer.py --name IMU
Hello!!!, I was able to run the code "service explorer", it gives the following results:
C:\Users\Tomás Herrera Muño\Dropbox\PhD PUC\Tesis\Proyecto Towing Tank\Arduino\Códigos\Nano 33 BLE>python service_explorer.py --address 7E:36:B3:47:6F:DA
2023-07-31 09:28:30,443 __main__ INFO: starting scan...
2023-07-31 09:28:30,751 __main__ INFO: connecting to device...
2023-07-31 09:28:31,229 __main__ INFO: connected
2023-07-31 09:28:31,229 __main__ INFO: [Service] 00001800-0000-1000-8000-00805f9b34fb (Handle: 1): Generic Access Profile
2023-07-31 09:28:31,245 __main__ ERROR: [Characteristic] 00002a00-0000-1000-8000-00805f9b34fb (Handle: 2): Device Name (read), Error: Could not read characteristic handle 2: Unreachable
2023-07-31 09:28:31,246 __main__ ERROR: [Characteristic] 00002a01-0000-1000-8000-00805f9b34fb (Handle: 4): Appearance (read), Error: Not connected
2023-07-31 09:28:31,247 __main__ INFO: [Service] 00001801-0000-1000-8000-00805f9b34fb (Handle: 6): Generic Attribute Profile
2023-07-31 09:28:31,247 __main__ INFO: [Characteristic] 00002a05-0000-1000-8000-00805f9b34fb (Handle: 7): Service Changed (indicate)
2023-07-31 09:28:31,248 __main__ ERROR: [Descriptor] 00002902-0000-1000-8000-00805f9b34fb (Handle: 9): Client Characteristic Configuration, Error: Not connected
2023-07-31 09:28:31,248 __main__ INFO: [Service] 00001101-0000-1000-8000-00805f9b34fb (Handle: 10): Serial Port
2023-07-31 09:28:31,249 __main__ ERROR: [Characteristic] 00002101-0000-1000-8000-00805f9b34fb (Handle: 11): Vendor specific (read,notify), Error: Not connected
2023-07-31 09:28:31,250 __main__ ERROR: [Descriptor] 00002902-0000-1000-8000-00805f9b34fb (Handle: 13): Client Characteristic Configuration, Error: Not connected
2023-07-31 09:28:31,251 __main__ ERROR: [Characteristic] 00002102-0000-1000-8000-00805f9b34fb (Handle: 14): Vendor specific (read,notify), Error: Not connected
2023-07-31 09:28:31,251 __main__ ERROR: [Descriptor] 00002902-0000-1000-8000-00805f9b34fb (Handle: 16): Client Characteristic Configuration, Error: Not connected
2023-07-31 09:28:31,252 __main__ ERROR: [Characteristic] 00002103-0000-1000-8000-00805f9b34fb (Handle: 17): Vendor specific (read,notify), Error: Not connected
2023-07-31 09:28:31,252 __main__ ERROR: [Descriptor] 00002902-0000-1000-8000-00805f9b34fb (Handle: 19): Client Characteristic Configuration, Error: Not connected
2023-07-31 09:28:31,253 __main__ INFO: disconnecting...
2023-07-31 09:28:31,261 __main__ INFO: disconnected
Apparently it's not reading the characteristic, and that's why many errors come out later...
You are supposed to pay the Bluetooth SIG if you want your own 16-bit UUID. The 16-bit UUIDs you are using may be blocked by Windows. For both of these reasons, I have suggested using 128-bit UUIDs instead.
I tried that and now the error is another: in start_notify await winrt_char.write_client_characteristic_configuration_descriptor_async(OSError: [WinError -2147467260] Operación anulada
It looks like the device is disconnecting before it finishes enumerating the characteristics. I would log Bluetooth packets to see what is going on. Probably something misconfigured on the Arduino or a Windows caching issue.
Finally I was able to measure, they were the UUID of the IMU that the board brings, the correct ones for my ARDUINO NANO 33 BLE board are:
// Declare a BLE service with UUID:
BLEService IMUservice("19B10010-E8F2-537E-4F6C-D104768A1214");
// Declare two BLE characteristics for the accelerometer and gyroscope data, both with UUIDs:
BLECharacteristic accelData("19B10011-E8F2-537E-4F6C-D104768A1214", BLERead | BLENotify, 20);
BLECharacteristic gyroData("19B10012-E8F2-537E-4F6C-D104768A1214", BLERead | BLENotify, 20);
bluetoothctl -v
) in case of Linux:Description
I need to measure the accelerations of a moving object. For this, I am using the Arduino Nano 33, which has the integrated sensor IMU LSM9DS1, so I am trying to read and save the accelerations from the sensor and be able to keep them in the computer, all through communication BLE, for this, I am using a code that I found on the web (I attach them below, credits to: Antony García González from PanamaHitek, [https://panamahitek.com/comunicacion-inalambrica-entre-arduino-y-python-usando-ble/]) the problem is that I get an error: raise BleakError(f"Characteristic {char_specifier} not found!") bleak.exc.BleakError: Characteristic 00002011-0000-1000-8000-00805f9b34fb not found!
The first thing I thought was that the UUID must be misspelled or it had to be another, I used two applications on my cell phone: nRF Connect and BLE Scanner to know the characteristics, and in my opinion, the numbers are fine (they are the same as the script), but the error continues
What I Did
Logs
Include any relevant logs here.
Python script: