4G

Bluetooth and Node-Red on Advantech 4G Routers

Using 4G router for scanning for Bluetooth devices and beacons. Simple example demonstrates how to leverage Advantech 4G router as edge compute device.

· 5 min read
Bluetooth and Node-Red on Advantech 4G Routers

This is very short post depicting current (01/04/2021) procedure to enable and work with Bluetooth on ICR-3232W 4G Routers. We will end up with sample Node-Red flow, which collects information from BTLE beacon.

Screenshot of Node-Red flow running on the router

I am using latest FW (6.2.8) as of writing.

Prepare SW on the router

We will need these router apps installed in this specific order:

  1. Bluetooth - DL
  2. Node.JS - DL
  3. Node-Red - DL
  4. BlueZ / Node-RED Noble - (Thank you Brenton Thomson for packaging it for me) - DL
  5. Node-RED / RuuviTag - (Thank you Brenton Thomson for packaging it for me) - DL

Your list of User Modules should look like this:

Now we will enable Node-Red to run.

Apply setting and have a look into Log section if the Node-Red started successfully. You should see output similar to this:

2021-04-01 10:14:05 [info] User directory : /usr/lib/node_modules/node-red
2021-04-01 10:14:05 [info] Projects disabled : user settings
2021-04-01 10:14:05 [info] Flows file     : /usr/lib/node_modules/node-red/flows_Router.json
2021-04-01 10:14:05 [info] Creating new flow file
2021-04-01 10:14:05 [info] Starting flows
2021-04-01 10:14:05 [info] Started flows
2021-04-01 10:14:05 [info] Server now running at https://127.0.0.1:1880/

Node-Red part

At this moment we do have everything running and let's look at the Node-Red itself.

Import flow into Node-Red

Notice the HTTPS requirement in the Server info output. Navigate in your browser to the HTTPS://Router_IP:1880. You will need to enter routers credentials. Now we are in the normal Node-Red enviroment.

To speed up everything up. You can import my test Node-Red Flow (screenshot above). The flow does scan for BTLE devices every 60seconds with scanning period of 5sec. There are manual controls as well for your convinience.
For my testing I am using Ruuvi Open Source BTLE beacon.

[
    {
        "id": "6acdc54a.223a44",
        "type": "tab",
        "label": "Read BTLE Beacons",
        "disabled": false,
        "info": ""
    },
    {
        "id": "7d85b5eb.6c32bc",
        "type": "scan ble",
        "z": "6acdc54a.223a44",
        "uuids": "",
        "duplicates": true,
        "name": "",
        "x": 470,
        "y": 200,
        "wires": [
            [
                "28f66131.387f9e",
                "6d4e0e40.e28c1"
            ]
        ]
    },
    {
        "id": "6d4e0e40.e28c1",
        "type": "ruuvitag",
        "z": "6acdc54a.223a44",
        "name": "",
        "x": 660,
        "y": 220,
        "wires": [
            [
                "1293e8ef.2bf63f"
            ]
        ]
    },
    {
        "id": "cfee3ec6.9b783",
        "type": "debug",
        "z": "6acdc54a.223a44",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "x": 1010,
        "y": 220,
        "wires": []
    },
    {
        "id": "28f66131.387f9e",
        "type": "debug",
        "z": "6acdc54a.223a44",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "x": 740,
        "y": 140,
        "wires": []
    },
    {
        "id": "f4c8349e.bf1d8",
        "type": "inject",
        "z": "6acdc54a.223a44",
        "name": "",
        "topic": "",
        "payload": "{\"scan\":true}",
        "payloadType": "json",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 270,
        "y": 100,
        "wires": [
            [
                "7d85b5eb.6c32bc"
            ]
        ]
    },
    {
        "id": "56de3832.66a348",
        "type": "inject",
        "z": "6acdc54a.223a44",
        "name": "",
        "topic": "",
        "payload": "{\"scan\":false}",
        "payloadType": "json",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 270,
        "y": 300,
        "wires": [
            [
                "7d85b5eb.6c32bc"
            ]
        ]
    },
    {
        "id": "1293e8ef.2bf63f",
        "type": "json",
        "z": "6acdc54a.223a44",
        "name": "",
        "property": "payload",
        "action": "",
        "pretty": false,
        "x": 850,
        "y": 220,
        "wires": [
            [
                "cfee3ec6.9b783"
            ]
        ]
    },
    {
        "id": "fe7ff526.47c0b",
        "type": "trigger",
        "z": "6acdc54a.223a44",
        "op1": "{\"scan\": true}",
        "op2": "{\"scan\":false}",
        "op1type": "json",
        "op2type": "json",
        "duration": "5",
        "extend": false,
        "units": "s",
        "reset": "",
        "bytopic": "all",
        "name": "",
        "x": 280,
        "y": 200,
        "wires": [
            [
                "7d85b5eb.6c32bc"
            ]
        ]
    },
    {
        "id": "1badc0e4.b3c7a7",
        "type": "inject",
        "z": "6acdc54a.223a44",
        "name": "",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "repeat": "60",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "x": 110,
        "y": 200,
        "wires": [
            [
                "fe7ff526.47c0b"
            ]
        ]
    }
]

Now you should see output in your Debug Window with values from Ruuvi beacon.

Related Articles

Advantech 4G, LTE router FW 6.3.2
· 1 min read
Advantech 4G Routers FW 6.3.1
· 2 min read
Advantech 4G Router FW 6.3.0
· 2 min read
4G Router Metrics to Grafana
· 7 min read