[DigiKey Creative Competition] Urban Gas Distributed Mobile Intelligent Monitoring Platform Based on STM32H7B3I
[Copy link]
Title of the work: Urban gas distributed mobile intelligent monitoring platform based on STM32H7B3I
Author: mameng
1. Introduction
At about 6:42 on June 13, 2021, a natural gas explosion occurred in Yanhu Community, Zhangwan District, Shiyan City, Hubei Province. The 41st Factory Vegetable Market was blown up, causing 26 deaths and 138 injuries, including 37 serious injuries, with direct economic losses of about 53.9541 million yuan. The report pointed out that the direct cause of the accident was the severe corrosion of the medium-pressure steel pipe of natural gas, which led to rupture. The leaked natural gas gathered in the confined space in the river below the building involved in the accident in the market, and exploded when it encountered sparks discharged from the exhaust pipe of the catering business. There are four indirect causes of the accident: illegal construction caused accident hazards, long-term non-implementation of hidden danger investigation and rectification, serious errors in corporate emergency response, and chaotic property safety management. The main responsibility of the enterprise is seriously lacking, especially Shiyan Dongfeng Zhongran Company has turned a blind eye to 130 gas leak alarms, pipeline pressure sensors have been in a faulty state for a long time, and other systemic hidden dangers, and people who cannot use gas leak detectors are responsible for the line patrol team.
At 20:40 on June 21, 2023, a particularly serious accident of liquefied petroleum gas explosion occurred in a barbecue restaurant in Xingqing District, Yinchuan City, Ningxia, killing 31 people and injuring 7 people. The official preliminary inference was that the explosion was caused by a leak in the liquefied gas tank. During the valve replacement process, the explosion may have been caused by sparks or static electricity. In addition, since there was no isolation device between the liquefied gas tank and the natural gas pipeline or the isolation device failed, the explosion of the liquefied gas tank on the first floor caused the explosion of the natural gas pipeline on the second floor. They used liquefied gas tanks in the operating room, did not call the police and take effective measures in time after the leak, and did not cut off the power supply or use professional tools when replacing the valve.
Non-occupational CO poisoning incidents generally refer to CO poisoning accidents that occur in the daily life of the public and in family life. According to epidemiological statistics from various places, household CO poisoning incidents occur not only in extremely cold areas (such as Qinghai Province), but also in cold areas (such as Beijing, Shanxi, Hebei), hot summer and cold winter areas (such as Shanghai, Shandong, Anhui), and even in hot summer and warm winter areas in southern China (such as Guangxi and Chongqing). It is also very common. The more consistent situation is that CO poisoning accidents mainly occur in winter when households are heating and domestic hot water is used. Literature surveys show that in winter, almost all provinces and cities from south to north in China (except Hainan Province) are in a cold and uncomfortable environment, and there is a need for heating, but the duration of cold and discomfort varies from place to place (such as Qinghai and Tibet are in cold and uncomfortable high-cold areas all year round).
The development of the urban combustible gas distributed mobile intelligent monitoring platform based on STM32H7B3I has very important practical significance. In some places, the people's government has issued a notice on the use of gas online monitoring systems. Relevant government departments have assisted in promoting gas alarm systems and fulfilling their supervisory responsibilities in accordance with the requirements of local governments. Gas supply companies have signed gas supply and use contracts with users to ensure the safety of gas users. This project uses data from tens of millions of households, enterprises, shopping malls, schools, and roads to establish a distributed three-dimensional detection platform. Hidden dangers can be discovered and eliminated in a timely manner.
2. System Block Diagram
System architecture diagram:
Principle of combustible and harmful gas monitoring:
Harmful gas collection module:
Although there are many types of gas sensors, the principles and codes are all applicable, and they all obtain the raw analog voltage value through A0. Note: Only three wires need to be connected.
- Do————Gas Sensor
- 5V-----------------VCC
- GND--------------GND
- A0--------------A0
The gas-sensitive material used in the MQ-9 gas sensor is tin dioxide (SnO2) with low conductivity in clean air. When there is combustible gas in the environment where the sensor is located, the conductivity of the sensor increases with the increase of the concentration of combustible gas in the air. It is suitable for detection devices for gas, natural gas, and liquefied gas in households or industries, and has excellent anti-ethanol and smoke interference capabilities. It is an economical sensor suitable for a variety of applications. C002 is a three-sound optional alarm voice chip. It stores the sounds of police car 110, fire alarm 119, and ambulance 120 internally, and an external oscillating resistor of 100K~240KQ (the larger the resistance, the slower the sound speed). After power is turned on, it can drive the buzzer to sound. Pin 1 is grounded, pin 2 is output, pin 3 is the sound selection end, pin 4 is connected to the positive pole of the power supply, and pins 5 and 6 are connected to the oscillating resistor. The gas detection alarm circuit uses the alarm sound of fire alarm 119.
/********************************************Gas part********************************************/
/*
wiring:
VCC------VCC
GND------GND
A0------A0
Note: This code is suitable for many gas sensors, and any sensor that looks like a microphone or a mouthpiece can be used;
The sensor needs to be powered on and preheated. The preheating time is about 3 minutes. After preheating, the sensor will be a little hot, which is normal.
/****************************************气体 part****************************************/
/*
接线:
VCC------VCC
GND------GND
A0------A0
注意:这个代码适合用于很多气体传感器,长得像麦克风或者话筒的传感器都可以用;
传感器需要上电预热,预热的时间大概在3分钟左右,预热后传感器会有点烫,是正常的情况。
*/
#define gasPin A0 //定义模拟口A0
#define gasTimesInterval 500 //500ms检测一次气体
unsigned long gasTimes = 0; //记录设备运行时间,用来控制多少时间检测一次气体
int gasVal = 0; //实时气体值
int gasStart = 0; //自适应检测到的值
int gasAverage = 0; //自适应平均值
int gasSum = 0; //自适应总值
int gasDiff = 0; //平均值和实时值的差值,用来判断是否超标
/****************************************set up and loop part*********************************/
void setup() { //程序初始化
Serial.begin(9600); //设置波特率9600
for (int i = 0; i < 30; i++) { //自适应获取模拟量
gasStart = analogRead(gasPin);
gasSum = gasSum + gasStart; //将模拟量累加
}
gasAverage = gasSum / 30; //求自适应的平均值
Serial.println("设备上线!");
}
void loop() { //程序主体循环
getGasData(); //获取气体的值
}
/****************************************气体 part****************************************/
/*获取气体的值*/
void getGasData() {
if (millis() - gasTimes >= gasTimesInterval) { //一定时间检测一次
gasTimes = millis();
gasVal = analogRead(gasPin); //获取实时的气体模拟值
gasDiff = gasVal - gasAverage; //求差值
Serial.print("初始平均值:"); //串口输出对应的值
Serial.print(gasAverage); //串口输出对应的值
Serial.print(" ,实时原始值:"); //串口输出对应的值
Serial.print(gasVal); //串口输出对应的值
Serial.print(" ,两者的差值:"); //串口输出对应的值
Serial.println(gasDiff); //串口输出对应的值
}
}
EG25 Global Communication Module
Low-power NB modules are suitable for battery-powered residential building data collection subsystems
overall:
remote control
AT9S Pro is a 12-channel transmitter that supports 2.4G DSSS and FHSS dual hybrid spread spectrum, and 16-channel pseudo-random frequency hopping. The transmitter hardware description is shown in the figure below. How powerful is the anti-interference ability of the Radio Frequency Remote Controller? Legend has it that at the flying field, as long as the Radio Frequency Remote Controller is turned on, Futaba and JR may lose control. It is equipped with the R12DS receiver, which uses the latest dual spread spectrum technology. This receiver has 12 channels, but only 11 sockets, so if you want to use all 12 channels, you must use the SBUS function. There is a socket for the return module on it, the frequency key is on the side, and there are two super long antennas.
GNSS RTK global positioning differential system enables smart cars to perform high-precision centimeter-level positioning and navigation
输出实例:
$GNRMC, 073114. 00,A, 2237. 56240,N,11401.59614,E,1.329, 21.11,020916,,,A,V*37$GNVTG,21.11,T,,M,1.329,N,2.462,K,A*1B
$GNGGA, 073114.00,2237.56240,N,11401. 59614, E, 1, 12, 0. 78, 112.9,M,-2. 5, M,,*54$GNGSA, A, 3,19,05,02, 06, 17, 12, 09, 13,,..,1.48,0.78,1.26,1*01$GNGSA, A, 3, 69, 83,84, 70,68,82,,,,,,,1.48,0.78,1.26,2*0E
$GPGSV, 4, 1, 13, 02, 46, 340, 36, 05, 52, 254, 37, 06, 42, 041, 41, 09, 22, 053, 40, 0*6E$GPGSV, 4, 2, 13, 12, 32, 282, 35, 13, 13,185, 33, 17, 36, 131, 37,19,57,119, 44, 0*66$GPGSV,4, 3, 13, 20,03, 237,,23,00,038,,25, 09, 311, 19, 42, 51, 128, 32, 0*60$GPGSV,4,4,13,50,46,123,33,0*50
$GLGSV, 2, 1, 08, 68, 25, 027, 39, 69, 78, 011, 36,70,40, 213,43, 74,00,259,,0*78$GLGSV, 2, 2, 08, 82, 06, 124, 36, 83, 46, 085, 44, 84, 44, 358,41, 85, 05, 324,14, 0*74$GNGLL,2237.56240,N,11401.59614.E.073114.00,A.A*7C
Landed projects
3. Functional description of each part (combined with pictures and text)
Combustible gas collection ADC
BC260,EG25 H7 serial port
Remote control SMBUS serial port
Car remote control CAN bus
Huawei Cloud and Alibaba Cloud IoT platforms provide secure and reliable connection and communication capabilities for devices, connecting to a large number of devices and supporting device data collection on the cloud. They also provide cloud APIs on the upper side, and the server sends instructions to the device side by calling the cloud API to achieve remote control. The IoT platform also provides other value-added capabilities, such as device management and rule engines, to empower various IoT scenarios and industry developers. Device access to the IoT platform supports the connection of a large number of devices to the cloud, and the device and the cloud can communicate stably and reliably in two directions through the IoT Hub.
1) Provide device-side SDK, drivers, software packages, etc. to help different devices and gateways easily connect to Alibaba Cloud.
2) Provide access solutions for different network devices such as cellular (2G/3G/4G/5G), NB-IoT, LoRaWAN, Wi-Fi, etc. to solve the pain points of heterogeneous network device access management in enterprises.
3) Provide device-side SDKs for multiple protocols such as MQTT, CoAP, HTTP/S, etc., which can meet both the real-time requirements of long connections and the low power consumption requirements of short connections.
4. Source code of the work
5. Demonstration video of the work’s functions
6. Project Summary
This project is quite large. The highlight of the project is that it has built a distributed systematic combustible gas monitoring system, providing three-dimensional inspection, all-weather, complex all-terrain, and underground full detection. Based on the STM32H7 platform, it has built an RTK centimeter-level positioning smart car, which can perform centimeter-level navigation. The algorithm is being improved, and NVIDIA GPU or high-performance AI computing unit will be added later to realize the automatic search for leakage points based on the strength of combustible gas, so that the smart car of Xiaotian Dog can monitor leakage. Enterprises and institutions are welcome to discuss specific cooperation with me.
- other
|