You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 15 Next »

Introduction

Bluetooth interface implementation in RouterOS allows the device to capture Bluetooth advertising packets that are broadcasted over 37, 38, and 39 advertising channels. More information can be found in the guide here.

Bluetooth tags like, for example, TG-BT5-IN and TG-BT5-OUT, do exactly that. They broadcast advertising payloads over the mentioned channels. To understand what kind of information is stored in the payload, make sure to check the link.

After the Bluetooth packet is broadcasted by the tag and the KNOT captures it, you can utilize scripting and scheduling to structure messages out of the payloads that the KNOT receives and automate the KNOT to send those messages periodically via MQTT, e-mail or HTTP post. That means you will need a server where the data is going to be stored and visualized. In this guide, we will showcase a server called ThingsBoard and how to communicate with it using the MQTT protocol.

ThingsBoard has a cloud solution and different local installation options (on different OS). Since we've added a container feature, it became possible to also run the platform within RouterOS. In order to do that, you will need a RouterOS device that has at least 2 GB RAM, has an option to increase storage (for example, an additional USB port), and is either ARM64 or AMD64 architecture. CHR machine or CCR2004-16G-2S+ could be a good fit.

Setup requirements:

  • 2+ devices with Bluetooth interface, like the KNOT (the amount of the units required depends on the size of the area that needs to be covered);
  • 1+ Bluetooth TG-BT5-IN and/or TG-BT5-OUT tags (depending on how many assets you need to track);
  • a running ThingsBoard server.

Just attach the tag to the asset and, after a few additional steps explained below in this guide, you will be able to track its approximate location.

Summary

We can script and automate the KNOT so that as soon as the tag appears within the KNOT's Bluetooth range, RouterOS would structure a message (which would have the tag's MAC address in it), and would send it to the server.

As a result, if you have 2 KNOTs (KNOT A and KNOT B), running the same script on a scheduler, and the tag moves between their Bluetooth operating ranges, you will have the data on the server indicating whether it was KNOT A or KNOT B that have sent the tag's payload and that way you can figure out an approximate position of the tag.

Let's say, you have a warehouse. What you can do, is you can scatter the KNOTs across the warehouse so that the KNOT's Bluetooth ranges do not overlap with the neighboring KNOTs. You need to test the Bluetooth range in your environment/topology to figure out how far the Bluetooth range goes, as it can be much lower than expected if you have a lot of 2.4 GHz interference or materials that can impact the signal strength, like concrete. For example, in line of sight, with no interference, the distance at which the KNOT is able to capture the tag's broadcasted payload, can be up to 180 meters (KNOT — ~180 meters — TG-BT5-OUT). But you also have to keep in mind that with more distance, more packets will be lost on the way.

The idea is simple,

Take a look at the topology shown below:



MikroTik Bluetooth tags, like → TG-BT5-IN and TG-BT5-OUT ← Many RouterOS devices have GPS support. It allows RouterOS to determine the precise location of its GPS receiver. GPS coordinates will indicate the latitude and the longitude values (among other parameters) of the current position.

Let's say, you have LTAP (or any other RouterOS device with GPS support) and you wish to track its location. You want the router to send this data to a server, where the data will be stored and integrated into a map, as it is more convenient to monitor. In this guide, we will showcase how you can do that. This scenario will utilize MQTT protocol communication with a platform called ThingsBoard.

ThingsBoard has a cloud solution and different local installation options (on different OS).

Since we've added a container feature, it became possible to also run the platform within the RouterOS. Meaning, you can build this scenario, solely on RouterOS units → devices with GPS support that you wish to track (for example, cars equipped with LTAPs → RouterOS devices that act as MQTT publishers), and a ThingsBoard server run within a more powerful RouterOS device (for example, a CHR machine or CCR2004-16G-2S+ → RouterOS device that acts as an MQTT broker).

If you want to choose this route (container route), make sure to pick the devices that you plan on using as a "server" carefully, because this implementation can be heavy on RAM usage (it is suggested to have a device that has at least 2 GB RAM and is either ARM64 or AMD64 architecture).

Configuration



This example will showcase access-token and one-way SSL communication via access-token scenarios for simplicity reasons, but you can use other available options as well.

/iot/mqtt/brokers/add name=tb address=x.x.x.x port=1883 username=access_token
  • No labels