Frontiers in Computing and Intelligent Systems ISSN: 2832-6024 | Vol. 13, No. 1, 2025 41 Design and Implementation of Intelligent Water Dispenser System Kunlin Miao, Runliu Wang Zhengzhou University of Light Industry, Zhengzhou Henan, 450000, China Abstract: With advancing technology and rising living standards, smart home appliances are experiencing growing market demand. As essential devices in both residential and public environments, water dispensers play a vital role in daily hydration. However, conventional water dispensers often fail to meet personalized user requirements and present numerous operational limitations. To address these challenges, this study develops an intelligent water dispenser system utilizing an STM32 microcontroller. The system implements key functional modules including precision temperature regulation, WiFi-enabled wireless communication, audible alarm notification, and automated dispensing control. The proposed system employs an STM32 microcontroller as its central processing unit, featuring an optimized hardware architecture that ensures robust inter-component synchronization through carefully designed circuit implementation. On the software level, the system integrates dedicated control algorithms for precise temperature regulation, intelligent alarm mechanisms, and wireless communication protocols. Extensive experimental validation confirms the system's operational stability across all functional modules. Compared with conventional solutions, this STM32-based intelligent water dispenser not only retains core functionalities but also significantly enhances user- customizable features and operational efficiency. Keywords: Intelligent Water Dispenser; Automatic Mode; Internet of Things. 1. Introduction In the rapidly evolving information age, IoT technologies and intelligent systems have become deeply integrated into all aspects of modern life. This transformation is particularly evident in home environments, where conventional devices are being progressively upgraded with smart capabilities - including daily-use water dispensing equipment. Traditional water dispensers increasingly demonstrate functional limitations, particularly in terms of operational flexibility and intelligent features. To address these shortcomings, next- generation smart water dispensers have emerged as an innovative solution. They not only provide efficient water heating with precise temperature adjustment capabilities but also incorporate intelligent sensor-based control mechanisms. Furthermore, they enable remote operation and user interaction through connected interfaces. Such sophisticated functionality better aligns with contemporary demands for smart home integration and personalized user experiences. This research focuses on developing an intelligent water dispenser system based on STM32 microcontroller technology[1]. Beginning with an analysis of the STM32's operational principles and technical characteristics, the study systematically progresses through the complete design and implementation process[2]. The hardware architecture is carefully designed according to the functional requirements and STM32's capabilities, while software development leverages the microcontroller's library functions for optimal implementation. Following comprehensive system testing and performance optimization, the final design delivers a practical, stable, and user-friendly intelligent water dispensing solution. 2. Current Research Status With the continuous development and progress of modern science and technology, society is increasingly moving towards digitalization, and Internet of Things (iot) technology is gradually entering people's lives. At first, the main function of a water dispenser was merely to provide hot water and purified water[3]. However, with the advancement of technology, this market has gradually developed, adding more functions and options. For instance, water temperature can be adjusted, and some water dispensers even have the ability to purify water quality[4]. However, while the domestic water dispenser market is developing rapidly, it has also exposed many problems[5]. Most water dispensers are cumbersome to operate, consume a lot of electricity, some are highly noisy, and hygiene and safety are difficult to guarantee. According to a survey, the market demand for water dispensers is shifting towards intelligence, multi- functionality, and safety and stability. At present, the smart water dispensers on the market take energy conservation, health and convenience as important functions. The prominent automation feature of smart water dispensers can greatly facilitate people's lives and have a wide range of applications. They are also very convenient to use in some special places. In the field of smart home devices, especially the smart water dispensers based on STM32, their advantages such as accurate temperature control, automated operation mode, energy-saving design and user-friendly interface undoubtedly can well solve the existing problems of water dispensers, better meet the demands of the domestic market, and provide people with convenient and high-quality drinking water. In recent years, the trend of intelligence and environmental protection has become increasingly evident in the water dispenser market. Many consumers in Europe and America have begun to shift their demands for water dispensers towards high-quality experiences such as intelligent control and energy conservation and environmental protection[6]. However, products that achieve these functions are still relatively few in the market. The STM32 microcontroller will 42 bring new opportunities to this market. Its powerful functions and high performance make the development of smart water dispensers possible[7]. For instance, it can precisely control temperature and automatically perform tasks, all of which meet the demands of foreign consumers. 3. System Function Description 3.1. Temperature Detection Function In the intelligent water dispenser system, to meet users' demands for drinking water temperature, the temperature detection function is particularly important. This function ensures that the water dispenser can provide water at an appropriate temperature, meeting the drinking needs of users in different situations. The temperature detection function not only affects the user experience but also involves the efficiency of energy conservation and the safety of equipment operation. The main task of temperature detection is to continuously monitor water temperature and ensure that it is within the range set by the user. When the water temperature detected by the system deviates from the set value, it can automatically start heating to adjust to the appropriate temperature. The realization of the temperature detection function relies on temperature sensors. High-precision digital temperature sensors compatible with STM32, such as DS18B20, have been selected. This type of sensor directly outputs digital signals, which are easy for STM32 to read and reduce the interference of analog signals, thereby improving the accuracy of detection. 3.2. Data Collection and Processing The STM32 is connected to the temperature sensor via a serial communication interface and regularly reads the temperature data. The digital output of the sensor makes data acquisition and processing much simpler. By writing the corresponding driver program, STM32 can obtain temperature data at regular intervals and store it in the internal memory. 3.3. Temperature Control Logic The temperature control logic is the core of this function. The system controls the on and off of the heater by comparing the real-time water temperature with the preset water temperature. 3.4. User Interface Users can easily set the required water temperature through the user interface. The system can also display the current water temperature, allowing users to intuitively understand the status of the water dispenser and adjust the preset temperature as needed. In summary, the temperature detection function, through high-precision sensors, effective data processing, and intelligent temperature control strategies, provides users with instant hot or cold water that meets their needs. The entire design process fully demonstrates the powerful performance and multi-functionality of the STM32 microcontroller, making the smart water dispenser more in line with the needs of modern families. 3.5. Heating Temperature Mode Function To better serve users and meet more diverse water demands, the intelligent water dispenser system based on STM32 is equipped with the function of switching between heating and normal temperature modes. This function also reflects the energy-saving and user-friendly features of the smart water dispenser. The heating/room temperature mode function involves the water dispenser's understanding and response to the user's usage scenarios. It can flexibly switch between maintaining water temperature and heating water temperature according to the user's actual needs. When the system is in heating mode, it will use the internal heater to raise the water temperature to the preset water temperature by the user. The STM32 controller is responsible for monitoring and regulating the working status of the heater to ensure that the heating is automatically cut off when the target temperature is reached, preventing overheating and energy waste. In normal temperature mode, there is no need for a heating function, and the water dispenser will provide room- temperature water. Users can select the heating or normal temperature mode through the interface. Summary: The heating/room temperature mode function enables the water dispenser to serve the needs of different users. The powerful functions and flexible programming capabilities of STM32 make this feature possible, thereby enhancing the overall value of the intelligent water dispenser system. 3.6. WiFi Transmission Control Function The WIFI transmission control function is a key component of smart water dispensers, making remote interaction between the device and users possible. This function provides information sending and receiving through wireless networks, enabling remote configuration of device parameters and real- time monitoring of their status. The WiFi transmission control function plays a crucial role. This function enables the smart water dispenser to connect to the user's mobile device or home network via wireless network, achieving remote control and status monitoring. The realization of WIFI functionality depends on the selection of the WIFI module and its effective matching with the STM32 controller. When selecting the model, factors such as power consumption, stability, transmission speed and cost should be taken into account. It is necessary to choose a module that meets the performance requirements and connect it to the STM32 through a serial communication interface. 3.7. User Interface Design Users can interact with the water dispenser through a dedicated application on their smartphones or other mobile devices. The application visually presents the working status of the water dispenser and allows users to send control instructions, such as temperature setting and mode switching. Summary: The WIFI transmission control function provides a high degree of flexibility in use and user convenience for smart water dispensers. Through remote control via wireless networks, users can manage the conditions of their drinking water more precisely and easily, while the safety and maintainability of the system are also guaranteed. The realization of this function symbolizes a significant step forward for smart homes in the process of convenience and intelligence. 43 3.8. Anti-dry Burning/Water Shortage Alarm Function In the design of the intelligent water dispenser system based on STM32, the anti-dry-burning alarm function is indispensable to ensure safe use. This function will alert the user when the water level is too low. For this reason, the anti- dry burning alarm function can be automatically activated to promptly remind the user to replenish the water source, preventing damage to the equipment and potential safety hazards caused by dry burning. The core objective of the anti-dry-burning alarm function is to monitor the water level in the water dispenser in real time to ensure that there is sufficient water during the heating process and prevent dry-burning. Once the water level is detected to be too low, the system will immediately activate the alarm mechanism and send out an alarm signal. In terms of hardware, a highly sensitive water level sensor is installed in the system to monitor the water level in the water tank in real time. Meanwhile, the system is also equipped with a buzzer for emitting warning sounds and an LED warning light, informing users in a dual way of graphics and sound. In summary, the anti-dry-burning alarm function in the intelligent water dispenser system based on STM32 not only enhances safety guarantees but also increases the intelligence level of the system. Through precise water level monitoring and timely alarm response, the risk of safety accidents has been greatly reduced, making smart water dispensers more reliable and user-friendly. 3.9. Water Outlet Function The water outlet function of the water pump is one of the core functions in the intelligent water dispenser system, which is directly related to the continuity and stability of the water supply of the water dispenser. To achieve this function, this system first needs to select an appropriate water pump and manage the start and stop of the water pump through precise control of the STM32 microcontroller. The water pump's water outlet function responds to the user's water outlet request, drives the water pump to work, and transports the water in the storage tank to the water outlet. To ensure a smooth and continuous water discharge process, this system has carefully designed the control logic of the water pump and selected appropriate hardware components to achieve this function. In the selection of water pumps, this design needs to take into account factors such as durability, power supply voltage, flow rate, and compatibility with microcontrollers. The selected water pump should have sufficient flow to meet daily usage and be capable of operating efficiently under the condition that the power supply voltage matches the output port voltage of the microcontroller. In addition, the operating noise of the water pump also needs to be controlled within a range that users can accept. 3.10. User Interface Interaction The user interface serves as a bridge for human-computer interaction and is closely linked to the water discharge function of the water pump. The STM32 microcontroller needs to process data from the user interface and convert operation instructions into water pump control signals. In conclusion, the design and implementation of the water pump's water discharge function form the foundation of the system's operation, which is accomplished through the efficient processing capabilities and diverse control methods of the STM32 microcontroller. By optimizing the selection and control logic of the water pump, as well as the coordinated operation of the entire system, it can be ensured that the intelligent water dispenser provides stable and reliable services during the user's usage process. STM32 microcontroller: As the core of the hardware system, it is used to receive various data from sensors and process them, and then drive each actuator to act based on the processing results, achieving the automatic control of the water dispenser. Temperature detection and control module: A temperature sensor is installed to detect the temperature of drinking water in real time, and the heating element is controlled by the STM32 microcontroller to reach the preset temperature. LCD display screen: It is used to show important information such as the current water temperature and operation menu, providing a good user interface. STM32 Temperature Sensor USB 5V LCD 1602 WIFI Module Buzzer Alarm Relay ControlKeyboard Module Water Level Sensor Fig 1. Overall Block Diagram of Module Functions 44 Water level sensor and alarm module: If the water level in the water tank is too low, the water level sensor will send a signal to the STM32 microcontroller. To prevent dry burning, the buzzer will perform an alarm task. WiFi transmission module: By connecting to the WiFi module, the water dispenser can be connected to the Internet, and users can remotely control it through the mobile phone APP. Relay module: Relays are used to control water pumps and heaters to ensure the safe and reliable operation of the system. Key module: The key design enables user mode selection and the temperature setting required by the user. Power module: Provides stable power supply to ensure the stable operation of the system. The overall block diagram of the STM32 system module functions is shown as Fig 1. 4. Function Design 4.1. Temperature Detection Section The DS18B20 is a digital temperature sensor applying single-bus technology launched by DALLAS Semiconductor Corporation of the United States. Its main technical features are as follows: When it is connected to a single-chip microcomputer, only one port line is needed to achieve bidirectional communication between the single-chip microcomputer and the DS18B20. It supports multiple nodes, greatly simplifying the line architecture design and hardware cost of the distributed multi- point temperature measurement system; No external components are required for temperature measurement: It can be powered by a data cable and features an ultra-low power consumption working mode: The temperature measurement range is -55 to +125℃, and the temperature measurement accuracy is ±0.5℃. The temperature conversion accuracy can be set to 9 to 12 bits through programming, and the temperature conversion value can be directly output in the form of 16-bit binary code. Because it is A digital output and only occupies a single I/O port, it is very suitable for various temperature detection and control systems controlled by microprocessors. It eliminates the A/D conversion and more complex peripheral circuits required when connecting analog temperature sensors to microprocessor interfaces, reduces the system volume, and enhances the system reliability. Each DS18B20 temperature sensor is equipped with a unique 64-bit ROM code. This code consists of three parts: The first 8 digits represent the product series code, which is used to distinguish different types of products; The middle 48 digits represent the unique product serial number, which is a distinctive 15-digit decimal code. Through addressing technology, the identification of each chip can be achieved. The last 8 bits are the cyclic Redundancy Check (CRC) code, which is used to verify the accuracy of data transmission. This unique coding system enables multiple DS18B20 sensors to communicate via a single data line without data confusion, greatly simplifying the implementation of multi-point temperature measurement. This design adopts the DS18B20 temperature sensor to detect the temperature in indoor Spaces. The DS18B20 is a digital temperature sensor. Compared with traditional temperature sensors, it outputs digital signals, which enables it to interface directly with a single-chip microcomputer and display the data on the LCD1602 LCD screen. Its small size and high sealing performance make it applicable in many different occasions, such as cold storage, grain silos, automobiles and other fields. In addition, the DS18B20's ease of use, strong anti-interference ability, high precision and other advantages also provide a guarantee for its wide application. The hardware connection circuit of DS18B20 is shown in Fig.2. Fig 2. Circuit diagram of the temperature sensor41 4.2. Key Design In the intelligent water dispenser system based on STM32, the button design is an important component of the user interface. This system adopts touch keys to provide a simple and modern appearance and operation feel. One end of the key is pulled up and connected to the GPIO port of the STM32 microcontroller, while the other end is grounded. The jitter removal function is achieved through software delay clipping to ensure the accurate response of the key. The key functions include temperature increase and decrease, heating, and water outlet control. The signal triggered by each key will be captured by the interrupt management system of the STM32 and trigger the corresponding service program to achieve a rapid response to the user's input requirements. When a key is pressed, it will pull up or down the corresponding GPIO electrical signal. The STM32 microcontroller determines whether a key has been pressed by monitoring the changes in the GPIO electrical signal and processes it. By writing the key scanning function into the program, the functions that this system needs to achieve are executed. The Water Sensor is a cost-effective and user-friendly water level identification and detection sensor. It measures water droplets or water volume through a series of exposed parallel wires, thereby determining the water level. This sensor can easily convert the changes in water level into signals of high and low levels, and these signals can be directly read by the single-chip microcomputer. This module mainly utilizes the current amplification principle of transistors: When the liquid level height causes the base of the transistor to conduct with the positive terminal of the power supply, a certain magnitude of current will be generated between the base and the emitter of the transistor. At this time, a current of a certain amplification factor will be generated between the collector and the emitter of the transistor. This current passes through the resistance of the emitter to generate a characteristic voltage, which is collected by the AD converter.42 Circuit design: The Water Sensor is installed in the water tank of the water dispenser, and the two ends of the sensor are 45 connected to the ADC (Analog-to-Digital Converter) channel of STM32. By using the on-board ADC of the STM32 for voltage measurement, water level information can be indirectly obtained. AD conversion: The STM32 reads the voltage across the sensor through its ADC module. As the water level rises, the resistance decreases and the voltage drops. The current water level height is obtained through calculation. VCC (+) : Positive terminal interface of the power supply. Connect the positive terminal of an external power supply of 3 to 5V to the 5V or 3V pin of the single-chip microcomputer. GND (-) : Power negative terminal interface, external power negative terminal or ground GND, connected to the GND of the single-chip microcomputer. AO (S) : Analog signal output port, connected to the ADC acquisition pin of the single-chip microcomputer. 4.3. Buzzer Alarm Circuit In the intelligent water dispenser system, the buzzer alarm circuit is a crucial notification component, responsible for alerting users when there is no water. By monitoring the signal from the water level sensor, once a water shortage state is detected, the system will activate the buzzer to emit a sound to alert the user. 43 An electromagnetic buzzer is selected. This model of buzzer can operate normally at a working voltage of 5V and is suitable for use with STM32 microcontrollers. After being powered on, the IO port of the STM32 microcontroller outputs a high-level signal. To control the buzzer to sound, a high-level conduction type transistor should be selected. In this design, the NPN transistor of model S8050 is used. The reason for choosing the S8050 type NPN transistor is that its high-level conduction characteristic matches the IO port of the STM32 microcontroller, ensuring that the buzzer can conduct and sound at the given high level. The base of the transistor is connected to the IO port through a 1KΩ resistor. The purpose is to limit the base current required to drive the transistor and prevent damage to the IO port of the single-chip microcomputer. The connection method of the circuit is as follows: IO port: The output port of the STM32 microcontroller, connected to the base of the S8050 transistor through a 1KΩ current-limiting resistor. Transistor: S8050 NPN type, with the base connected to the current-limiting resistor and the line control IO port, the emitter grounded, and the collector connected to the positive terminal of the buzzer, to complete signal amplification and switch control. The positive terminal of the buzzer is connected to the collector of the transistor, and the negative terminal is directly grounded. Through the above design, when the STM32 single-chip microcomputer detects that the water level is lower than the preset level and outputs a high level to the IO port, it will conduct the S8050 transistor, providing power to the buzzer and causing an alarm sound. 5. Main Program Design The main purpose of the software module is to comprehensively handle and implement the design process of the intelligent water dispenser. The first step of the process is to complete the configuration of the pins of the STM32 microcontroller, ensuring that the pin allocation for each module is reasonable. The subsequent steps involve the initialization of each module, including the detection of the current ambient temperature using the DS18B20 temperature sensor and its initialization on the LCD screen, which displays the measured temperature and other relevant information. After the system enters the judgment logic stage, if it detects that the water volume of the water dispenser is empty, it will immediately activate the buzzer to sound the alarm, thereby preventing the possible risk of dry burning. Conversely, if there is sufficient water inside, the system will continue to evaluate the water usage mode set by the user - room temperature or heating. For the selection of the normal temperature mode, the system will directly instruct the relay to open and perform the water discharge operation. In the heating mode, the system first determines whether the current water temperature has not reached the set minimum temperature standard. Only when it is confirmed that the water temperature is indeed lower than the minimum standard will the system activate the heating mechanism and control the water output through a relay after the water temperature meets the requirements. The initialization of the DS18B20 sensor is the first step in temperature acquisition. Its goal is to activate the sensor and ensure that it is ready to receive subsequent instructions. The initialization process includes detecting the presence of pulses and sending initialization instructions. It should be noted that the power supply to the sensor must be stable and reliable to avoid reading errors. After the sensor responds, the STM32 microcontroller issues a temperature reading instruction through a single-bus protocol. 5.1. Key Subprogram Design The key circuit of this design is relatively simple, mainly including four function keys: temperature addition and subtraction, heating, and water pump water discharge. These keys are controlled by four pins on the single-chip microcomputer, among which the pins on the same side are connected. All the keys are connected in parallel. Just connect the corresponding pins to complete the basic setup of the circuit. The basis for the key to work is the detection of low- level signals. In the main program loop, the system continuously scans and detects low-level signals. When a key is pressed, the system detects a low level, and immediately the single-chip microcomputer triggers a signal interrupt, thereby activating the corresponding key processing subroutine. The four buttons each correspond to different functions: temperature increase and decrease, heating, and water pump discharge. They may perform different functions in different interfaces of the system. To achieve this, the system handles their respective operations through four independent functions, and during the execution process, it pays attention to adding necessary delays to ensure the stability and accuracy of key operations. In the key subroutine, it is first necessary to constantly detect the status of each key. This is achieved by checking whether the level of the key interface is low. Generally, a low level indicates that the key has been pressed. 5.2. Buzzer Alarm Subroutine In this system, the positive terminal of the buzzer is connected to a transistor to increase the current flowing through the buzzer. To prevent the transistor from being directly conducted, a 1K current-limiting resistor needs to be added to the circuit. Its working principle is as follows: A high-level signal is output through the IO port of the single- 46 chip microcomputer. When the IO port outputs a high level, the transistor conducts and the buzzer can produce sound normally. On the contrary, when the IO port outputs a low level, the transistor will cut off the current, causing the buzzer to stop sounding. Through this design, not only was the buzzer successfully driven, but it also ensured that the system could precisely control the working state of the buzzer as needed. 5.3. Subroutine Design for LCD1602 Liquid Crystal Display In the display system, the LCD1602 liquid crystal device is selected for use. This type of display is suitable for various display effects, and the background light can be adjusted according to the actual situation. This method significantly simplifies the complexity of software design. Under this framework, the work that the software needs to do is to convert the visual elements of the user interface - including images and their positions on the screen - into specific instructions and data for display. 5.4. WIFI Subroutine Design In the design of this system, ESP8266 was selected as the wireless communication module. It can be connected to the single-chip microcomputer through simple serial communication. By sending a specific AT instruction set, it can achieve wireless data transmission and effectively utilize the WiFi hotspot mode supported by this module for communication. The power supply voltage requirement for the ESP8266 module to operate is between 3 and 3.6 volts, with a peak output power of 20DBM. In terms of peak current, it consumes approximately 240 milliamperes. To ensure the stability and high speed of data transmission, this system selects a baud rate of 115200 for communication. To achieve the connection between the ESP8266 module and the single- chip microcomputer, only a 3.3-volt power line, ground wire (GND), and transmission (TXD) and reception (RXD) data lines need to be connected to complete the process smoothly. This connection method not only simplifies the hardware layout but also ensures the reliability of data transmission. In addition, once the ESP8266 module starts working, the mobile phone will be able to receive data information from WiFi, which provides a convenient remote monitoring and operation solution for the system. In this way, users can easily check the status of the water dispenser through their mobile phones, making the operation of the entire system more convenient and user-friendly. 6. Conclusion Leveraging the STM32 microcontroller and integrated sensor technology, this design implements a comprehensive smart water dispenser system featuring real-time temperature monitoring, precise water level detection, automated heating control, and alarm functionality, demonstrating significant potential for modern living applications. References [1] Zhang Li. Application of Single-Chip Microcomputer Technology in Smart Home Systems [J]. Electronic Technology, 2024, 53(07): 338-339. [2] Fang Hao, Lin Zhihui. Research and Design of a Healthy Drinking Water Device [J]. Electronic Production, 2022, 30(05): 78-80. DOI: 10.16589/j.cnki.cn11-3571/tn. 2022. 05. 026. [3] Li Zhengjun, Hao Chuanzhu. Automatic Device for an AI- Based Fully Automatic Water Dispenser [J]. Equipment Management and Maintenance, 2020, (18): 104-106. DOI: 10.16621/j.cnki.issn1001-0599.2020.09D.58. [4] Tang Bin, Deng Jie, Li Junhong. Design and Implementation of a New Water Dispenser Outlet Control Device [J]. Electronics World, 2020, (11): 127-128. DOI: 10.19353/j. cnki. dzsj. 2020.11.086. [5] Zhu Enze, Qi Shengnan, Tian Fangqi, et al. Design of an Intelligent Water Dispenser Based on a Single-Chip Microcomputer [J]. China Science and Technology Information, 2020, (02): 45-46. [6] Cao Jun'ao. Design and Implementation of an Internet of Things (IoT)-Enabled Smart Water Dispenser [J]. Modern Computer, 2024, 30(16): 101-105. [7] Liu Yanchen, Fu Jiajia, Lu Xiaoman, et al. Design of an Intelligent Water Dispenser Based on STM32 [J]. Applications of IC, 2024, 41(08): 10-12. DOI: 10.19339/j.issn.1674-2583. 2024. 08.005.