Design and Development of Public Wash Basin based on Infrared

: In response to the problems of digital management and inconvenient water supply and drainage of public Wash Basin on the market, a public Wash Basin based on infrared is designed in the text. Using the DMA+output comparison function of the STM32F103ZET6 main control chip, the NEC protocol is sent to the infrared light-emitting diode. The signal is collected by the infrared receiving tube and sent back to the main control chip for logical processing to determine the drainage and water supply status; And use the mobile app and Alibaba Cloud to send and receive the status of the washing machine controlled by the main control chip. Realized contactless drainage and water supply, as well as digital management of wash basin equipment.


Introduction
In the Book of Rites, there is a saying: "When the rooster crows at the beginning, wash yourself in salt.This indicates that ancient people had the habit of getting up early and washing up.with the evolution of society and the abundance of living materials, people are increasingly paying attention to their hygiene and appearance.According to statistics, the sales of Chinese bathroom products reached 10 billion yuan in 2019 and are continuously increasing.This indicates that bathroom products have become essential tools for modern homes and public health places.As an important member of bathroom equipment, Wash Basin are used 8-11 times per person per day [3], mainly for washing hands, face, makeup, makeup removal, and cleaning items [4].
Nowadays, although Wash Basin are ubiquitous in China, the technology of modern sanitary ceramics has been introduced from Europe to China.From the founding of the People's Republic of China to the 1980s, there was no significant development in China's ceramic technology.After more than 20 years of efforts, China's ceramic production technology has developed rapidly, with as many as 600 production enterprises, basically meeting the demand for high, medium, and low gears in the domestic market.This cannot be separated from the hard work of researchers and enterprises.Chinese researchers have mainly made improvements to facial cleansers in the following areas: At first, researchers paid more attention to the processing technology of ceramics, which made the products more decorative and beautiful, and added chemical materials to make the washing machines cleaner and hygienic; In terms of human-machine integration and optimization of production lines for wash basin machines, Y.M.Ji [5] studied and developed a CAD system for wash basin machines, making the design of wash basin machines more in line with humanmachine relationships.Subsequently, researchers gradually shifted their focus away from the main body of the washing machine and paid more attention to its accessories.For example, H.Q.Wang [6] designed washing machines for CRRC that could automatically supply warm water, effectively solving the problem of freezing and cracking of the mixing valve in the high-speed train unit; Adjust the position of the overflow hole to avoid damage to the equipment caused by misoperation; Q.J.Chen [7] designed infrared water supply faucets, which can automatically discharge water when in use and cut off water after use, solving the problem of water conservation.At the same time, the drawback is that when the hand is away, it cannot continue to supply water, resulting in people who want to store water being trapped in front of the face wash.Up to now, the faucets for washing face on the market, as shown in Figure 1 and a, still use flipping or bouncing drainage [8].The use of this faucet requires users to contact sewage before draining.To solve this problem, mechanical lifting and pulling water heaters have appeared on the market, as shown in Figures 1  and b.When users want to discharge the domestic sewage from the wash basin, they only need to lift and pull the mechanical lever to open the drain.On this basis, J.G.Xu [9] invented an electronic control puller mechanism.The institution still needs to manually press the button to activate the drainage function, which has not solved the possibility of bacterial contamination.
In summary, there are the following problems with wash basin machines equipped with infrared and pull-up launchers on the market: 1) When users need a large amount of water, their hands are occupied by the wash basin machine, which means they cannot continue to supply water after triggering; 2) Users need to open the drain valve through buttons and other devices, which can easily cause cross interference of bacteria and viruses in public places; 3) wash basin in public places have multiple devices and long distances, making it difficult to uniformly check the status of the washers and effectively manage and maintain them.Based on this, it is necessary to design a contactless water supply and drainage system equipped with a digital managed IoT wash basin.a. Press type drainage device b.Pull type drainage device Based on the above analysis and requirements, the infrared based wash basin system architecture designed in this article is shown in Figure 2.Each wash basin is equipped with two TCRT5000 infrared emission and reception terminals.One is an infrared switch installed under the faucet, as shown in Figure 3.When the user washes their hands and approaches the Wash Basin, the STM32F103ZET6 chip's main control chip sends a simplified NEC signal (hereinafter referred to as a NEC) to the infrared emitter tube.After being reflected by the user's hand, the decoding terminal receives the signal, and demodulates it back to the main control chip; When the receiving terminal collects a valid signal, the main control chip controls the relay to work, and the relay drives the solenoid valve to achieve water supply to the faucet.Compared to water use, the closing and opening conditions of the drain are more complex -water storage of time is often difficult to control, so the design only requires the user to manually scan the infrared switch of Wash Basin, the main control chip receives effective signals, and can keep the drain open or closed.When the main control chip drives the executing mechanism, it sends a signal to Alibaba Cloud through ESP8266 and then sends it to the mobile app to achieve data synchronization with management personnel.Convenient for cleaning and detecting the working status of the entire area's Wash Basin.At the same time, considering that in public places, only cleaning requires a large amount of water, the APP also sets the opening and closing status of the water outlet valve.

Programming
At the beginning of the program, a Wash Basin structure is created to facilitate the unified management of each Wash Basin object.The program is then divided into four modules, namely: DMA+sending interrupt for sending NEC protocol, serial port receiving interrupt for receiving protocol sent by ESP8266, input capture interrupt for receiving NEC protocol, and main function for outputting execution mechanism.(2) The main control chip receives the NEC protocol The main control chip is capturing interrupt HAL_TIM_IC_CaptureCallback()function reads the captured value and changes the edge triggering method.Considering that the equipment operates outdoors, there is a deviation in the received value.Therefore, as long as the two edge capture interpolation cycles are within ± 200 of the specified value, the next state can be entered until the time series Infrared_Data is fully received, and then determine whether it matches the transmission.Once there is a problem with the received sequence, it will directly return to the initialization state.
When the main control chip receives Infrared that matches the transmitted signal Infrared_Data, record the captured value at that time as the global variable Rece_ OK_ Time。 Considering that the working mode of the water supply valve is that the hand constantly reflects the infrared signal, as long as Rece_OK_Time<2 * NEC cycle, then continue to supply water; Unlike the working mode of the water supply valve, the row number mechanism only needs to manually sweep the infrared signal and reflect the signal.So as long as Rece_OK_Time>2 * NEC cycle, drain.
(3) Serial port receiving interrupt and main function Transfer the information of the mobile app ESP8266 through the Alibaba Cloud IoT platform's cloud production cloud flow, and then send the data to STM32F103ZET6 through the AT+command of ESP8266.Therefore, management personnel only need to check their mobile phones to pay attention to the working status of all the nearby facial wash machines and achieve long-term water discharge.When using administrator permissions to control the facial wash machine, they can block the infrared signal by stopping input comparison interrupt, and then set the drainage and water supply mechanisms of the Wash Basin to maintain the desired state.

Conclusion
After practical operation, the public Wash Basin designed in this article has effectively improved the digitization of existing Wash Basin on the market, achieving energy-saving effects.Its specific advantages are as follows: (1) An infrared switch has been added to the valve mechanism, effectively avoiding cross infection caused by opening or closing the face wash, and adding protection for people's health and safety; (2) The use of IoT devices such as Alibaba Cloud has enabled the digitization of facial cleansers, allowing cleaning personnel to detect and operate them in real-time on the cloud, avoiding mosquito and insect environments caused by longterm accumulation of water in the facial cleanser; (3) Use STM32F103ZET6 to control the water supply valve, allowing the washing machine to supply water when the user leaves the infrared switch, adding intelligence to the washing machine.
(4) Using the DMA+output comparison function of the STM32F103ZET6 main control chip reduces the occupancy rate of chip interrupts and increases system stability; (5) Using the NEC protocol to transmit signals reduces external interference and increases the security and stability of the system.

Figure 3 .
Figure 3. 3D view of infrared based facial cleanser

Figure 4 .
Figure 4. Program System Architecture Diagram (1) Master chip sends NEC protocol Due to the relatively complex environment in public places, in order to avoid interference from infrared light and other light signals from surrounding facial wash machines.This article only uses the NEC protocol's guide code, 2-digit user code, and 2-digit user inverse code as communication protocols to achieve anti-interference.The specific sending process is as follows: 1) Configure the TIM1 crystal oscillator to 1Mhz, set the channel to Output Compare CHX (where X=1,2,3,4), and set the Mode to Trigger on match.2) Set the direction of DMAX to Memory to Peripheral and the Mode to Normal.3) At initialization, HAL_ TIM_ OC_ Start_ DMA () function sends array Infrared_ Data, and in HAL_TIM_PWM_PulseFinishedCallback(), that is, increase Delta=24270 for each interrupt data, and loop through HAL_ TIM_ OC_ Start_ DMA Send Infrared_ Data array.Infrared_Data={9000,13500,18110,18670,19230,20910,2 1470,23150,23710,24270}+Deta Where: 9000-0=9us, indicating the high level of the guidance code; 13500-9000=4.5us,indicates low level of guidance code; 18670-18110= 560us and 19230-18670 =560us, representing data 0; 20910-19230=560us and 21470-20910=1680us represent data 1; Figure 5 circularly sends two different NEC protocols to the main control chip, with 0011 on the top and 0101 on the bottom.

Figure 5 .
Figure 5. Two Way NEC Protocol