No-Code and Low-Code Development for Bluetooth Beacons

As mentioned in our article on Using Bluetooth Low Energy (LE), Bluetooth devices such as beacons repeatedly advertising their id and for sensor beacons they advertise their sensor information.

Something needs to listen which is usually a smartphone app, a gateway or a computer such as the Raspberry Pi. These devices process the advertising to show information on a map, in a dashboard or forward on to other systems, possibly as alerts. In the case of a gateway, the information is usually sent to a local server or cloud server. The app, computer or cloud server functionality usually involves custom programming but what if you could do this with no code?

There’s a general move towards using more ‘No-Code’ and ‘Low-Code’ Development. This is where common functionality is wrapped into components that are joined together using a user interface. There are many proprietary examples most of which involve subscriptions, SaaS, lock-in and unknown longevity that makes them unsuitable for enterprise grade solutions. Conversely, we are a fan of Node-RED that provides open source flow-based programming that we have used on customer projects. Don’t be deceived by the user-interface. This is not a toy and is being used in production by many companies.

Node-RED started in 2013 as a side-project by Nick O’Leary and Dave Conway-Jones of IBM’s Emerging Technology Services group. It has since been open-sourced, continually developed and it moved to the JS Foundation in 2016.

Node-RED provides a flow-based editor that allows you wire together just about any type of input, for example, Bluetooth, HTTP, MQTT to any type of output. It also has components to generate a simple UI dashboard with widgets. There’s a large number of nodes including Bluetooth that you can import and use for input, processing and output. You can develop and run on Linux or Windows. Everything is done using a web user interface. You can run on, for example, a Raspberry Pi, AWS, Azure or more usefully for Bluetooth, on edge Linux devices.

We like to use Node-RED on Mini-PC devices, such as Intel NUCs, running Linux. We don’t use Raspberry Pi because running from SD cards eventually becomes unreliable, although a recent feature does allow booting and running from any USB device. The flexibility of the hardware you can use with Node-RED contrasts with many other IoT solutions that end up being obsolete due hardware becoming end of life.

Bluetooth scanning

It’s relatively easy to set up a flow to read Bluetooth advertising. It’s also possible to use HTTP or MQTT input to receive and process data from Bluetooth gateways. We have even run AI Machine Learning, for learning and inference, within within a Node-RED flow.

Using tools such as Node-RED is quick and easy compared to coding. Node-RED is free, open-source, stable and is still being improved over time. However, there comes a stage where you eventually need to run code. Some components allow running arbitrary JavaScript to transform data from the input to output of a node. This is sometimes better than trying to connect together and configure lots of nodes to do the same thing.

Another limitation is that it’s not possible to create an installable product with Node-RED. You can export and import project flows which isn’t something you can sell as a product. The output UI is also limiting. You have to design your UI around what’s possible. More complex solutions also end up with very complex flows and sub-flows that get more difficult to understand. While you don’t need to code, you still need someone with similar analysis and problem solving skills.

For high throughput systems you will also hit performance problems. Node-RED is based on Node.js that uses a JavaScript runtime. Compiled languages such as c, c++ and Rust reduce latency, reduce CPU usage by up to 75% and memory usage by up to 95% compared to Javascript. It’s also difficult to move a solution to compiled code should that be needed in the future.

Nevertheless, Node-RED provides a no-code or low-code tool for some one-off solutions that would otherwise be too effort-intensive or expensive.

More about BeaconZone custom solutions

New Nodejs Bluetooth Library

Modblue is a new open source Bluetooth library for nodejs that supports central and peripheral mode using hci and dbus. It supports Linux, OS and Windows native via WinRT/UWP.

The library can be used to advertise, scan, connect via GATT, discover services, characteristics and read/write values.