【Warehouse temperature and humidity automatic control simulation system】- Work submission
[Copy link]
Warehouse temperature and humidity automatic control simulation system
Author: sunduoze
1. Introduction
The warehouse temperature and humidity automatic control simulation system uses RSL10 as the controller to simulate the temperature and humidity control of the factory warehouse. The sensor control node collects information on temperature, humidity, light and air pressure. The mobile phone APP can actively connect and obtain feedback from multiple nodes and draw curves. When the temperature or humidity is high, the refrigeration air conditioner or dehumidifier is turned on, otherwise it is turned off. When the temperature, humidity or light is abnormal, it is judged as a fire signal and an alarm is issued; the mobile phone APP can send tasks to the sensor control node for active control. The transmission node sends and receives Bluetooth information through the serial port to realize the interaction between the mobile phone and the computer. The compatible design enables 3 hardware to share 1 application firmware and FOTA can be realized with the mobile phone APP.
2. System Block Diagram
- Hardware Framework
The hardware system consists of 2 sensor control nodes (ON Semiconductor RSL10 Sensor board) and 1 transmission node (ON Semiconductor RSL10 002GEVB board).
-
- 1 sensor control node
The sensor control node uses the ON Semiconductor RSL10-SENSE-DB-GEVK evaluation board. The onboard BME680 environmental monitoring sensor can be used to detect environmental temperature and humidity, air pressure, CO2 and other information; the onboard LV0104CS sensor can be used to detect light intensity. When a fire occurs, the light exceeds the normal threshold, so it is of auxiliary detection significance; the onboard LED is used to display the connection status and assist in debugging. The PB1 button is used to clear the status information recorded in the EEPROM of the N24RF64 when the power is turned on . The PB2 button can be used to select the sensor node number (actually 2 boards are applied for. After the power is turned on, the state of this button is detected to select the board number, pressed=Sensor 2 ); the manually welded OLED can be used to print sensor information, control information, board information, etc.
-
- Transport Node
The transmission node uses ON Semiconductor RSL10-002GEVB , and uses the onboard J-link virtual serial port to interact with RSL10 for serial port DMA . The internal UART of RSL10 is linked to Bluetooth . The mobile phone APP connects to this node via Bluetooth, and the node connects to the computer to realize the interaction between the mobile phone and the computer.
-
- Hardware ID matching implementation
This design uses IOs such as D03 , D05, and DIO12. When the program is initialized, different states are detected to achieve matching of the program to the board.
- Software Framework
- Software main program running block diagram
-
- Software subroutines
- APP_Timer Task: Detect and process battery voltage (shielded)
- LED_Timer task: handles the LED status indication in different BLE states
- sensor_timer task : detect sensor information, execute control logic, refresh OLED data, package sensor information and status information data and send it via BLE
- ctrl_timer task: used for debugging. Since global variables will cause Segger-RTT to be unusable, the control task is completed in sensor_timer .
- The BLE message processing task includes the following specific tasks:
GAPM_CmpEvt,GAPM_ProfileAddedInd,GAPC_ConnectionReqInd,GAPC_DisconnectInd,GAPC_ParamUpdatedInd,GAPC_ParamUpdateReqInd
- BLE customer service processing tasks include the following specific tasks:
GATTC_ReadReqInd,GATTC_WriteReqInd,GATTM_AddSvcRsp,GATTC_CmpEvt
In GATTC_WriteReqInd , a custom data parsing task is added for the host computer to send to BLE . This part also includes receiving BLE data and sending it to UART via DMA .
-
- Mobile software processing ( due to different Android versions, the interface may be different )
Using the Bluetooth debugger APP on Android phones, we developed an application for sensor control nodes, which includes the display of various sensor information and can also display data waveforms. The node display can be controlled by buttons.
3. Description of some functions
- The software automatically matches. By using IOs such as D03, D05, and DIO12 , the same APP can be adapted to different hardware ( the COIN board is not used for the time being, but it can still be adapted). The following table is the public resource allocation information of various official boards of ON Semiconductor.
PART
|
002GEVB board
|
Sensor board
|
Coin board
|
Function
|
Common
|
D00
|
-
|
*led_r*
|
|
|
led_r
|
D01
|
-
|
*led_g*
|
|
|
led_g
|
D02
|
-
|
*led_b*
|
|
|
led_b
|
D03
|
ext_io-H
|
ext_io-L
|
ext_io
|
*
|
ext_io
|
D04
|
U1_Rx
|
SDA
|
TP1
|
|
sda sensor
|
D05
|
**BTN1**/U1_Tx
|
SCL
|
TP2-L
|
*
|
scl-sensor
|
D06
|
*OF_LED*
|
MEMS_DO
|
-
|
|
led
|
D07
|
SCL
|
-
|
-
|
|
-
|
D08
|
SDA
|
-
|
-
|
|
-
|
D09
|
-
|
INT--
|
-
|
|
-
|
D12
|
-
|
**BTN2**
|
-
|
|
button2
|
D15
|
-
|
**BTN1**
|
-
|
|
button1
|
- Sensor control node BME680 driver. The BME680 sensor is called by calling the BESC library. This sensor contains data such as temperature, humidity, air pressure, CO2, and respiratory VOC. The program summarizes the global reference of the output variable of the bsec_env_output_struct structure to realize the application layer call of the sensor data.
- Sensor control node LV0104CS driver. This sensor is used for PIN2PIN to replace NOA1305CUTAG ambient light sensor. A separate driver is built to realize the LUX display of ambient light and the application layer call is realized through the lv0104cs_read_lux_data function.
- Sensor control node OLED driver. OLED is a low-power display screen, connected to RSL10 via I2C interface. The screen is used for debugging content printing, sensor status display, APP control signal display and fire alarm information feedback.
- Transmission node. The transmission node uses the onboard J-link virtual serial port to interact with RSL10 for serial port DMA, and the internal UART of RSL10 is linked to Bluetooth. The mobile phone APP connects to this node via Bluetooth, and the node connects to the computer to realize the interaction between the mobile phone and the computer.
4. Source Code
仓库温湿度自动控制模拟系统.zip
(1.1 MB, downloads: 5)
apk is an Android application (you can go to the market to download the "Bluetooth Debugger"), bin can be opened directly with this program, and then you can edit and modify it yourself. Define your own data format.
android.apk
(2.63 MB, downloads: 2)
仓库温湿度自动模拟控制系统_V_20210622-233656.pro..bin
(2.47 KB, downloads: 2)
5. Demonstration video of the work’s functions
Bilibili
FOTA is not demonstrated here, you can jump to this link to view: [Warehouse temperature and humidity automatic control simulation system] 9. RSL10 FOTA app adaptation
6. Project Summary
1. This is a great practice case. For me, I can say that I have a deep understanding of Bluetooth from 0 to 1. It is a brand new chip, a brand new IDE, and the hardware version is also newer than the release document. This process is very challenging. The whole development process is very painful, and I want to give up. But after a while, I have made some breakthroughs. I have come to where I am now step by step. After the pain, there will be rebirth. Thanks to the organizer and EEWORLD, and thanks to the administrator lady for cheering me up again and again during the process.
2. During the development process, the biggest impact on the entire development process should be the MESH networking. Through the official examples, basic control functions were realized, but because I lacked too much, the official Android app did not have source code. Later, I turned to the WeChat applet to try, but it was fruitless. The entire project merging process was full of thorns, and I finally gave up. I thought that because of the delicious function of MESH, I decisively gave up Keil and turned to Onsemi IDE. This step was too big, and I wanted to eat a fat man in one bite, but unexpectedly... Later, I stopped entangled in this, and went back to drive the sensors one by one. Slowly, I regained my confidence and walked down slowly.
3. After the development of the entire project, the current project can be used as a basic module. Many Bluetooth application scenarios are nothing more than master-slave interaction. On this basis, adding more sensors for functional adaptation and expansion can be 72 changes. If the warehouse temperature and humidity automatic control system has high requirements, the entire system is much more complicated than this prototype, and the reliability of the industrial environment is the key. There are many details that can be expanded in the content of the temperature and humidity control part, so there is a lot of room for improvement. Here I just use this topic to learn some new devices, get in touch with some new fields, broaden myself, and share what I have learned so that later generations can avoid detours. That's all.
4. In addition, complaints are still indispensable. For ON Semiconductor's IDE and example programs, the engineering styles are varied, which is very difficult for beginners, and the threshold is raised invisibly. Some key codes are directly in the library. Sometimes I want to look inside but I don't know where to start (I haven't found the source code yet). In the process of using the IDE, static variables will cause UART transmission failures, newly added global variables will cause RTT to be unusable, and many codes cannot be interrupted for unknown reasons. These weird problems took a lot of effort. You must have a flexible mindset and can't just go down one path. This is very important in this activity.
[Warehouse temperature and humidity automatic control simulation system] 9. Adaptation of RSL10 FOTA app
[Warehouse temperature and humidity automatic control simulation system] 3. RSL10 BLE Mesh networking first experience
[Warehouse temperature and humidity automatic control simulation system] 2. ON Semiconductor IDE Eat (tian) melon (keng)
go go go, let the RSL10 LED start flashing (there is a small easter egg at the end of the article )
RSL10 family unboxing photos
VII. Others
仓库温湿度自动控制模拟系统_sunduoze.docx
(6.11 MB, downloads: 0)
|