Updated 2023-10-02 !
A Bluetooth Beacon, could be a RuuvuTag, is a device that You don't have to pair with, You just scan and receive the data that they are transmitting.
Start with checking that Your BT interface is working, in a terminal window, typing
hciconfig
Check what is in Your neighbourhood typing
sudo bluetoothctl
And within the started application type scan on and something like this will be showed
Agent registered
[bluetooth]# scan on
Discovery started
[CHG] Controller B8:XX:XX:90:2E:06 Discovering: yes
[NEW] Device D0:XX:XX:EF:55:D1 D0-03-4B-EF-55-D1
[NEW] Device 13:XX:XX:71:58:36 13-23-55-71-58-36
[NEW] Device 5D:XX:XX:DF:BB:61 5D-96-57-DF-BB-61
[NEW] Device 53:XX:XX:CD:86:0E 53-38-53-CD-86-0E
[NEW] Device 71:XX:XX:05:5E:2F 71-41-58-05-5E-2F
[NEW] Device 59:XX:XX:7C:2E:D5 59-E2-66-7C-2E-D5
[NEW] Device F0:XX:XX:95:57:E5 F0-18-98-95-57-E5
[NEW] Device 4F:XX:XX:14:67:B8 4F-E6-42-14-67-B8
[NEW] Device D8:XX:XX:46:4F:80 Eve Energy AED9
[CHG] Device 71:XX:XX:05:5E:2F RSSI: -42
[NEW] Device C5:XX:XX:27:1D:0E Eve Room 4002
[NEW] Device C9:XX:XX:C7:AA:CB C9-EA-85-C7-AA-CB
[CHG] Device 59:XX:XX:7C:2E:D5 ManufacturerData Key: 0x004c
[CHG] Device 59:XX:XX:7C:2E:D5 ManufacturerData Value:
0c 0e 00 de 0f 6f 91 52 57 28 45 1a ed 22 68 74 .....o.RW(E.."ht
[CHG] Device D0:XX:XX:EF:55:D1 RSSI: -90
[CHG] Device 71:XX:XX:05:5E:2F ManufacturerData Key: 0x004c
[CHG] Device 71:XX:XX:05:5E:2F ManufacturerData Value:
0c 0e 00 de 0f 6f 91 52 57 28 45 1a ed 22 68 74 .....o.RW(E.."ht
[CHG] Device F0:XX:XX:95:57:E5 RSSI: -26
[CHG] Device F0:XX:XX:95:57:E5 RSSI: -38
[CHG] Device C9:XX:XX:C7:AA:CB ManufacturerData Key: 0x0499
[CHG] Device C9:XX:XX:C7:AA:CB ManufacturerData Value:
05 10 70 43 f8 c2 be 00 60 00 54 04 04 c4 f6 42 ..pC....`.T....B
1d 0e c9 ea 85 c7 aa cb ........
[bluetooth]# scan off
Discovery stopped
[bluetooth]# exit
[bluetooth]# scan on
Discovery started
[CHG] Controller B8:XX:XX:90:2E:06 Discovering: yes
[NEW] Device D0:XX:XX:EF:55:D1 D0-03-4B-EF-55-D1
[NEW] Device 13:XX:XX:71:58:36 13-23-55-71-58-36
[NEW] Device 5D:XX:XX:DF:BB:61 5D-96-57-DF-BB-61
[NEW] Device 53:XX:XX:CD:86:0E 53-38-53-CD-86-0E
[NEW] Device 71:XX:XX:05:5E:2F 71-41-58-05-5E-2F
[NEW] Device 59:XX:XX:7C:2E:D5 59-E2-66-7C-2E-D5
[NEW] Device F0:XX:XX:95:57:E5 F0-18-98-95-57-E5
[NEW] Device 4F:XX:XX:14:67:B8 4F-E6-42-14-67-B8
[NEW] Device D8:XX:XX:46:4F:80 Eve Energy AED9
[CHG] Device 71:XX:XX:05:5E:2F RSSI: -42
[NEW] Device C5:XX:XX:27:1D:0E Eve Room 4002
[NEW] Device C9:XX:XX:C7:AA:CB C9-EA-85-C7-AA-CB
[CHG] Device 59:XX:XX:7C:2E:D5 ManufacturerData Key: 0x004c
[CHG] Device 59:XX:XX:7C:2E:D5 ManufacturerData Value:
0c 0e 00 de 0f 6f 91 52 57 28 45 1a ed 22 68 74 .....o.RW(E.."ht
[CHG] Device D0:XX:XX:EF:55:D1 RSSI: -90
[CHG] Device 71:XX:XX:05:5E:2F ManufacturerData Key: 0x004c
[CHG] Device 71:XX:XX:05:5E:2F ManufacturerData Value:
0c 0e 00 de 0f 6f 91 52 57 28 45 1a ed 22 68 74 .....o.RW(E.."ht
[CHG] Device F0:XX:XX:95:57:E5 RSSI: -26
[CHG] Device F0:XX:XX:95:57:E5 RSSI: -38
[CHG] Device C9:XX:XX:C7:AA:CB ManufacturerData Key: 0x0499
[CHG] Device C9:XX:XX:C7:AA:CB ManufacturerData Value:
05 10 70 43 f8 c2 be 00 60 00 54 04 04 c4 f6 42 ..pC....`.T....B
1d 0e c9 ea 85 c7 aa cb ........
[bluetooth]# scan off
Discovery stopped
[bluetooth]# exit
Stop scanning with scan off and exit with exit.
Some manufactures are registered at Bluetooth where You can check the ManufacturerData Key: 0x004c showed in the scan data above, and in this case it's an Apple product.
Using JavaScript with Node.js and the Noble package will be a good base for an application.
(Please note that the "original" Noble package is outdated !)
Install Node.js and NPM(OK with 20.x), a Bluetooth stack and the Noble package with
sudo apt install libbluetooth-dev libudev-dev
sudo npm install @abandonware/noble
sudo npm install @abandonware/noble
Create a file with the nano text editor
nano BlueScan.js
and add the text
const noble = require('@abandonware/noble');
noble.startScanning();
noble.on('discover', function (peripheral) {
let macAddress = peripheral.uuid;
let rssi = peripheral.rssi;
let localName = peripheral.advertisement.localName;
console.log('Found device: ', macAddress, ' ', localName, ' ', rssi);
});
noble.startScanning();
noble.on('discover', function (peripheral) {
let macAddress = peripheral.uuid;
let rssi = peripheral.rssi;
let localName = peripheral.advertisement.localName;
console.log('Found device: ', macAddress, ' ', localName, ' ', rssi);
});
Exit with Ctrl + x, Y, Enter and execute the code with
sudo node BlueScan.js
which will list something like this
The list will show a device once
Here is a post getting data from a RuuvuTag BB with Node-Red.
sudo node BlueScan.js
which will list something like this
found device: d8xxxx464f80 Eve Energy AED9 -80
found device: 50xxxx6fb636 undefined -89
found device: c5xxxx271d0e Eve Room 4002 -83
found device: 62xxxxabf53d undefined -48
found device: 50xxxx6fb636 undefined -89
found device: c5xxxx271d0e Eve Room 4002 -83
found device: 62xxxxabf53d undefined -48
The list will show a device once
Here is a post getting data from a RuuvuTag BB with Node-Red.
No comments:
Post a Comment
Feel free to leave a comment ! ... but due to a lot of spam comments I have to moderate them. Will reply ASAP !