Site Monitoring System
A on-site monitoring system developed on the STM32 chip using WIZ830MJ module, OV2640 module, and PM2.5 sensors.
Site Monitoring System
Introduction
At present, many cities require the construction of various roads or buildings, so construction sites are not uncommon in cities. The differences between each construction site are significant, whether it is the overall dust pollution or local differences. Therefore, controlling dust on construction sites is particularly important in the greening and aesthetics of cities.
The system can monitor the dust emission at the construction site in real time. When the dust concentration in the air is detected to be too high, it will automatically start the spray to wet the dust so as to prevent too much dust from floating outside and reduce the environmental pollution during construction at the construction site.
Development Environment
- STM32CubeMX
- Keil5
- Alibaba Cloud IoT Platform
Function Introduction
This project is developed based on the STM32F429BIT6 development board, equipped with WIZ830MJ Ethernet module, OV2640 camera module, PM2.5 sensor, CO2 sensor, temperature and humidity sensor, lighting sensor, and TFT-LCD screen
The TFT-LCD screen can display various data collected by sensors and on-site images captured by the OV2640 camera in real-time. Only when the system detects that the dust in the construction site exceeds the threshold value, it will automatically start the spray for dust removal, thus saving water.
You can also view the data collected by sensors and real-time video streams simultaneously on the Alibaba Cloud IoT Platform and PC upper computer tools.
The following is the system diagram of the entire project. It can help you better understand the operation of the entire system.
I chose WIZnet's WIZ830MJ module as the Ethernet module for this system. The reason for choosing this Ethernet module is that it is simple to use and has a high communication rate. The WIZ830MJ module is equipped with a chip called W5300, which supports 8/16 bit data bus interface for communication with the host. It is embedded with 8 independent hardware sockets for 8-way independent communication. The communication efficiency of these 8-way sockets does not affect each other, and the network communication rate can reach 80Mbps. Additionally, this chip is an embedded Ethernet controller that integrates the full hardware TCP/IP protocol stack, eliminating the need for me to debug the LWIP protocol stack, This greatly shortens the development cycle of this project.
Software Implementation
#WIZ830MJ initialization configuration and wiring instructions
The system requires the WIZ830MJ Ethernet module to simultaneously report MQTT data and display real-time video streams, so I chose to use a 16 bit data bus for communication.
#FMC HAL library initialization configuration
The FMC initialization on STM32 can be set according to the following figure. The W5300 chip supports direct/indirect addressing mode and 8/16 bit data mode, while I am using 16 bit direct addressing mode here.
#16 bit data width wiring instructions in direct addressing mode
When using direct addressing mode with a 16 bit data bus width, using ADDR [9:1], ADDR0 grounded or overhead BIT16EN is internally raised, so overhead can also be used.
#MQTT server access instructions
The project is connected to the MQTT server using the Alibaba Cloud IoT Platform, which can more conveniently and aesthetically display sensor data uploaded by WIZ830MJ.
Step 1: Enter the Alibaba Cloud IoT Platform and create a new product in the device list
Step 2: Add a function definition to the newly created product to display the sensor data of the device
Step 3: Enter the newly created product and add a new device
Step 4: Obtain clientId, username, passwd, mqttHostUrl, and port information, and connect to the cloud platform
Step 5: Return to the product interface to obtain the corresponding message release topic for the device, where ${deviceName} needs to be replaced with the actual deviceName of the device
#Publish Data Format
When the system is running, it will actively connect to the cloud platform and publish the data collected by sensors to the cloud platform
#UDP Real Time Video Streaming Description
The system initializes the OV2640 camera module, which will collect real-time video stream data and send the video stream data to the remote PC upper computer tool for display through the UDP protocol 1234 port of the WIZ830MJ module. Using the WIZ830MJ module to transmit video streams can achieve a very smooth viewing experience, with a frame rate of over 60FPS at a resolution of 320 * 240.
YouTube Demo Video
Thank you all for watching.