Skip to content

Commit 5df9449

Browse files
Merge pull request #48 from KasunThushara/main
Update: hailo and thingsboard car park demo
2 parents b5373c1 + 4ff1367 commit 5df9449

17 files changed

+95
-8
lines changed

articles/Chapter_6-RaspberryPi_and_AIoT/Car_Park_Solution_Management_with_Thingsboard.md

+95-8
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,106 @@ 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+
Since this is a demo, we have not added a username or password when creating the device.
162+
163+
4. Click **Add**.
164+
165+
![tb3](../../pictures/Chapter6/tb3.png)
166+
167+
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.
168+
169+
![tb5](../../pictures/Chapter6/tb5.png)
170+
171+
172+
## Step 6: Connect the Device
173+
174+
1. Click on your device and then click the **Check connectivity** button in the **Device details** window.
175+
![tb6](../../pictures/Chapter6/tb6.png)
176+
177+
2. In the opened window, select the messaging protocol and your operating system:
178+
- **Operating System:** Linux
179+
- **Protocol:** MQTT
180+
181+
![tb7](../../pictures/Chapter6/tb7.png)
182+
183+
3. Make sure to install the required client tools.
184+
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.
185+
186+
![tb8](../../pictures/Chapter6/tb8.png)
187+
188+
## Run the Code
150189
151190
```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
191+
cd hailo-rpi5-examples
192+
193+
source setup_env.sh
194+
195+
cd basic_pipelines
196+
197+
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
154198
```
155199
200+
## Create a Dashboard
201+
### Create an Empty Dashboard
202+
1. Navigate to the Dashboards page from the main menu on the left side of the screen.
203+
204+
205+
2. Click the `+` sign in the upper right corner of the screen and select 'Create new dashboard' from the drop-down menu.
206+
![tb9](../../pictures/Chapter6/tb9.png)
207+
3. In the dialog box, enter a title for the dashboard (the description is optional).
208+
209+
4. Click Add.
210+
![tb10](../../pictures/Chapter6/tb10.png)
211+
5. After creating the dashboard, it will open automatically, and you can start adding widgets.
212+
6. To save the dashboard, click the Save button in the upper right corner.
213+
![tb11](../../pictures/Chapter6/tb11.png)
214+
215+
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.
216+
217+
![tb12](../../pictures/Chapter6/tb12.png)
218+
219+
220+
221+
## Add a Chart Widget
222+
1. Enter edit mode and click the `Add new widget` button at the top of the screen.
223+
![tb13](../../pictures/Chapter6/tb13.png)
224+
![tb14](../../pictures/Chapter6/tb14.png)
225+
226+
2. Find the `Charts` widget bundle and click on it.
227+
![tb15](../../pictures/Chapter6/tb15.png)
228+
229+
3. Select the `Time series chart` widget.
230+
![tb16](../../pictures/Chapter6/tb16.png)
231+
232+
4. In the `Device` field, specify the device you created earlier as the data source.
233+
5. In the `Series` section, enter the data key `Available`,`Park`,`Improper` to monitor the car park related values of a device.
234+
![tb16](../../pictures/Chapter6/tb_chart.png)
235+
236+
6. Resize the widget and apply the changes.
237+
7. Click Add.
238+
239+
You can explore additional [dashboard widgets](https://thingsboard.io/docs/user-guide/dashboards/) in the system.
240+
241+
242+
156243
## Demo
157244
158245
![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

pictures/Chapter6/tb3.png

54.1 KB
Loading

pictures/Chapter6/tb5.png

40.6 KB
Loading

pictures/Chapter6/tb6.png

65.9 KB
Loading

pictures/Chapter6/tb7.png

73 KB
Loading

pictures/Chapter6/tb8.png

97.3 KB
Loading

pictures/Chapter6/tb9.png

40.6 KB
Loading

pictures/Chapter6/tb_chart.png

36.2 KB
Loading

0 commit comments

Comments
 (0)