Design of Intelligent Garbage Classification System Based on Internet of Things Technology

With the increasingly prominent problem of environmental pollution, it is extremely urgent to carry out garbage classification. This paper designs an intelligent garbage classification system based on Internet of Things technology, The system is mainly composed of relay driving circuit, infrared induction, metal detection and humidity detection modules. Single chip microcomputer and multi-channel sensors are used to collect and process related data to realize metal garbage recovery, dry garbage and wet garbage classification and delivery, and the collected related data are displayed on the display screen through serial communication. The experimental results show that the system has the characteristics of simple structure, stable performance and convenient operation, which provides a feasible solution for the current garbage classification and treatment.


Introduction
The 19th National Congress of the Communist Party of China puts the topic of garbage classification into the report for the first time. According to incomplete statistics, the value of resource loss caused by unreasonable garbage classification in China is as high as 25-30 billion RMB every year [1] . From this point of view, carrying out garbage classification correctly and reasonably can not only effectively alleviate the problem of urban garbage pollution, improve the appearance of new countryside, help rural revitalization, but also promote sustainable economic development [2] .
The main pain points of current garbage classification are as follows: 1. People have not established the awareness of garbage classification, and cannot accurately distinguish dry and wet garbage and recyclable metal garbage; 2. The trash can is not well sealed or directly uncovered, which will not only emit peculiar smell around, but also easily grow mosquitoes, which will easily cause adverse effects on the environment and people; 3. When the trash can is full, it can't be cleaned and transported in time, and there is no corresponding prompt function. If the garbage is not cleaned in AMTEI-2021 Journal of Physics: Conference Series 2187 (2022) 012020 IOP Publishing doi: 10.1088/1742-6596/2187/1/012020 2 time, it will easily lead to garbage accumulation outside the trash can, which is neither beautiful nor sanitary [3] . These pain points need to be solved urgently.
With the continuous development of Internet of Things technology, all walks of life began to use Internet of Things technology for industrial upgrading, aiming at realizing intelligence and deartificiality [4][5][6] . In this paper, infrared sensors, humidity sensors, ultrasonic sensors, metal sensors and so on are mainly used. An intelligent garbage classification system based on Internet of Things technology is designed, and the system can realize the functions of intelligent lid opening, garbage filling prompt, metal garbage detection, dry garbage and wet garbage discrimination, etc. In particular, the dry garbage and wet garbage mentioned in this paper refer to the moisture content of garbage, not dry garbage and wet garbage in the sense of garbage classification. Taking STC89C52RC single chip microcomputer as the control center, the infrared sensor is used to detect whether someone is near in the detection range. If so, the STC89C52RC single chip microcomputer controls the relay to open the barrel cover, and then automatically closes the garbage can cover after delaying the set time. When people throw garbage, metal sensors detect whether there is metal garbage, and humidity sensors detect the humidity of garbage. If the humidity is lower than the set threshold, it is dry garbage, otherwise it is wet garbage. Ultrasonic ranging is used to detect whether the garbage is full. If it is full, STC89C52RC single chip microcomputer will control LCD1602 to display the full state of the garbage can in real time, so as to prompt relevant personnel to dispose of garbage in time [7][8] .

Overall Structure Design of System
The system adopts STC89C52RC single chip microcomputer as the processing core, carries on the roving measurement to the collected parameter, and carries on the analysis processing to the collected data [9] , the system overall structure diagram is shown as Figure 1. The main functions of this system are as follows: (1) Using ultrasonic detection to judge the current garbage overflow degree, and using STC89C52RC single chip microcomputer to analyze the data, using LCD1602 liquid crystal to display the current garbage bin empty state and related parameter information, which is convenient for users to intuitively understand the information in the garbage bin [10] . (2) The system is equipped with infrared sensors to detect whether someone is approaching around the trash can at present. If there is, it will be judged that someone is throwing garbage. After 5 seconds countdown, metal sensors and humidity sensors will be used for garbage classification 3 detection, which can detect garbage types conveniently and quickly [11] . If it is detected that the humidity of garbage is lower than the set threshold and it is nonmetallic garbage, the system judges it as dry garbage. At this time, the No.1 relay works, and it can simulate opening the dry trash can cover for 5s and then automatically closing.If it is detected that the humidity of garbage is higher than the set threshold and it is nonmetallic garbage, the system judges it as wet garbage. At this time, the No.2 relay works, and it automatically closes after opening the wet trash can cover for 5s. If it is detected as metal garbage, the buzzer alarms to remind the user to manually press the recovery button and open the No.3 relay for metal garbage recovery. The function of this system is relatively simple, focusing on the recovery of metal garbage and the prompt of overflow of garbage bins, which can improve the recovery of available resources to a certain extent and prevent other irrelevant personnel from turning garbage and cause pollution, and properly solve the problems of garbage pollution and recovery of metal resources [12] .

System hardware design
The hardware design of this system mainly includes crystal oscillator, humidity detection module, infrared induction module, relay drive module, liquid crystal display module, metal detection module, ultrasonic ranging module, etc. [13] . Relay drive makes the system more stable and safe [14] . Next, the hardware circuit composition of the above modules is introduced one by one.

Crystal oscillator
The crystal oscillator circuit provides the basic clock signal for the system. The system design shares a crystal oscillator to keep the system modules synchronized. The crystal oscillator circuit consists of two 22pF load capacitors and a 11.0592 MHz crystal oscillator. The two ends of are respectively connected to XTAL1 ports and XTAL2 ports of STC89C52RC single chip microcomputer. Because the crystal oscillator has to generate a complete sine wave, if the capacitors of the two loads are not equal, the voltages at both ends will be different, and the generated sine wave is definitely not completely symmetrical. Therefore, in order to ensure that C10 and C11 have the same size and characteristics, a capacitor of 20pF to 30pF is usually used. The capacitance used in this design is 22pF, and the selection range of crystal oscillator is generally between 1.2MHz and 12MHz. In the actual normal operation of STC89C52RC single chip microcomputer, using the theory of circuit analysis and mode electricity,11.0592MHz crystal oscillator is the most suitable, so this system adopts 11.0592MHz crystal oscillator. In the final hardware welding process, in order to reduce parasitic capacitance and stabilize oscillation, the crystal oscillator circuit and MCU will be welded as close as possible. The circuit diagram of the crystal oscillator is shown in Figure 2.

Humidity detection module
This system mainly uses humidity sensor U34 and LM393 voltage comparator circuit when detecting the dryness and wetness of objects. As shown in Figure 3, the resistance of 10K is connected to realize pull-up, and 3 is the output level receiving end of humidity sensor. After passing through LM393 comparator, it will only output two levels, namely high level 1 and low level 0. When the voltage is greater than 2.5 V, it will output high level, and when the voltage is lower than 2.5 V, it will output low level. For example, when the output is low level after comparison, the low level signal is transmitted to the single chip microcomputer through P1.1 port, and the single chip microcomputer controls No.2 relay to open the wet garbage recycling bin to realize the recovery of wet garbage.

Infrared Sensing Module
This system detects whether someone is near in the effective range by infrared sensor, and then transmits the information to STC89C52RC single chip microcomputer through serial port. As shown in Figure 4, two parallel RPR220 sensor circuitsare used in the infrared sensing module, and RPR220 is an integrated reflective infrared detector [15] . Because the plastic lens of RPR220 makes this sensor have higher sensitivity, its built-in visible light filter can also reduce the influence of stray light on measurement, thus reducing the detection error. RPR220 infrared sensor is very suitable for being placed in the interlayer of trash can shell because of its small size and compact structure. This module has a pair of infrared emitting and receiving tubes, The transmitting tube emits infrared rays of a specific frequency, When the detection direction meets obstacles (reflecting surface), the infrared ray is reflected back and received by the receiving tube. After being processed by the comparator circuit, the green indicator lamp will light up, and a low-level signal will be output from the signal output interface. At the same time, the detection distance can be adjusted through the potentiometer knob, with an effective distance range of 2cm ~ 30cm and a working voltage of 3.3 V-5V.   Figure 5 is the circuit diagram of relay drive module. The relay can be understood as an automatic control switch. When we need to open the relay, we need to give a low level to STC89C52RC single chip microcomputer. At this time, the low level makes the relay close. At this time, U11 is equivalent to an external device that can work normally. At the same time, a diode is added to protect the circuit, because the relay will generate a reverse current at the moment of disconnection, which may break down the triode, so the diode is to prevent the reverse current. The function of relay circuit in this system is to control larger current with smaller current, so as to realize automatic control [16] .

LCD Module
Because the display of this system is relatively simple, it is not very complicated to select the LCD model required by the design, and two lines of data can be displayed. Considering LCD1602 has the advantages of low power consumption, small size and low price. Finally, it was decided to choose LCD1602 liquid crystal display module. It is composed of dot matrix character bits, and can display two lines of 16 character data on the screen, which can meet the system requirements well. The circuit diagram of LCD1602 module is shown in Figure 6.

Metal Detection Module
This module mainly adjusts the gain potentiometer of the high-frequency oscillator to make it in a critical oscillation state. When a metal object approaches the detection coil L, electromagnetic induction will occur, and eddy current will be generated in the metal conductor, which can increase the energy loss in the oscillation loop, weaken the positive feedback and even stop the oscillation without maintaining the minimum energy required for oscillation. The module converts this change into an electrical signal by detecting it, and then converts the electrical signal into a sound signal through the buzzer on the right side of the circuit. When the intelligent garbage recycling bin detects that there is

Ultrasonic ranging module
This system mainly adopts HC-SR04 ultrasonic ranging module, as shown in Figure 8. At the beginning, the IO port of MCU gives a high-level pulse signal of at least 10us. After that, the ultrasonic ranging module will automatically circulate 8 40KHz pulses, and automatically check whether there is a correlation pulse signal returned. When a pulse signal returns, It will respond to a high-level output through the IO port of the single chip microcomputer. Because the transmitting and receiving time of the pulse signal is proportional to the detection distance, the distance can be calculated by the timer of the single chip microcomputer and then calculated by the relevant formula. The measured distance is compared with the set threshold to determine whether the trash can is overflowing.

System software design
The software design of this system mainly includes sensor data acquisition program design and system interaction program design. The sensor data acquisition program mainly includes infrared, ultrasonic, metal detection and separation of dry garbage and wet garbage. The system interactive program includes two parts: liquid crystal display and buzzer for audio indication. Each module of the sensor collects the environmental data and displays it on the liquid crystal display after being processed by the single chip microcomputer, and the real-time data is visualized. At the same time, the single chip microcomputer controls the buzzer to remind the user in real time, thus realizing the real-time interaction with the user [17] . Next, it mainly introduces the flow charts of infrared detection software design, metal detection software design, dry waste and wet waste detection software design.

Design of infrared detection software
After the system is powered up, each module will be initialized first. In order to make the infrared sensor module can sense normally, the system needs to place the infrared sensor module outside the unobstructed trash can, so that people can directly sense when throwing garbage and avoid AMTEI-2021 Journal of Physics: Conference Series 2187 (2022) 012020 IOP Publishing doi:10.1088/1742-6596/2187/1/012020 7 misjudgment. When the infrared sensing module senses that someone is throwing garbage, the system will open the metal detection module, humidity sensing module and ultrasonic ranging module. The flow chart of infrared human body detection program is shown in Figure 9.

Design of metal detection software
This module is mainly used to detect metal garbage. When metal appears in garbage, the metal detection sensor generates inductive eddy current to change the current value, and the No.3 relay closes and the buzzer sounds, so as to realize the detection of metal garbage. The program design flow chart is shown in Figure 10.

Software Design for Separation of Dry Garbage and Wet Garbage
When the system detects dry garbage and wet garbage, mainly the humidity detection sensor detects the humidity of garbage, as shown in Figure 11. When there is enough water in the garbage, it will change the current in the circuit. When it is higher than a certain value by comparator, the output is high level, which is judged as dry garbage. Single chip microcomputer controls opening No.1 relay, which means opening dry garbage can. Otherwise, when the output is low level, it is judged as wet garbage. Single chip microcomputer controls opening No.2 relay, which means opening wet garbage can.

System performance test
According to the design requirements, the system performance is tested item by item, and the test results are as follows. After booting the system, LCD1602 initializes the information to display the current parameter information, as shown in Figure 12.
Then, infrared sensors are used to detect whether there is occlusion around the trash can at present, as shown in Figure 13. If there is occlusion, it means that someone throws garbage and then goes to the next step to detect the humidity and metal sensors of the put garbage, and the liquid crystal countdown is 6s.That is, after 6 seconds, it can judge which kind of garbage it belongs to. Figure 12. LCD1602 initialization display.
The system first carries out metal detection on the lost garbage with entering the garbage classification detection stage, as shown in Figure 14. If it is detected as metal waste, the buzzer will give an alarm and need to manually press the recycling button to open the No.3 relay (metal garbage recycling bin) for recycling, so as to prevent the old scavengers or other irrelevant personnel from turning over the garbage and causing pollution.   If it is non-metallic garbage,the system will check its humidity, as shown in Figure 15. If the garbage humidity is high, the No.2 relay (wet garbage recycling bin) will be opened and automatically closed after 5s. As shown in Figure 16, if high humidity of garbage or metal garbage is not detected, the system will automatically judge as dry garbage, and the No.1 relay (dry garbage recycling bin) opens the dry garbage recycling bin and automatically closes it after 5s. So as to realize the classified delivery of dry garbage and wet garbage of non-metallic garbage. Figure 15. Wet garbage detection. Figure 16. Dry garbage detection.
As shown in Figure17 (a) (b), after the garbage classification detection, the ultrasonic wave will detect the overflow degree of the current garbage can. LCD1602 liquid crystal displays the status and related parameter information of the current garbage recycling bin. Figure 17 (a) shows that the trash can is full, while Figure 17 (b) shows that the trash can is not full and the lid is closed.
(a) (b) Figure 17. Ultrasonic module detects the current overflow degree of trash can.

Conclusion
Intelligent garbage classification is carried out in this design, because STC89C52RC is used as the core controller and based on the sensor technology of Internet of Things. Starting from the infrared detection module detecting whether someone comes to throw garbage, metal sensor,humidity sensor and relays are used to drive garbage classification and recovery. Ultrasonic detection module is used to realize real-time detection of garbage can overflow. At the same time, all data are integrated into LCD1602 display through single chip microcomputer for display to form a visual data interface, which makes garbage classification simpler and faster. Experiments show that the intelligent garbage classification system based on Internet of Things technology designed in this paper has stable