This paper presents a constant temperature and humidity controller based on Internet of Things cloud service platform.
The hardware design of the controller is introduced in detail from the aspects of processor, Ethernet module, temperature and humidity sensor and I2C interface, relay module and current output module. The actual results show that the controller has good performance, high reliability, strong expansibility and meets the design requirements.
Constant temperature and humidity control system is widely used in workshops, exhibition halls, archives, laboratories and other places in various industries. With the development of social economy, the scientific and technological level and production requirements of various industries are getting higher and higher, especially the requirement of keeping constant indoor temperature and humidity to meet the high technological requirements [1]. Constant humidity and humidity control system is mainly composed of controller, heater, thermostatic element humidifier and surface cooler. The main function of the heater is to preheat and reheat the cold air; the humidifier mainly humidifies the air; the surface cooler mainly cools the air and takes into account the dehumidification function. The design of constant temperature and humidity system needs to take into account the changes of indoor heat, humidity load and outdoor temperature conditions. In order to achieve this goal, engineers often need to spend a long time to study the model of the controlled object. In this paper, a constant temperature and humidity controller is designed, which uses PID algorithm and fuzzy algorithm to control temperature and humidity. Combined with Internet of Things cloud service platform, remote measurement and remote control functions are realized by mobile phone APP software. The constant temperature and humidity control system consists of controller, temperature and humidity sensor, heater, humidifier, cooler, humidifier, Internet of Things cloud server and mobile APP. The controller consists of processor, relay module, Ethernet module, I2C interface, indicator lamp, buzzer, touch LCD screen and 4-20mA current output module. The controller reads the temperature and humidity values from the temperature and humidity sensors, and calculates them by the combination of PID algorithm and fuzzy algorithm.
According to the calculation results, the running time and stopping time of heater, humidifier, cooler and dehumidifier are controlled to realize the function of constant indoor temperature and humidity. The controller converts the current temperature and humidity values into current values, and outputs them to other devices through 4-20mA current output module.
The controller displays the current temperature value, humidity value, relay closing time and disconnecting time, parameters of PID algorithm and fuzzy algorithm through LCD screen. Users can modify these data through touch screen.
At the same time, the controller uploads these data to the Internet of Things cloud server through the Ethernet module. Users can use mobile APP to log on to the cloud server of the Internet of Things and view the current data of the system remotely. They can also use mobile APP to remotely adjust the parameters of the PID algorithm and the fuzzy algorithm, and upload them to the cloud server. The cloud server pushes the parameters of the algorithm to the controller, which uses the latest parameters of the algorithm to achieve the function of constant temperature and humidity. Controller needs 4 I/O pin control relays, 5 SPI interface network chips, 7 I/O pin control DAC chips and touch chips, 2 I/O pin control indicator lights, 1 I/O pin control buzzer, 2 I/O pin control I2C interface temperature and humidity sensors, 21 I/O pin control LCD screens, a total of 42 I/O pins. Therefore, a 32-bit microcontroller STM32F103RBT [3] based on ARM Cortex-M3 core is selected.
It has 49 I/O pins, 20K SRAM, 128K FLASH, 2 SPI serial interfaces working in master-slave mode and 7-channel DMA controller. It has hardware multiplier and divider components, which can realize one-cycle multiplication and division. These abundant peripheral configurations greatly reduce the development cost of the system and shorten the development time. The system uses W5500 produced by WIZnet Company. W5500 has eight independent port Sockets for simultaneous communication, integrates TCP/IP protocol stack, supports TCP, UDP, IPv4, ICMP, ARP, IGMP and PPPoE protocols, embedded 32K byte on-chip cache for Ethernet packet processing, supports 10/100M Ethernet data link layer (MAC) and interconnection layer (PHY). W5500 supports up to 80MHz SPI interface, which makes it easier to integrate with peripheral MCU and better realize the adjustment of network communication. In order to reduce system energy consumption, W5500 provides network wake-up mode and power-off mode for customers to choose and use. SHT11 is selected as temperature and humidity sensor in the system.
SHT11 includes a capacitive polymer humidity sensor, a temperature sensor made of energy gap material, and seamless connection with 14-bit A/D converter and serial interface circuit on the same chip. It has the advantages of excellent quality, rapid response, strong anti-interference ability and high cost performance. I2C interface circuit needs to have functions of over-current protection, power supply anti-reverse connection, and communication interface with certain electrical isolation and protection. As shown in Fig. 1, the circuit chooses 0.
5A self-recovery fuse F2 to realize over-current protection function; when the outflow current to the sensor is too large, the fuse F2 automatically breaks; when the sensor returns to normal, the fuse F2 automatically passes through. The rectifier diode D7 is used in the circuit, and the anti-backconnection function of the power supply is realized by the unidirectional conductivity of the diode. Resistors R17 and R18 are selected to realize certain electrical isolation function. The circuit chooses two-way two-way TVS tube parallel I2C communication pin to realize certain electrical protection function; when the communication pin exists over-voltage phenomenon, the TVS tube leads on and reduces the pin voltage; when the communication pin returns to normal, the TVS tube cuts off.
The system uses Omron G5SB-14-24VDC relay, whose circuit is shown in Figure 2. The TVS tube is connected in parallel between the common output foot and the normal open foot of the relay. The actual test shows that the relay has good arc extinguishing effect when it operates in close and open mode. The reverse rectifier diode D3 is connected in parallel at both ends of the coil of the relay.
When the coil is cut off, it acts as a continuation current. When the relay is closed, the light-emitting diode brightens, and when the relay is disconnected, the light-emitting diode dies out, playing the role of relay action indication. In the base parallel circuit R6 of the transistor, the base level can be stabilized. When the processor is reset or abnormal, the base level is low, the relay keeps off, the external heater and other equipment are in stop working state and will not work in disorder. The system uses Jinshengyang F2424S-2WR2 as power isolation and outputs 24VDC for current output. Therefore, current output supports two-wire connection. At the same time, L7805 is used to output 5VDC to supply power to DAC chip.
Jinshengyang F2424S-2WR2 module has the characteristics of sustainable short circuit protection, working temperature ranging from – 40 to 105 C, high efficiency of 86%, high power density, small SIP package and isolation voltage of 3000VDC. According to the design reference of the manual, capacitance C20 and C22 can further reduce the input and output ripple. The circuit composed of capacitance C21, C19 and inductance LH3 has certain EMC function, as shown in Figure 3. The controller program is developed based on uC/OS operating system, and three tasks are established, which are Ethernet communication task, temperature and humidity acquisition task and LCD GUI interface task. The main program first initializes all hardware, including indicator, buzzer, relay, I2C, SPI, LCD screen, etc. Then initializes the uC/OS operating system, creates three tasks, starts the uC/OS operating system, and the system schedules the three tasks, as shown in Figure 4.
The task of Ethernet communication is used to communicate with Internet of Things cloud server. First, the Ethernet interface pins are initialized by hardware, IP address, subnet mask, default gateway and other network parameters are set, and then all the data of the controller are uploaded to the Internet of Things cloud server, as shown in Figure 5. Temperature and humidity acquisition task is mainly to collect temperature and humidity values, and carry out PID algorithm and fuzzy algorithm, according to the results of the algorithm control relay closure time and disconnection time. The test of cloud service platform of Internet of Things includes three parts: website, mobile app software and controller. Web site and mobile phone APP software can display the historical curve of temperature and humidity of the controller, and modify the parameters of PID algorithm and fuzzy algorithm on the controller. The constant temperature and humidity controller designed in this paper first reads the temperature and humidity values of the sensor, then executes the PID algorithm and the fuzzy algorithm. According to the results of the algorithm, the closing time and the disconnecting time of the relay are controlled.
Then all the data of the controller are displayed on the LCD screen and uploaded to the Internet of Things cloud server. Users can modify the parameters of PID algorithm and fuzzy algorithm on touch LCD screen, website and mobile phone APP software. The actual results show that the controller has good performance, high reliability, strong expansibility and meets the design requirements.