Introduction
Milesight VS121, is an AI workplace sensor designed to monitor occupancy and utilization in modern workspaces, which can reach up to 98% recognition rate based on its AI algorithm. Milesight VS121 is available in dual versions that transmit data through LoRaWAN® or Ethernet for different applications. Based on standard Lorawan protocol, VS121 can work with the Milesight gateway. It is equipped with WI-FI for easy configuration without the need for any additional configuration tools. By connecting this device to the ThingsBoard, you can get improved visualization and data management capabilities.
Only Professional Edition supports Platform Integrations feature.
Use ThingsBoard Cloud or install your own platform instance.
Prerequisites
To continue with this guide we will need the following:
- VS121 AI workplace sensor
- VS121 Device user manual
- Computer with Wi-Fi
- LoRaWAN® gateway (in our case UG56 LoRaWAN® Gateway)
- Configured integration on networks server and ThingsBoard
- ThingsBoard account
Device connection
According to the official user manual and this guide, you can connect the device to the network and get access to the Web UI via wireless connection. Since this device can only be operated using a LoRaWAN® gateway, we must first connect it to a network server that has an integration configured with ThingsBoard.
Device configuration
To connect and send data we should configure the device and network server. Firstly, we are going to configure the device, and save required information for network server configuration. To add a device to network server and get information from it, we will need the following device parameters:
- Device EUI - device identifier
- Application EUI - Application identifier
- Application Key - Application key to identify device. We recommend to use a generated key, not from the example!
Depending on the network server, you may also need to provide join type (OTAA), LoRaWAN version.
VS121 sensor provides user-friendly web GUI for configuration and users can access it via Wi-Fi connection. Default SSID device: Workplace Sensor.
Follow the steps below:
- Power on the device over Type-C Power Port;
- Enable the Wireless Network Connection on your computer and the corresponding access point, then connect computer to this access point;
- Open the Browser and type 192.168.1.1 to access the web GUI (you must be in the one subnetwork);
- Users need to set the password when using the device for the first time. Additionally three security questions can also be set optionally;
- After configuration, use username (admin) and custom password to log in to the sensor.
To obtain the necessary parameters, follow these steps:
- Go to the IoT page in the left panel and navigate to the LoRa tab;
- Make a note of Device EUI and App EUI;
- Generate and enter a new password in hexadecimal format in the Application Key field and note it;
- Scroll down and click on the Save button.
The parameters above are required for connection.
To configure the device we also need to add it to a network server, so select the network server your gateway is connected to:
Add a device on the ChirpstackWe need to add a device on the Chirpstack. To add a device, you can follow next steps:
Uplink converter in ThingsBoard integrationSuch as we have already connected gateway and configured integration - we will need to modify the converter and add an ability to parse incoming payload from the device. To do this you can add code to “Decoding block”, it locates between comments “// — Decoding code — //” in your converter, if you are using the default converters (for ThingsBoard v3.5.2 or above).
Or you can copy the whole code of the converter and paste it to your converter:
|
Add a device on The Things Stack Community EditionWe need to add a device on The Things Stack Community Edition. To add a device, you can follow next steps:
Uplink converter in ThingsBoard integrationSuch as we have already connected gateway and configured integration - we will need to modify the converter and add an ability to parse incoming payload from the device. To do this you can add code to “Decoding block”, it locates between comments “// — Decoding code — //” in your converter, if you are using the default converters (for ThingsBoard v3.5.2 or above).
Or you can copy the whole code of the converter and paste it to your converter:
|
Add a device on The Things IndustriesWe need to add a device on The Things Industries cloud. To add a device, you can follow next steps:
Uplink converter in ThingsBoard integrationSuch as we have already connected gateway and configured integration - we will need to modify the converter and add an ability to parse incoming payload from the device. To do this you can add code to “Decoding block”, it locates between comments “// — Decoding code — //” in your converter, if you are using the default converters (for ThingsBoard v3.5.2 or above).
Or you can copy the whole code of the converter and paste it to your converter:
|
Add a device on the LoriotWe need to add a device on the Loriot. To add a device, you can follow next steps:
Uplink converter in ThingsBoard integrationSuch as we have already connected gateway and configured integration - we will need to modify the converter and add an ability to parse incoming payload from the device. To do this you can add code to “Decoding block”, it locates between comments “// — Decoding code — //” in your converter, if you are using the default converters (for ThingsBoard v3.5.2 or above).
Or you can copy the whole code of the converter and paste it to your converter:
|
Check data on ThingsBoard
So, the device was added and if it sends any data - it should appear in “Devices”.
To check it you may open “Devices” page in “Entities” section.
The device should be in devices list. You can check the data by clicking the device and navigate to the “Attributes” or “Latest telemetry” tab.
In order to get more user-friendly view - you can use dashboard.
Download a simple dashboard for this device. It is configured to display a data from “Count people all”, “Max count people”, “Signal strength”, “Region count” and “Occupancy” timeseries keys of device with name “eui-24e124538b223213”.
ThingsBoard provides the ability to create and customize interactive visualizations (dashboards) for monitoring and managing data and devices.
Through ThingsBoard dashboards, you can efficiently manage and monitor your IoT devices and data. So, we will create the dashboard, for our device.
To add the dashboard to ThingsBoard, we need to import it. To import a dashboard, follow these steps:
- First download the Check and control device data dashboard file.
-
Navigate to the “Dashboards” page. By default, you navigate to the dashboard group “All”. Click on the “+” icon in the top right corner. Select “Import dashboard”.
-
In the dashboard import window, upload the JSON file and click “Import” button.
-
Dashboard has been imported.
To open the imported dashboard, click on it. Then you should specify your device in entity alias of the dashboard.
To do this, follow these steps:
-
Open the dashboard and enter edit mode. Click the “Entity aliases” icon, then in the pop-up window click the “Edit alias” icon next to the alias.
-
In edit alias window select your device from dropdown list and save entity alias.
-
Apply all changes.
Now you should be able to see the data from the device.
Example of the dashboard with data:
Conclusion
With the knowledge outlined in this guide, you can easily connect your VS121 AI workplace sensor and send data to ThingsBoard.
Explore the platform documentation to learn more about key concepts and features. For example, configure alarm rules or dashboards.