Frontiers in Computing and Intelligent Systems ISSN: 2832-6024 | Vol. 5, No. 3, 2023 90 The Design of the Automatic Control Intelligent Ashbin Liming Zhou * College of Electrical Engineering, Tianjin University of Technology and Education, Tianjin, China * Corresponding author Email: 18714557968@163.com Abstract: This paper designs an automatic control smart trash can based on STM32 microcontroller, which mainly realizes the functions of garbage identification and classification, overflowing garbage reminder, automatic opening and closing of the garbage can lid, and short-distance remote control. The automatic control smart trash can not only helps the user to recognize the type of trash automatically, freeing the user from a wide variety of trash categories. Since all garbage contains a lot of bacteria, the sensor recognizes the human body to automatically open and close the garbage lid also protects human health to a certain extent. Automatic control of smart trash cans not only provides convenience for the users, but also benefits the garbage removers. It can open all the lids of the trash cans with one click when the garbage is full, which also further reduces the workload of the garbage removers. Keywords: STM32 Single Chip Microcomputer; Garbage Detection; Wireless Transmission. 1. Introduction With the continuous advancement of the modernization process, the level of science and technology is developing rapidly, the quality of human life is gradually improving, people enjoy the convenience of high technology at the same time, there are also many problems. In the current era of takeaways, more and more household waste is produced, but the technology of waste separation and disposal is still not mature enough[1-4].According to the survey[5-6], most of the public places as well as the home range use the garbage can is an open garbage bin, such garbage bins mainly have the following problems: (1) Some of the garbage bins are open and do not have lids. When too much garbage is stacked together, a pungent smell often emanates from the vicinity of the garbage bins, and it is very easy for bacteria and parasites to breed, which is hazardous to the health of the people; (2) Most of the garbage bins currently on the market require hand opening of the lid of the garbage bin. When the surface of the lid is dirty, if people touch the lid of the garbage garbage can with their hands, the bacteria on the lid will stick to their hands, which greatly increases the probability of infection with viruses, and poses a certain degree of harm to health of the people; (3) Currently, traditional garbage bins do not have the function of reminding the overflow of garbage, which is likely to lead to the phenomenon that no one will clean up the garbage bins for a long time when they are full. Aiming at the above problems, it is very meaningful to design an intelligent garbage can which can automatically identify and classify the garbage and open and close the lid of the garbage bin by automatic sensing recognition. 2. Program Design and Validation 2.1. Overall System Design Goals Automatic control of intelligent garbage bin design introduces a microcontroller for logic judgment to achieve intelligent operation, in order to achieve non-manual touch the lid of the garbage can, automatic control of intelligent garbage can design implementation will need to have a human body sensor recognition and automatic open and close the lid function, the design of the use of photoelectric sensors for human body recognition, when the sensor detects the human body to automatically open the lid of the garbage bin to reduce the transmission of viruses, and to facilitate garbage bins. The design uses photoelectric sensors for human body recognition. When the sensor detects that the human body is far away, it can automatically close the lid of the garbage bin, which can effectively inhibit the emission of odor. The design of the automatic control intelligent garbage bin also has a garbage overflow reminder, when the automatic control intelligent garbage bin detects that the garbage bin is almost full of garbage, the garbage bin can automatically send out a reminder to remind people to clean up the garbage [7]. 2.2. Overall Design Program This design consists of six modules, including STM32 core circuit module, body detection module, infrared detection module, display circuit module, servo driver module, and bluetooth module, the whole block diagram of the system is shown in Figure 1. The functions achieved by each module and the contents are as follows: (1) The STM32 core circuit module as the master control module is used to achieve logical judgment as well as to control the smoothly execution of the functions of each module. The structure is shown in Figure 1 (2) The body detection module uses an infrared distance sensor to realize the function of body detection. When the garbage delivery person approaches, by detecting the height of the person from the garbage bin, when the height reaches a predetermined threshold, the garbage bin will automatically open the lid of the garbage bin. (3) The infrared detection module adopts infrared sensors to detect whether the garbage put in the garbage can is full or not, so as to realize the function of detecting the overflow of garbage in the garbage can. (4) The display circuit module uses a four-line OLED display for garbage identification and classification. (5) Servo drive module to achieve the function of opening and closing the lid of the trash bin. 91 Figure 1. Overall structure block diagram 3. Hardware System Design 3.1. Core Module The microcontroller is the core part of the whole circuit, which is used to generate various control signals, give commands, coordinate the operation of various sub-modules, and ensure the normal operation of the whole microcontroller.STM32 series microcontroller is used mainly because of its relatively simple interface, fast computing speed, and the ability to read and decode and output audio signals. It can better achieve the function of automatic control of intelligent garbage bins. The schematic diagram of the core circuit is shown in Figure 2. Figure 2. Schematic of the core circuit 3.2. Human Detection Module The human body detection module is mainly used to achieve the automatic opening and closing of the garbage bin lid when a person is judged to be near the garbage can and a predetermined threshold height is reached. This function is mainly realized by photoelectric sensor. When the hand is at a predetermined threshold height from the garbage bin, the photoelectric sensor can convert the light signal into an electrical signal to drive the circuit to open the lid of the garbage garbage bin. 3.3. Infrared Module The infrared detection module is mainly used to detect the height of the garbage in the garbage bin, when the height reaches a predetermined threshold, the driver circuit issues an alarm to inform the garbage cleaning staff to clean up the garbage. The module uses an infrared reflective sensor model TCRT5000, when the detected object appears within the detection range, the infrared receiver tube will become saturated, the diode's indicator will automatically light up, and the driver circuit emits a beep. 3.4. Display Circuits The display unit uses a four-wire OLED icon, and the four- wire OLED icon uses the IIC protocol, which realizes the read and write operation of the icon and finally displays the data effectively. OLED liquid crystal display unit, as the design of the display part of the data display, because the liquid crystal display only need to use to two micro-controller data lines can be carried out to display the data, saving micro-controller pin resources[8]. 3.5. Servo Drive Module The servo, as a designed drive unit, is a position servo actuator suitable for control systems where the angle needs to be constantly changed and maintained. Use the microcontroller to generate a stable pulse signal to the servo, at this time the control signal from the microcontroller will go to the signal modulation chip to obtain the DC bias voltage When the signal meets the requirements to control the servo for angular rotation. The function of automatically controlling the intelligent garbage can to open and close the garbage can is realized by controlling the servo [9]. 4. Software System Design 4.1. Voice Recognition Module The automatically controlled intelligent garbage bin has a voice classification function, where the voice module has been programmed to record words into the memory by means of a programming module. When the corresponding garbage name is input to the voice module, the microcontroller uses the serial port communication function to detect the garbage name data returned by the module, and then makes a judgment on the type of garbage, and finally opens the corresponding garbage bin. The voice recognition flow chart is shown in Figure 3. Figure 3. Voice recognition flow chart 92 4.2. Servo Subroutine Automatic control intelligent garbage bin use servo for opening and closing the garbage bin lid operation, automatic control intelligent garbage can need to rotate the servo to 45° when opening the lid. The microcontroller is required to generate a control pulse with a duty cycle of 1ms.The pulse signal generated using the microcontroller's timer is stable and uninterrupted by other programs in the design, and the flowchart of the lid-opening subroutine is shown in Figure 4. Figure 4. Open lid program flowchart 4.3. Garbage Overflow Detection Subroutine Figure 5. Flow chart of garbage full detection program Garbage bin overflow function requires using infrared sensors to detect the height of garbage in the garbage bin, when the height of the garbage in the garbage bin reaches a predetermined threshold height, the garbage bin to reach the full state of the box, infrared sensors will transmit the signal to the MCU, triggering the voice circuit for the full voice prompts, the garbage bin lid mechanism to stop the operation of the garbage bin full detection program flowchart as shown in Figure 5. 4.4. Main Program Flow Chart This design selected STM32 microprocessor, after the beginning of the first initialization, and then began to read the sensor, this time the sensor inside the garbage bin will show whether the garbage inside the garbage bin is full or not, if the trash inside the bin is full, the garbage bins will no longer open the lid, and will send out an alarm tone. If it is shown that the garbage bin is not full of garbage, the garbage bin will recognize the type of garbage according to the voice issued by the people, and according to the classification of the garbage prompted by the garbage bin, the action of the garbage bin automatically sensing the opening of the lid of the garbage bin can be implemented. The main program flowchart is shown in Figure 6. Figure 6. Main program flow chart 5. Conclusion In this paper, an automatic control intelligent trash bin is designed and achieved with the functions of garbage classification, overflow reminder, and automatic opening and closing of the lid of the trash garbage can by human body sensors. It can be convenient for users to better classify garbage, while the automatic sensor switch trash can lid can effectively reduce the frequency of contact with bacteria when people put garbage, to protect people's health to the greatest extent. References [1] WANG Yumei. PLC-based control system design of intelligent trash can cleaning station[J]. Equipment Management and Maintenance,2022(5):135-136. [2] MA Hanxu, LIU Zhongfu, LIU Ziyang, ZHAO Hongyu. Design of solar-powered intelligent waste classification and treatment system[J]. Automation and Instrumentation, 2020. 35 (08). 93 [3] PAN Zhongxun,GE Yutong,DONG Jingwei,NIU Shuang,LIU Zhenye. Intelligent trash can design based on deep learning[J]. Technology and Innovation,2022(1):66-68. [4] LING Jiaping, PAN Shaoming, TIAN Tianbei, WEI Mingzhen, ZHOU Junnan, TAN How. Intelligent garbage can supervision system based on Internet of Things[J]. Science and Technology Innovation, 2020(23). [5] MENG Jian, JI Kaiyang. Design of Arduino-based household smart trash can[J]. Industrial control computer, 2020.33(04). [6] LIU Lei,PAN Xu,YU Kun,,et al. Design of voice-controlled automatic sorting intelligent garbage can[J]. Science and Technology Innovation and Application,2021,11(30):43-47. [7] WU HANG ZHAO CHUAN DONG,WU CHENG YU,et al. Design and realization of voice-controlled intelligent classified garbage can[J]. Journal of Anhui Electronic Information Vocational and Technical College,202019(6):20-23. [8] HU Wenshuai,XU Zicheng,LI Qiuyan,et al. Design and realization of intelligent garbage can based on internet of thingsJ Modern Industrial Economy and Informatization, 202010 (10):35-37+55. [9] Xiong C. Design of Intelligent Garbage Classification Bin Based on LD3320[C]//Eliwise Academy.Proceedings of the 2021 International Conference on Signal Processing and Machine Learning (CONF-SPML 2021).CONFERENCE PUBLISHING SERVICES, 2021:4.DOI: 10.26914/ c.cnkihy. 2021.075902.