Skip to content

Instantly share code, notes, and snippets.

@andypiper
Last active January 24, 2022 18:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save andypiper/df187c4dcf71cf05f9c87bf71a22a8a3 to your computer and use it in GitHub Desktop.
Save andypiper/df187c4dcf71cf05f9c87bf71a22a8a3 to your computer and use it in GitHub Desktop.
experimenting with BLE and LEGO Boost
LEGO Move Hub
8E552B7A-1B9E-4F4D-A0AE-7D585F784B73
advertisementData: ["kCBAdvDataIsConnectable": 1, "kCBAdvDataTxPowerLevel": 0, "kCBAdvDataLocalName": LEGO Move Hub]
00001623-1212-EFDE-1623-785FEABCD123 []
00001624-1212-EFDE-1623-785FEABCD123 ["read", "writeWithoutResponse", "write", "notify"] <0f00043c 01140002 00000002 000000> ["Client Characteristic Configuration <0100>"]
Notification Log:
1502201043.29111 - 00001624-1212-EFDE-1623-785FEABCD123 isNotifying: true
1502201043.32371 - 00001624-1212-EFDE-1623-785FEABCD123 Notify: <0f000401 01260000 00001000 000010>
1502201043.32507 - 00001624-1212-EFDE-1623-785FEABCD123 Notify: <0f000402 01250000 00001000 000010>
1502201043.33828 - 00001624-1212-EFDE-1623-785FEABCD123 Notify: <0f000437 01270000 00001000 000010>
1502201043.34062 - 00001624-1212-EFDE-1623-785FEABCD123 Notify: <0f000438 01270000 00001000 000010>
1502201043.34281 - 00001624-1212-EFDE-1623-785FEABCD123 Notify: <09000439 02270037 38>
1502201043.35098 - 00001624-1212-EFDE-1623-785FEABCD123 Notify: <0f000432 01170000 00001000 000010>
1502201043.35644 - 00001624-1212-EFDE-1623-785FEABCD123 Notify: <0f00043a 01280000 00001000 000002>
1502201043.36009 - 00001624-1212-EFDE-1623-785FEABCD123 Notify: <0f00043b 01150002 00000002 000000>
1502201043.36704 - 00001624-1212-EFDE-1623-785FEABCD123 Notify: <0f00043c 01140002 00000002 000000>
1502201043.37618 - 00001624-1212-EFDE-1623-785FEABCD123 isNotifying: true
1502201043.38102 - 00001624-1212-EFDE-1623-785FEABCD123 Notify: <0f000401 01260000 00001000 000010>
1502201043.38454 - 00001624-1212-EFDE-1623-785FEABCD123 Notify: <0f000402 01250000 00001000 000010>
1502201043.38882 - 00001624-1212-EFDE-1623-785FEABCD123 Notify: <0f000437 01270000 00001000 000010>
1502201043.41062 - 00001624-1212-EFDE-1623-785FEABCD123 Notify: <0f000438 01270000 00001000 000010>
1502201043.41372 - 00001624-1212-EFDE-1623-785FEABCD123 Notify: <09000439 02270037 38>
1502201043.41595 - 00001624-1212-EFDE-1623-785FEABCD123 Notify: <0f000432 01170000 00001000 000010>
1502201043.42919 - 00001624-1212-EFDE-1623-785FEABCD123 Notify: <0f00043a 01280000 00001000 000002>
1502201043.43299 - 00001624-1212-EFDE-1623-785FEABCD123 Notify: <0f00043b 01150002 00000002 000000>
1502201043.43679 - 00001624-1212-EFDE-1623-785FEABCD123 Notify: <0f00043c 01140002 00000002 000000>
# based on https://github.com/JorgePe/BOOSTreveng (thank you @JorgePe!!)
sudo gatttool -i hci0 -b 00:16:53:A3:C2:D0 --char-write-req --handle=0x0e --value=0c0081391109000F32647f03
# run A+B motors for 3.5 seconds
sudo gatttool -i hci0 -b 00:16:53:A3:C2:D0 --char-write-req --handle=0x0e --value=0c0081361109000F32647f03
# run C motor for 3.5 seconds
pi@raspberrypi:~ $ sudo hcitool lescan
LE Scan ...
4D:FD:ED:67:BA:DE (unknown)
00:16:53:A3:C2:D0 (unknown)
00:16:53:A3:C2:D0 LEGO Move Hub
^Cpi@raspberrypi:~ $ gatttool
Usage:
gatttool [OPTION...]
Help Options:
-h, --help Show help options
--help-all Show all help options
--help-gatt Show all GATT commands
--help-params Show all Primary Services/Characteristics arguments
--help-char-read-write Show all Characteristics Value/Descriptor Read/Write arguments
Application Options:
-i, --adapter=hciX Specify local adapter interface
-b, --device=MAC Specify remote Bluetooth address
-t, --addr-type=[public | random] Set LE address type. Default: public
-m, --mtu=MTU Specify the MTU size
-p, --psm=PSM Specify the PSM for GATT/ATT over BR/EDR
-l, --sec-level=[low | medium | high] Set security level. Default: low
-I, --interactive Use interactive mode
pi@raspberrypi:~ $ sudo gatttool -i hci0 -b 00:16:53:A3:C2:D0 --char-write -a 0x003d -n 01010164
pi@raspberrypi:~ $ sudo gatttool -i hci0 -b 00:16:53:A3:C2:D0 --char-write -a 0x003d -n 01010164
pi@raspberrypi:~ $ sudo gatttool -i hci0 -b 00:16:53:A3:C2:D0 --char-write -a 0x003d -n 00010164
pi@raspberrypi:~ $ sudo gatttool -i hci0 -b 00:16:53:A3:C2:D0 --char-write -a 0x003d -n 02010164
pi@raspberrypi:~ $ sudo gatttool -i hci0 -b 00:16:53:A3:C2:D0 --char-write -a 0x003d -n 03010164
pi@raspberrypi:~ $ sudo gatttool -i hci0 -b 00:16:53:A3:C2:D0 --primary
attr handle = 0x0001, end grp handle = 0x0004 uuid: 00001801-0000-1000-8000-00805f9b34fb
attr handle = 0x0005, end grp handle = 0x000b uuid: 00001800-0000-1000-8000-00805f9b34fb
attr handle = 0x000c, end grp handle = 0x000f uuid: 00001623-1212-efde-1623-785feabcd123
pi@raspberrypi:~ $ sudo gatttool -i hci0 -b 00:16:53:A3:C2:D0 --char-write -a 0x003d -n 04010164
pi@raspberrypi:~ $ sudo gatttool -i hci0 -b 00:16:53:A3:C2:D0 --char-write -a 0x003d -n 05010164
pi@raspberrypi:~ $ sudo gatttool -i hci0 -b 00:16:53:A3:C2:D0 --char-write -a 0x003d -n 06010164
pi@raspberrypi:~ $ sudo gatttool -i hci0 -b 00:16:53:A3:C2:D0 --char-write -a 0x003d -n 07010164
pi@raspberrypi:~ $ sudo gatttool -i hci0 -b 00:16:53:A3:C2:D0 --char-write -a 0x003d -n 08010164
pi@raspberrypi:~ $ sudo gatttool -i hci0 -b 00:16:53:A3:C2:D0 --char-write -a 0x003d -n 0A010164
pi@raspberrypi:~ $ sudo gatttool -i hci0 -b 00:16:53:A3:C2:D0 --char-write -a 0x003d -n 0A010100
pi@raspberrypi:~ $ sudo gatttool -i hci0 -b 00:16:53:A3:C2:D0 --char-write -a 0x003d -n 01020164
pi@raspberrypi:~ $ sudo gatttool -i hci0 -b 00:16:53:A3:C2:D0 -I
[00:16:53:A3:C2:D0][LE]>
[00:16:53:A3:C2:D0][LE]>
[00:16:53:A3:C2:D0][LE]>
[00:16:53:A3:C2:D0][LE]> quit
pi@raspberrypi:~ $ sudo gatttool -i hci0 -b 00:16:53:A3:C2:D0 -I
[00:16:53:A3:C2:D0][LE]> connect
Attempting to connect to 00:16:53:A3:C2:D0
Connection successful
[00:16:53:A3:C2:D0][LE]> primary
attr handle: 0x0001, end grp handle: 0x0004 uuid: 00001801-0000-1000-8000-00805f9b34fb
attr handle: 0x0005, end grp handle: 0x000b uuid: 00001800-0000-1000-8000-00805f9b34fb
attr handle: 0x000c, end grp handle: 0x000f uuid: 00001623-1212-efde-1623-785feabcd123
[00:16:53:A3:C2:D0][LE]> char-desc
handle: 0x0001, uuid: 00002800-0000-1000-8000-00805f9b34fb
handle: 0x0002, uuid: 00002803-0000-1000-8000-00805f9b34fb
handle: 0x0003, uuid: 00002a05-0000-1000-8000-00805f9b34fb
handle: 0x0004, uuid: 00002902-0000-1000-8000-00805f9b34fb
handle: 0x0005, uuid: 00002800-0000-1000-8000-00805f9b34fb
handle: 0x0006, uuid: 00002803-0000-1000-8000-00805f9b34fb
handle: 0x0007, uuid: 00002a00-0000-1000-8000-00805f9b34fb
handle: 0x0008, uuid: 00002803-0000-1000-8000-00805f9b34fb
handle: 0x0009, uuid: 00002a01-0000-1000-8000-00805f9b34fb
handle: 0x000a, uuid: 00002803-0000-1000-8000-00805f9b34fb
handle: 0x000b, uuid: 00002a04-0000-1000-8000-00805f9b34fb
handle: 0x000c, uuid: 00002800-0000-1000-8000-00805f9b34fb
handle: 0x000d, uuid: 00002803-0000-1000-8000-00805f9b34fb
handle: 0x000e, uuid: 00001624-1212-efde-1623-785feabcd123
handle: 0x000f, uuid: 00002902-0000-1000-8000-00805f9b34fb
[00:16:53:A3:C2:D0][LE]> char-read-hnd 0x000e
Characteristic value/descriptor: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[00:16:53:A3:C2:D0][LE]> char-read-hnd 0x0001
Characteristic value/descriptor: 01 18
[00:16:53:A3:C2:D0][LE]> char-write-cmd 003d 01010180
[00:16:53:A3:C2:D0][LE]> char-read-hnd 0x0001
Characteristic value/descriptor: 01 18
[00:16:53:A3:C2:D0][LE]> char-write-cmd 003d 010101
[00:16:53:A3:C2:D0][LE]> char-write-cmd 003d 01010180
[00:16:53:A3:C2:D0][LE]> disconnect
[00:16:53:A3:C2:D0][LE]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment