Node-RED Challenge Round 2: Bluetooth Low Energy
My first challenge to Node-RED was a success: I was able to read battery voltage and charge percentage from a slow Samsung 500T tablet stuck on an old 32-bit build of Windows 10, and the hardest part of that process was retrying installation after it timed out because the computer was so slow.
This next challenge is significantly more difficult: connect to peripherals via Bluetooth Low Energy. Despite Bluetooth in the name, BLE is actually a completely different protocol from the earlier grand wireless protocol to rule them all. (Sometimes called "Bluetooth Classic" now.) But it is now administered by the same consortium,. so there we go.
As its name implies, a primary goal for BLE is reducing power requirements to make it feasible for battery powered devices. And in this context "battery" is not a gigantic brick of rechargeable lithium-ion cells, BLE wants to be practical for devices to run for months on little coin cell batteries. It's new, with its own set of rules, and tricky to get right. Thus the perfect advanced level challenge.
This time the hardware is the HP Split X2 from NUCC, an old Windows laptop with built-in Bluetooth. It has a decent processor and RAM but hobbled by an old hard drive that's difficult to upgrade. As a result installing Node-RED took almost as long as it did on the Samsung 500T's slow eMMC storage, but at least the CPU was fast enough to avoid a timeout.
The Node-RED extension of interest here is node-red-contrib-noble-bluetooth
. Out of all the nodes claiming Bluetooth capability, this one seems to be the one that has general BLE capability (not tied to specific devices) and updated most recently. I installed that extension, started a query for nearby BLE devices, and Node-RED crashed. Not throwing an error that a flow might try to handle, not an error message, Node-RED itself crashed with an error thrown by Noble.
No compatible USB Bluetooth 4.0 device found!
Ah well, I didn't expect it to be as easy as reading battery level and fully anticipated some bumps on the road to this advanced challenge. Time to do a little investigation.