online web builder

MQTT broker and BLE MQTT gateway

what makes adding or removing electronic assistants (Bluetooth, Wi-Fi and wired) easy


Main components:
- any single-board computer,
- 4.0 Bluetooth USB dongle,
- the camper’s router.

MQTT broker and BLE MQTT gateway, that is for the messages transportation between camper's sensors and actuators, is extremely lighteweight and can be deployed on any single-board computer that in the camper's network. This can be computer works for Camper assistant itself, or be computer works for a video recorder and streamer (USB camera), for the camper's NAS, etc. What is important is to set a static IP for this computer in the camper's network, and to make this computer not sleeped, not hibernated.

In this case the MQTT broker and BLE MQTT gateway was deployed on the camper's NAS single-board computer haves the static IP in the camper's network and never sleeps while collects data from cameras and sensors.

Bluetooth USB dongle on Qualcomm csr8510 A10 was used (Hama H-49218 for example). Here the list of other Bluetooth 4.0/4.1 USB adapters that can be used in this case (being integrated on the single-board computer, or within USB dongle).

All settings were made via Windows PC. In some cases will need switch off the PC firewall while settings. While the camper's NAS works, it was available in the PC terminal via PuTTY over IP on port 22 with root user and odroid password.

To install Mosquitto MQQT broker, was entered in the PC terminal:

apt-get install mosquitto

apt-get install mosquitto-clients

gzip -d /usr/share/doc/mosquitto/examples/mosquitto.conf.gz

cp /usr/share/doc/mosquitto/examples/mosquitto.conf /etc/mosquitto/conf.d

nano /etc/mosquitto/conf.d/mosquitto.conf

In opened file was decommented line:

#port 1883 

and port number was changed to 1993:

port 1993

Ctrl+O, Enter, Ctrl+X

Then Mosquitto was restarted up on new port and Mosquitto RSMB was installed:

service mosquitto restart

git clone

cd mosquitto.rsmb/rsmb/src



crontab -e

Then was added to the end of the open file:

@reboot sleep 5; cd /root/mosquitto.rsmb/rsmb/src; sudo nohup ./broker >> /dev/null &

# and at least one empty line should be at the end of the file!

Ctrl+O, Enter, Ctrl+X

Then was installed Node.js and was deployed Bluetooth (BLE) MQTT gateway:

apt-get install gcc g++

apt-get install bluetooth bluez libbluetooth-dev libudev-dev

ln -s /usr/bin/nodejs /usr/bin/node

curl -sL | bash -

apt-get install -y nodejs

apt-get install libcap2-bin

setcap cap_net_raw+eip $(eval readlink -f `which node`)

curl -sL | sudo apt-key add -

echo "deb stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

apt-get update && apt-get install yarn


Then was login ordinary user (ca-nas in this case), not a root user, and then:

cd /usr/bin/

sudo yarn add node-gyp

sudo yarn add bluetooth-hci-socket

sudo yarn add noble

sudo yarn add prettyjson

sudo yarn add mqttsn-packet

sudo yarn add net

sudo yarn install

Note: if some of yarn packages listed above was installed with any errors, that mean of choseed version of Node.js can't work under this Linux version. In this case some lower Node.js version can be installed. But befor this, the ready installed version of Node.js need to purge by commands "apt-get remove --purge nodejs", then "rm -r /usr/bin/node_modules". After this purge, new version of Node.js can be installed like described abow, starting with command "curl -sL | bash -" (but with choosed version pointed), and then all listed above yarn packages need to add one more time.

Then file ble-uart-to-udp.js, that service bridges between a BLE UART and an UDP socket, was uploaded in folder /home/ca-nas (i.e. home folder of ordinary, not a root, user). This can be made via USB if the single-board computer has, or by network if the single-board computer works for NAS, or via WinSCP like described here in the topic about wireless IP camera.

Then one more time was opened crontab file:


#password for root user

crontab -e

Then was added to the end of the open file:

@reboot sleep 10; cd /home/ca-nas; sudo nohup node ble-uart-to-udp.js >> /dev/null &

# and at least one empty line should be at the end of the file!

Ctrl+O, Enter, Ctrl+X


From this point any Bluetooth, Wi-Fi and wired sensors and actuators can be served by MQTT broker and be discoverables to each other and for the Camper assistant.

Note: this time only Nordic UART proprietary Bluetooth Service (NUS) can be used on sensors and actuators with Bluetooth under MQTT in this case. Like a result, only sensors and actuators with Nordic chips, like nRF528x, can be used via Bluetooth with MQTT. Subscribe for updates bottom this page for other protocols when they will published here.


A software you can load here is free for a non-commercial use except for components for which their owners declared their own rights. Can be limited by local laws.

All your data will be stored only locally with a software you can load here.


Get updates