The Design of Intelligent Wastebin Based on AT89S52

: Mainly introduces intelligent classification trash can be dedicated to solving indoor household garbage classification. The trash can is based on AT89S52 single-chip microcomputer as the main control chip. The single-chip microcomputer realizes the intelligent classification of garbage by controlling the voice module, mechanical drive module, and infrared detection module. The use of voice control technology and infrared detection technology makes the trash can have voice control and overflow alarm functions. The design has the advantages of simple and intelligent operation, simple structure, stable performance, low investment, etc., which can further effectively isolate people and garbage, reduce human infection with bacteria, and is a feasible solution for classification at the source of garbage.


Introduction
In areas such as public places and home environments in our lives, proper storage and disposal of garbage have long been an issue that cannot be taken lightly. Among the common household garbage, if we cannot properly dispose of the leftover garbage in the kitchen, the leftover kitchen garbage left in the trash can quickly become moldy and smelly, breed various bacteria, and cause mosquitoes. In public places, most people are mobile, and rubbish needs to be handled promptly and properly. Although the country has been advocating environmental protection and strengthening the recovery and recycling of recyclable waste resources for a long time, the actual results have been minimal.
The common trash cans on the market are not detailed enough to classify the garbage and the design is not humane enough. Nowadays, there are generally two types of trash cans in the market: uncovered and covered pedals, and these two forms are often only a single solution to the single centralized stacking of garbage, rather than solve the problems of bacterial growth and waste separation.
Garbage classification is imperative. Recently, a transparent "anti-terrorism box" appeared, which can effectively help us determine whether explosive or hazardous garbage is placed in the bucket. Therefore, according to the current human needs, the current trash can should have the following improvements. Due to the poor sealing of the trash bin and the direct lack of cover, environmental problems such as the diffuse smell of trash and the wanton growth of mosquitoes are caused. Due to the lack of an overfill alarm function in the trash bin, the failure to replace the trash bag in time will also cause the trash to fall out of the bin, resulting in an unsightly and unsanitary environment.
In order to adapt to the pace of science and technology in modern life, respond to the call of the country, and at the same time solve the above problems. In order to solve this problem, this design strives to rely on various sensor detections, which cannot only open the corresponding trash can cover for classification according to the type of trash, but also prompt the intelligent voice trash can with overflow alarm function.
The first section introduces the research background, current research status at home and abroad, and introduces the purpose and overall idea of this design. The second section of this article focuses on the main functions and characteristics of the smart trash can and makes an analysis. The third section introduces the structure of the smart trash can, laying a good foundation for hardware and software design. The fourth section introduces the hardware composition and hardware-related functions of the smart trash can. The fifth section introduces the programming framework and solutions. The sixth part mainly summarizes and proposes the areas that need improvement, and discusses the future research directions.

Identify the Type of Garbage Classified by Voice
People often have a feeling of being dirty when disposing of trash cans. The garbage cans are not clean enough due to the unclear classification of the garbage. When people see the messy garbage cans, they are reluctant to open the garbage cans with their hands. Because people do not want to open the lid of the trash can with their hands, so put the trash near the trash can or on the lid of the bucket. Such a treatment method will not only increase the burden of garbage disposal, but also increase the difficulty of resource reuse. The design uses voice sensors to identify the types of garbage classified, Speech recognition refers to the transformation of speech into the corresponding text or instruction by means of a machine [1], you just need to say to the trash can: "Garbage, water bottle", the smart trash can opens the lid of the "recyclable trash". Through voice control technology, it solves the problem of indoor garbage classification, so that people do not need to touch the trash can, and it is cleaner and hygienic.

With Overflow Alarm Function
Whether a conventional trash can is full is generally judged by the naked eye. Under the circumstances, open the lid of the bucket, which not only wastes time, but also increases the chance of people contacting the trash can. In order to save trouble, some people still put the garbage in the full trash bin, which causes the garbage to accumulate and brings trouble to the cleaners. The smart trash can has an overflow alarm function. The built-in infrared sensor will detect whether the obstacle has reached the predetermined position of the trash can, and finally send out an alarm signal through a buzzer. This design provides a good reminder to the user about the information in the trash can and effectively solves the problem of overloading and cleaning the trash can.

The Use Cost is More Economical
At present, the main control module of many smart sorting bins on the market uses the Arduino development board, Linux. The development board uses a lot of cameras to identify the types of garbage. These development boards are indeed powerful, but when we only need to meet the general requirements of the public, we use the AT89S52 microcontroller to meet the needs. In the voice control module, we use the LD3320 voice sensor. The LD3320 does not require any training before performing voice recognition. It only needs the user to set the relevant registers in advance to accurately recognize and achieve the desired result. Compared with the main control system analyzing the garbage images captured by the camera for garbage classification, voice control is simpler and more economical.

Maintenance is Easier
Trash cans exist as public property in many places. People will inevitably have them when throwing trash into the trash can. Some rough, objectively speaking, the trash can is also consumable. For smart trash cans, if complex and relatively expensive parts are used for production, the loss and maintenance costs of use are naturally higher. For the intelligent sorting trash can of this design, the single-chip microcomputers and sensors we use are all broad-spectrum, economical, durable, and simple in structure, which greatly makes the maintenance of the trash can easier.

Structure Introduction
The smart home smart trash bin has four doors, namely "food waste bin", "recyclable bin", "harmful bin" and "other barrels", each hatch has an independent lid. The internal control system of the trash can is composed of a single chip microcomputer main control module, a voice sensor module, a mechanical drive module, an overflow alarm module, and a power supply module. The system schematic diagram is shown in Fig. 1.

Figure 1: System structure diagram
When people use the smart home smart trash can, they only need to say "garbage, the name of the garbage" to the trash can at a distance of 30 cm-50 cm from the trash can, and the door of the corresponding category of garbage will open the lid. "Garbage" is a first-level instruction, which means you need to use a trash can, and "garbage name" is a second-level instruction, which means you need to sort the garbage. If you finish peeling the oranges, you only need to say "garbage, fruit" to the trash can, and the lid of the "food waste bin" will automatically open. When the lid is opened, you can give you 10 s of garbage disposal time, and the lid will automatically close after 10 s. When the garbage in the bucket exceeds a certain amount, an overflow alarm will be issued to remind the user to clean up the garbage in the bucket.

Main Control Chip
AT89S52 single-chip microcomputer is the main control chip of the intelligent sorting trash can. It analyzes and processes the voice signal output by the voice sensor module, and then drives the steering gear of the corresponding hatch to open the lid of the trash can. When the infrared photoelectric sensor detects that the garbage exceeds the limit value, the microcontroller needs to drive a series of corresponding processes such as a buzzer to alarm.

Speech Recognition
The automatic classification of garbage is realized through speech recognition technology. The speech recognition technology is the recognition of non-specific people's voices through machine recognition, understanding and conversion into corresponding character strings or instructions. The specific implementation steps include: taking voice samples, determining the starting point of voice input, calculating the voice frequency spectrum, decomposing the input signal, identifying keywords, and reacting to the input signal. In order to enable the normal operation of the voice system and not cause confusion to the voice sensor, keywords are set as the password switch for the voice sensor. We first set the voice module to the corresponding language instructions, for example, classify "peel" as "kitchen waste". We need to throw a banana peel into the trash can, then we need to say "junk, peel", where "junk" represents the first level password, and "peel" is the second level password. After receiving the signal, the microcontroller sends a signal to the steering gear of the "food waste bucket", and drives the steering gear to rotate and open the lid of the "food waste bucket".

Mechanical Drive
After the single-chip microcomputer receives the voice signal, the drive module needs to open the corresponding trash can lid according to the instructions of the main control chip. Science and technology management is faced with the problems of discontinuity of process and independence of relevant information system [2].
In the drive device, the steering gear is used to realize the process, and the program needs to be used to control the forward and reverse rotation. To ensure that the garbage has enough time to enter the trash can.

Overfill Alarm
Each compartment door of the smart trash can is equipped with an infrared detection sensor, and each compartment door is equipped with an "overfill alarm height". When the garbage thrown into the door exceeds the "overfill alarm height", the infrared detection sensor The detected obstacle enters the detection range, and the detected signal is transmitted to the single-chip microcomputer [3], and the single-chip microcomputer drives the buzzer to make a sound to realize the automatic overflow alarm function of the trash can.

AT89S52 MCU
We use the AT89S52 single-chip microcomputer as the main control chip. AT89S52 is a highperformance, low-power, full-duplex serial port that is fully compatible with the instructions and pins of 80C51 products [4]. It has a 32-bit I/O port with 8k flash memory and 256-bit memory, which can be used in the system. For programming, it can also be applied to conventional programming. On a single chip, AT89S52 enables embedded control to have a more effective solution while making the application system more flexible.
The minimum system of AT89S52 single-chip microcomputer consists of an AT89S52 single-chip microcomputer chip, a clock circuit composed of crystal oscillator and capacitor, and an external reset circuit at the reset terminal [5]. The Single-chip minimum system circuit diagram is shown in Fig. 2.

Voice Sensor Module
LD3320 is a voice control chip with non-specific voice recognition technology that can provide a single-chip voice recognition solution [6]. The list of important keywords for recognition of this voice sensor can be dynamically edited and updated. This voice sensor can easily realize voice recognition, control, man-machine dialogue, etc., for any electronic product, even the simplest control chip. The implementation process does not require auxiliary ports and memory, so external ports and usage costs can be reduced.
The practical significance of speech recognition: The practical significance of ASR technology is that it can liberate people's traditional control methods, without using hands, and can more conveniently perform some fixed mechanical actions. At present, non-specific speech recognition technology is to establish a mathematical model and will detect. The voice command is split, separated according to the form of a string, and then compared with the preset value. Therefore, this technology has been widely used in smart homes and the smart industry, and at the same time, It provides the foundation for intelligent households and intelligent industrialization.
ASR technology is based on keyword list recognition technology: the process of recognizing each user's instruction is to convert the voice content into a voice function through the frequency spectrum and combine to generate a keyword list entry [7], where the matching degree must be exactly the same, otherwise the recognition will not pass. For example, when calling a person's name (Yu Xiaoying), the key word is to set the full name of the name (yu xiao ying).
When we call the name, it may be a single word (English) or character, no matter how we shout Three words, as long as the relevant password is set in the register, the corresponding command to be recognized can be sent to the recognized register in the form of a string. LD3320 recognizes any keyword, and the judgment is correct after the keyword is stored in the register. There will be a misjudgment in this step. This is also a fixed fault on the hardware, so it can be eliminated in the software and must be detected (Yu Xiaoying) When the three words appear at the same time, the next instruction is executed, and the judgment of the remaining single words is invalidated.
In terms of algorithm, the recognized password is within 30 characters at most, but in actual human speech, there is no continuous speech within 10 characters. Therefore, we can use this common sense in the code writing. We try to keep the password as short as 2 to 2 between 4 words, it not only facilitates the detection and input of LD3320, but also prevents misjudgments caused by waiting for too long to input, and avoids the pauses and pronunciation errors when people speak. The LD3320 circuit schematic diagram is shown in Fig. 3.

Infrared Photoelectric Sensor
The infrared photoelectric sensor is highly adaptable to changes in ambient light. The black diode can send infrared rays and receive infrared rays from the transmission tube. When the detector detects the obstacle information sent by the transmission tube from the obstacle direction, the infrared light will be emitted and received by the white receiving tube, and then be compared and processed by the comparator, The green indicator light is lit [8].
This is a digital signal with a low-level output signal. The sensor's working voltage is 3-5 V, which can effectively detect a distance of 2-30 cm. The infrared photoelectric sensor diagram is shown in Fig. 4.

Buzzer
The buzzer is a very common alarm in our daily life. It is often seen that the source of the dizzy sound in the printer. It is an alarm with a DC-powered integrated electronic communication structure. The buzzer can are two types: active and passive, but in order to take into account the cost-effectiveness, and in this design, we only need to use the buzzer to sound the alarm when there is a signal, so we choose the relatively cheap Active buzzer. Another feature of the active buzzer is that the sound is controllable. The main function implemented in this design is that after the single-chip microcomputer receives the detection signal of the infrared photoelectric sensor, the buzzer alarms and prompts the instruction to replace the trash can. The Internal structure of the buzzer diagram is shown in Fig. 5.

Software Design
SG90 steering gear is the driving device in the mechanical driving module. The steering gear control is a representative closed-loop control system. The control signal enters the steering gear system through the transmission channel of the input signal to obtain the voltage difference, which is what we call the bias voltage. The reference circuit inside the steering gear system then generates a reference signal with a period of 20 ms and a width of 1.5 ms, the obtained bias voltage is compared with the potentiometer voltage, and the voltage difference is output as a low-voltage output [9].
The positive or negative of the output voltage depends on the direction of rotation of the internal motor of the steering gear. The pressure difference in positive rotation is positive, and the reverse voltage is negative. When the motor speed reaches a certain value, the reduction gear pushes the potentiometer to rotate, and the voltage difference obtained at this time is 0, and the motor also stops rotating [10]. The SG90 closed loop system diagram is shown in Fig. 6. The design of the software is based on the 51 series microcontroller development environment. The bottom of the environment is developed using C/C++ language. When the programmer needs a certain module driver, directly call the module's header file in the library function and load it into the existing file.
When the program starts to execute, the first thing to do is the initialization of each module and the single-chip microcomputer. When the voice sensor detects the input of the keyword "garbage", the voice sensor sends the detected voice signal to the central processor single-chip microcomputer, and the singlechip microcomputer uses the signal for processing, the processing result is to drive the corresponding server to open the corresponding container cover, the steering gear is reset when the time is up, and the trash can cover is closed. At this time, the overflow state is detected.
When the infrared photoelectric sensor detects an obstacle signal at the target position, it requests to send a signal to the microcontroller, and the microcontroller activates the buzzer and then alarms. After the obstacle is removed, it enters the dormant state, waiting for the next password wake-up. The main program design diagram is shown in Fig. 7.

Conclusion
After repeated tests and adjustments, the voice recognition rate of this smart home intelligent sorting trash can is basically maintained at more than 99%, the steering gear can be opened and closed accurately, and the overflow alarm can fully realize its function. In order to embody the "people-oriented" design concept, the product still has much room for improvement.
For instance, in school classrooms, offices, home kitchens, etc., the "smell" emitted by trash cans greatly affects people's comfort. Even if the trash can adopt a closed lid, when the lid is opened, the internal smell will inevitably overflow. Therefore, the smart trash can be equipped with an air freshener or disinfection device in the later period to make the environment more comfortable and make the "trash out" change easier.