Skip to content

Commit df4ade4

Browse files
committed
Update: thingsboard and car park
1 parent 50195bf commit df4ade4

17 files changed

Lines changed: 94 additions & 8 deletions

File tree

articles/Chapter_6-RaspberryPi_and_AIoT/Car_Park_Solution_Management_with_Thingsboard.md

Lines changed: 94 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ class user_app_callback_class(app_callback_class):
8282
# -----------------------------------------------------------------------------------------------
8383
# MQTT Setup
8484
# -----------------------------------------------------------------------------------------------
85-
BROKER = "192.168.8.195" # Replace with your MQTT broker's IP address
86-
CLIENT_ID = "Car_Park"
85+
BROKER = "192.168.8.195" # ThingsBoard Host-Name
86+
CLIENT_ID = "Car_Park" # The Client ID which you give in the Thingsboard End
8787
PORT = 1883
88-
TOPIC = "v1/devices/me/telemetry" # Adjust to match your topic
88+
TOPIC = "v1/devices/me/telemetry" # Topic For Sending data to ThingsBoard
8989

9090
mqtt_client = mqtt.Client(CLIENT_ID)
9191

@@ -140,19 +140,105 @@ if __name__ == "__main__":
140140
141141
## Step 4: Install ThingsBoard and Add a Device
142142
143-
[ThingsBoard](https://thingsboard.io/) is an open-source IoT platform designed for device management, data collection, processing, and visualization. It supports various communication protocols such as **MQTT, CoAP, and HTTP**, making it versatile for integrating IoT devices and systems. The platform enables users to **create interactive dashboards, monitor devices in real-time, and analyze data through advanced visualization tools. With its rule engine, ThingsBoard automates workflows and event processing**, simplifying the implementation of IoT use cases across industries. Its scalability and flexibility make it suitable for projects of any size, from small prototypes to large-scale deployments.
143+
[ThingsBoard](https://thingsboard.io/) is an open-source IoT platform designed for device management, data collection, processing, and visualization. It supports various communication protocols such as **MQTT, CoAP, and HTTP**, making it versatile for integrating IoT devices and systems. The platform enables users to **create interactive dashboards, monitor devices in real-time, and analyze data through advanced visualization tools. With its rule engine, ThingsBoard automates workflows and event processing**, simplifying the implementation of IoT use cases across industries. Its scalability and flexibility make it suitable for projects of any size, from small prototypes to large-scale deployments.Additionally, you can use their [cloud solution](https://thingsboard.io/products/paas/) for easier deployment and management.
144+
145+
144146
145147
We have provided instructions on [installing the ThingsBoard Community Edition](https://wiki.seeedstudio.com/recomputer_r1000_thingsboard_ce/) and the Edge version. You can refer to this wiki lesson for guidance.
146148
147-
After installing ThingsBoard, you need to add a device. [This lesson](https://wiki.seeedstudio.com/recomputer_r1000_thingsboard_dashboard/) also explains how to create widgets and build dashboards using MQTT credentials. When adding a device, specify the client name in the device configuration and ensure the client name and broker settings in the above code match your ThingsBoard platform configuration.
148149
149-
Since this is a demo, **we have not added a username or password when creating the device**.
150+
## Step 5: Provision a Device
151+
152+
1. Navigate to the **Devices** page under the **Entities** section.
153+
154+
![tb1](../../pictures/Chapter6/tb1.png)
155+
156+
2. Click the **'+'** icon in the top right corner of the table and select **'Add new device'** from the drop-down menu.
157+
158+
![tb2](../../pictures/Chapter6/tb2.png)
159+
160+
3. Enter the **device name**, **Client ID**, **Password**, and **Username**.
161+
162+
4. Click **Add**.
163+
164+
![tb3](../../pictures/Chapter6/tb3.png)
165+
166+
5. As you add more devices, they will appear at the top of the table. The table automatically sorts devices by creation time, with the newest ones listed first.
167+
168+
![tb5](../../pictures/Chapter6/tb5.png)
169+
170+
171+
## Step 6: Connect the Device
172+
173+
1. Click on your device and then click the **Check connectivity** button in the **Device details** window.
174+
![tb6](../../pictures/Chapter6/tb6.png)
175+
176+
2. In the opened window, select the messaging protocol and your operating system:
177+
- **Operating System:** Linux
178+
- **Protocol:** MQTT
179+
180+
![tb7](../../pictures/Chapter6/tb7.png)
181+
182+
3. Make sure to install the required client tools.
183+
4. Execute the copied command. Once the temperature readings are published successfully, the device state will change from **"Inactive"** to **"Active"**. You will also see the published temperature readings.
184+
185+
![tb8](../../pictures/Chapter6/tb8.png)
186+
187+
## Run the Code
150188
151189
```bash
152-
BROKER = "192.168.8.195" # Replace with your MQTT broker's IP address
153-
CLIENT_ID = "Car_Park" # Replace with your client ID
190+
cd hailo-rpi5-examples
191+
192+
source setup_env.sh
193+
194+
cd basic_pipelines
195+
196+
python park_object_detection.py --labels-json /home/pi/Desktop/hailo-custom/config.json --hef-path /home/pi/Desktop/hailo-custom/yolov8n_renamed_carpark.hef -i /dev/video0
154197
```
155198
199+
## Create a Dashboard
200+
### Create an Empty Dashboard
201+
1. Navigate to the Dashboards page from the main menu on the left side of the screen.
202+
203+
204+
2. Click the `+` sign in the upper right corner of the screen and select 'Create new dashboard' from the drop-down menu.
205+
![tb9](../../pictures/Chapter6/tb9.png)
206+
3. In the dialog box, enter a title for the dashboard (the description is optional).
207+
208+
4. Click Add.
209+
![tb10](../../pictures/Chapter6/tb10.png)
210+
5. After creating the dashboard, it will open automatically, and you can start adding widgets.
211+
6. To save the dashboard, click the Save button in the upper right corner.
212+
![tb11](../../pictures/Chapter6/tb11.png)
213+
214+
7. Your first dashboard is now created. As you add more dashboards, they will appear at the top of the list, sorted by the creation timestamp.
215+
216+
![tb12](../../pictures/Chapter6/tb12.png)
217+
218+
219+
220+
## Add a Chart Widget
221+
1. Enter edit mode and click the `Add new widget` button at the top of the screen.
222+
![tb13](../../pictures/Chapter6/tb13.png)
223+
![tb14](../../pictures/Chapter6/tb14.png)
224+
225+
2. Find the `Charts` widget bundle and click on it.
226+
![tb15](../../pictures/Chapter6/tb15.png)
227+
228+
3. Select the `Time series chart` widget.
229+
![tb16](../../pictures/Chapter6/tb16.png)
230+
231+
4. In the `Device` field, specify the device you created earlier as the data source.
232+
5. In the `Series` section, enter the data key `Available`,`Park`,`Improper` to monitor the car park related values of a device.
233+
![tb16](../../pictures/Chapter6/tb_chart.png)
234+
235+
6. Resize the widget and apply the changes.
236+
7. Click Add.
237+
238+
You can explore additional [dashboard widgets](https://thingsboard.io/docs/user-guide/dashboards/) in the system.
239+
240+
241+
156242
## Demo
157243
158244
![demo](../../pictures/Chapter6/demo-thingsboard.gif)

pictures/Chapter6/tb1.png

132 KB
Loading

pictures/Chapter6/tb10.png

54.6 KB
Loading

pictures/Chapter6/tb11.png

35.6 KB
Loading

pictures/Chapter6/tb12.png

34.8 KB
Loading

pictures/Chapter6/tb13.png

32.2 KB
Loading

pictures/Chapter6/tb14.png

40.7 KB
Loading

pictures/Chapter6/tb15.png

137 KB
Loading

pictures/Chapter6/tb16.png

87.6 KB
Loading

pictures/Chapter6/tb2.png

38.3 KB
Loading

0 commit comments

Comments
 (0)