Hardware

Hardware

Hardware
turn stick

//quote

The hardware group mainly connects and assembles each sensor module through the STM32F407 series microcontroller, and wires and adjusts the relevant values through the PCB board and chip resistors and capacitors, so as to achieve the purpose of data acquisition and prediction in combination with the LSTM model.

//quote

1. Basic Sensor Selection Scheme

We choose to use MG812 sensor to monitor CO2 concentration.

MG-812 is a semiconductor oxide sensor that uses the solid electrolyte cell principle to detect CO2. When the sensor is maintained at a certain operating temperature and placed in a CO2 atmosphere, electrode reactions occur between the positive and negative electrodes of the battery, generating an electromotive force between the sensor’s sensitive electrode and the reference electrode. The output signal voltage is inversely proportional to the logarithm of the CO2 concentration, and changes in CO2 concentration can be detected by testing changes in signal voltage.

//img_wrap

fig1

fig2

fig9

//img_wrap

The module only has 4 interfaces, VCC is connected to the power supply, GND, and AO are connected to the ADC pin of the MCU to obtain the output voltage of the module, and then the CO2 concentration in the environment is calculated based on the linear relationship between the output voltage signal and the CO2 concentration.

There are two things to note. Firstly, the output voltage signal of the module has been amplified by 8.5 times, and the range of the output voltage is 0-5V, which exceeds the measurement range of ADC3.3V. It needs to go through a simple linear conversion circuit before being connected to the ADC. The slope of the module’s curve needs to be recalculated. Place the module in a fresh air environment and power it on for 48 hours. Measure the output signal with a multimeter to obtain the voltage value V at a CO2 concentration of 400ppm (the typical CO2 concentration in the environment). Then, calculate the true slope of the module’s curve with the curve (lg1000, 0.296).

We choose RSCM1700 sensor to monitor the air pressure value.

The RSCM17100KP201 pressure sensor module integrates a Wheatstone bridge sensor and conditioning chip. The module contains circuits for differential amplification, automatic calibration, temperature compensation, etc. It can directly output an analog voltage, and the ADC port of the MCU can read this voltage to determine the corresponding pressure value.

//img_wrap

fig3

//img_wrap

We use AM1011A sensor to monitor temperature and humidity

This sensor can simultaneously detect environmental temperature and humidity. The voltage output of humidity can be directly connected to the ADC of the MCU, and the environmental humidity value can be calculated through a linear relationship. The module has a built-in thermistor, which needs to be connected in series with a 10K resistor. The thermistor value can be obtained by measuring the voltage on the resistor, and then the ambient temperature value can be obtained.

2. Schematic&PCB

The core board ADC of the STM32F4 has poor performance when used directly. There is a fixed deviation between the actual voltage and the measured voltage, mainly due to the unstable reference voltage of the core board ADC. Therefore, the REF23 chip is used here as the reference voltage of 3.3V.

The following diagram is a schematic diagram

//img_wrap

fig4

//img_wrap

3. Program Design

Using the general template routine provided by the STM32F407 microcontroller, open the four channels of ADC1, input the voltage values to be detected, and then calculate the CO2 concentration, temperature and humidity, and air pressure values based on different curves. In a for loop, use the delay function to ensure that a surrounding environmental value is measured within 30 seconds. This way, only 26012=1440 arrays are needed to store the environmental temperature value.

The last recorded value can be exported as a txt file for subsequent processing with a small function in Function Editor in debug mode

//img_wrap

fig5

Hardware assembly physical picture

fig6

Program testing results

//img_wrap

4. Practical application

4.1 Stability

The hardware stability of this monitoring device has undergone a month long test. From the beginning to one month later, the measurement change of the monitoring device was less than 0.5%, indicating its high stability. We used high stability resistors and capacitors for circuit design and innovatively improved the circuit structure to make the ADC signal input more stable and accurate. Coupled with high stability and high durability sensors, the stability of the entire device is very high.

//img_wrap

fig7

We used this hardware device to continuously measure the CO2 concentration in a sealed space for 48 hours, and the results showed that the instrument’s measurement was stable, with the maximum and minimum readings differing by less than 0.1%.

//img_wrap

4.2 Adaptability

Our sensors can adapt well to the fermentation tank environment. In order to further improve the adaptability of the equipment, we have packaged the exposed sensors to prevent some chemical reagents in the laboratory from damaging the sensors.

//img_wrap

fig8

//img_wrap

4.3 Cost

The sensor cost of this equipment is 137 yuan, the microcontroller cost is 80 yuan, the PCB board and corresponding resistor and capacitor costs are 30 yuan, and the overall equipment cost is about 250 yuan, indicating its high economic practicality

Spare parts Cost
STM32F407 microcontroller 11.4106 dollar
MG812 sensor 19.5406 dollar
Temperature, humidity, and air pressure sensors 2.8526 dollar
PCB board 2.8526 dollar
Resistance and capacitance 1.4263 dollar
Other connecting materials 0.7132 dollar
total 38.7959 dollar

References

//referrence

[1]Principles and Applications of Single Chip Microcontrollers, Third Edition,Zhang Yigang, Zhao Guangquan, Liu Wang,Higher Education Press

[2]Electrical Engineering ,Seventh Edition,Qin Zenghuang, Jiang Sanyong,Higher Education Press

[3]Fundamentals of Analog Electronic Technology, Sixth Edition,Hua Chengying, Ye Zhaohui,Higher Education Press

[4]Design of Remote Circuit Parameter Monitoring System for Internet of Things Based on STM32

Sun Kangya, Gao Hongliang, Duan Yulong, Zhou Chengzi, College of Electrical Engineering and Automation, Hubei Normal University, DOI: 10.19557/j.cnki.1001-9944.2024.02.031

[5]Design of Temperature and Humidity Monitoring System for University Electrical Laboratory Based on STM32, Ma Bo Jing, Zhang Huiling, Yu Bingwei, Wang Yuxiao, Bao Zihong, Zhang Yiyue, Jin Wanrong, Zhejiang Guangxia Construction Vocational and Technical University Intelligent Manufacturing College, DOI: 10.19557/j.cnki.1001-9944.2024.02.031

[6]Physiological parameter multi-point monitoring system and circuit design based on STM32 and filtering algorithm, Wang Tao1,2 Tian Ruizhi 1 Zhao Youming 1 Zhang Qingzhe 1 Zhang Tianchang 1 Yi Maoxiang 1, School of Electronic Science and Applied Physics, Hefei University of Technology, National Demonstration, Microelectronics College 2. School of Information Science and Technology, University of Science and Technology of China, DOI: 10.19557/j.cnki.1001-9944.2024.02.031

[7]Design of Ship Exhaust Emission Monitoring System Based on STM32, Zhong Rui 1 An Bowen 1 Chen Wei 2 Ni Xunpeng 2 Pan Shengda 1, School of Information Engineering, Shanghai Maritime University 2. Pudong , Maritime Safety Administration Hazardous Management and Pollution Prevention Center, DOI: 10.13873/J.1000-9787(2022)02-0094-03

//referrence