Implementation of Intelligent Trash Can Based on Voice Control

In this paper, a smart trash can based on the voice control is proposed. The garbage bin takes the Microcontroller as the control core and has a voice interaction function, that is, according to the speech recognition function instruction, the obstacle avoidance can be automatically realized during the movement process, and when the capacity reaches the preset value, it can prompt people to clean up. Meanwhile, the status of all trash cans can be displayed on the LCD screen. After debugging, the design has diversified functions and fully demonstrates practicality.


Introduction
With the improvement of people's quality of life, smart home has gradually integrated into life, with good practicality and prospects. Trash cans are particularly widely used in life, both in public and in the family. In the domestic market, for example, EKO of Guangzhou Yike Household Products Co., Ltd., landed in the 119th Canton Fair with the 2016 series of new products. Its product positioning is in the name of life artist, making the garbage dumping fun and making the environment bucket a piece of art of wisdom. Most of its products are smart trash cans with inductive type, but the location is fixed, not flexible enough, and the function is single, which can not meet people's needs better [1].
With the increasing strong social demand, flexible and multi-functional smart trash cans have become necessary, reflecting people's quality of life and the pursuit of high quality of life. [2]. However, there are still some problems in the trash can: (1) the garbage bins contain all kinds of rubbish, and the odor is inevitable. Because it is impossible to know when the capacity of the trash can is full, the odor is generated, resulting in parasites. People's health is extremely harmful. (2) Most of the existing trash cans are not intelligent, and people need to open the garbage lid manually ,so that it is not convenient and will touch the bacteria, the people's body is also harmful. Therefore, it is inevitable to develop and study intelligent garbage bins [3].
Combine the ordinary trash can with voice control to study a smart garbage bin based on voice control, which can not only serve as a clean guardian at home, but also help people with limited mobility. There is little research on smart garbage bin based on voice control. It is very necessary to design a smart trash can with strong practicability, high cost performance and voice interaction. Figure 1 below shows the inductive smart trash can on the market [4]. Figure 2 shows the design of the voice-controlled smart trash can in this article.

System design of the trash can
In this paper, 51 single-chip microcomputer as the control core, the cube as the body, the chassis is similar to a small car, and then equipped with sensors. Its functionality is simple and practical: manual interaction with the trash can (Such as open cover, close, forward, backward, turn left and turn right.) Once the trash can detects an obstacle during the operation, it stops immediately. The LCD displays status, capacity, time and date. When the trash can is full, the indicator light is on and the buzzer rings eight times. All the status is displayed on the display screen to remind people to clean up the garbage. The trash can also tell the time on the hour. With such a "smart little helper" around, it can improve people's quality of life. [5] The system block diagram is shown in Figure 3.

Sports program design
Considering that people "call" the trash can from all directions, the trash can needs to be arbitrarily rotated and stopped in place [6]. Therefore, this paper uses the scheme shown in Figure 4. Suppose that the clockwise rotation of the universal wheel in the plane is positive, and its movement design is: set the wheel 1 to rotate in the forward direction and the wheel 3 to rotate in the reverse direction. At this time, the trash can is in the forward state; otherwise, the trash can is in the backward state; Wheel 1. Wheel 2, wheel 3, and wheel 4 are all rotating in the forward direction. At this time, the trash can turns right in the right place, and the reverse is to turn left.

Capacity detection program design
In this paper, the ultrasonic sensor is used for capacity detection. The detection principle is shown in Figure a: where A is the ultrasonic sensor, and d1 and d2 are the total height and residual height of the trash can respectively. The final capacity calculation is displayed as a percentage (d2/d1*100%). Since the d2 distance can be changed, ultrasonic distance measurement is adopted, and the ultrasonic wave used in the system is HC-SR04, and the physical object is shown in Figure b.

Trash system programming
The main tasks of the trash can control main program include system initialization, voice recognition, motion control, obstacle recognition, liquid crystal display, clock operation, prompts, and so on. When receiving the external voice command, the trash can performs the corresponding command action and preferentially determines the obstacle in front. When the voice command is not received, the trash can waits for the command; meanwhile, the main program displays the time and current state on the LCD screen according to the clock signal and voice command; when too much garbage is detected, the buzzer sounds a reminder and the LED lights alert [6]. The flow chart of this system is shown in Figure 6.

Voice System Programming
The voice of this article is connected to the controller by serial port. The baud rate is 9600. The command is input to the voice module. The command is sent to the single-chip microcomputer through the serial port in the form of return value, thus driving the motor to make the garbage bucket move. The flow is shown in Figure 7. The order of operation of speech recognition is: firstly initialize the speech recognition (including speech module, system initialization and instruction recognition list), interrupt function writing, wait for the system to start speech recognition, and respond to the interrupt function to complete the corresponding action [7].
1. Voice module initialization and system initialization. Connect the voice module to the computer through the CH340 USB to serial port chip, and set parameters such as recognition mode and baud rate. After the voice module is set up, it is connected to the MCU through the serial port. In the initialization function of the MCU, the timer is used to set the baud rate and open the serial port interrupt.
2. Write the instruction identification list. Each instruction corresponds to a number, which is the return value. Different instructions can correspond to the same number, but can't exceed 255. At the same time, the voice module selected in this paper supports up to 50 different instructions. Each command can be represented by the standard Chinese Pinyin and there is a space between every two bytes [8]. The process is shown in Figure 8.  Figure 8. Identification list flow chart 3. Speech recognition. After the interrupt function is written, the system is powered on and resets, waiting to receive voice commands. After receiving the set command, the voice module will give the corresponding return value through the serial port. At this time, the serial port interrupt responds, and the system enters the interrupt function: the MCU stores the received data, and the receiving interrupt flag is set to zero, and the interrupt ends. After exiting the interrupt, the MCU determines and responds to the corresponding action based on the received data [9].

Voice control trash can debugging
The garbage bin in this paper is shown in Figure 9. The voice module used is ASR-M08-A [10].

Voice control test
The voice module selected in this design is equipped with a speaker, and its selection mode is loop detection mode. The correct rate of detection is shown in Table 1. As we can be seen from the above table, the voice receiving command is affected by the environment, noise and keyword misidentification. Therefore, the loop detection mode is selected, and the time detection is performed. As long as the correct command is detected, the voice is recognized and received, a certain action can be completed.

Switch cover test
The switch cover of the design can be controlled manually or by voice. When the voice module receives the "open cover" command, it completes the opening operation, as shown in Figure 11. The wheel used in this design is a universal wheel that can rotate 360° arbitrarily, and can be controlled by PWM wave. Figure 12 is a scenario for testing the movement of the trash can. It can be seen from the In FIG. 13, after the voice control trash can receives the "forward" command, the forward motion is performed. In the forward state, once infrared obstacle avoidance detects an obstacle in front, the operation is immediately stopped.

Ultrasonic range test
Ultrasonic in this design is mainly to measure the capacity of garbage can.The percentage of its capacity is displayed on the LCD screen. At the same time, LED lights and buzzers are used to warn people that the garbage is full and needs to be cleaned up.  Figure 15, if the garbage in the trash can is tilted or unevenly placed (as shown in Figure a), only 14% of the available capacity is displayed at this time. In fact, there is still extra space at the edge of the trash can. The remaining capacity of the bin is not properly detected and does not meet the design requirements.Therefore, on the basis of this, an infrared sensor and an indicator light are added together to detect the garbage (as shown in FIG. c and FIG. d). Under the condition that the ultrasonic has detected the insufficient capacity, if the infrared obstacle avoidance at the edge fails to detect the garbage (That is, the LED light is not on and the buzzer is not ringing), which means that there is still a certain space available for the trash can at this time, which meets the design requirements.

Summary
In the whole design process, first of all, the structure of the trash can and the functional circuits are analyzed in detail. The installation position of the sensor directly affects the performance of the design. The installation position of the motor drive also affects the design operation. Therefore, the installation position of each module is extremely important.
In the process of realizing its function, the path planning still relies on the user's instructions, but cannot independently locate the sound source and move to the designated position by itself.In the future, sound source location and path planning and other functions should be added on this basis to make the trash can more comprehensive and diversified.