Abstract

Aiming at the problem that it was difficult to popularize accurate garbage sorting and delivery, a kind of intelligent garbage bin that is more intelligent, efficient, and functional than the traditional garbage bin was designed and manufactured. The design was based on the STM32 minimum system implementation. The speech recognition module was used to receive the key words and identify which type of garbage the item belongs to. At the same time, a speech reminder was given, and the steering gear was driven to automatically open the corresponding type of garbage bin lid, and the sorting collection was realized. In addition, the ultrasonic distance measuring module was used to detect the residual capacity of the garbage bin in real time. When it was about to be full, the data would be sent to the background management system through the WIFI module to remind the staff to clean it up. The experimental results show that the intelligent garbage bin can effectively help people sort and put domestic garbage and prevent garbage overflow from affecting the living environment, so as to realize the service of science and technology for human beings.

1. Introduction

With the rapid growth of urban population, the pressure on waste disposal has increased significantly. If this waste is not disposed of effectively, it can lead to serious health and environmental problems [1]. Therefore, in recent years, the concept of garbage sorting has been recognized all over the world. Its purpose is to improve the resource value and economic value of waste, reduce the amount of waste treatment and the use of treatment equipment, reduce treatment costs, and reduce the consumption of land resources, with social, economic, ecological, and other benefits [2].

At present, garbage sorting is mainly divided into two methods: central sorting and local sorting [3]. Central sorting has a low requirement for the public’s knowledge reserve. Traditional trash bins are used to recycle all kinds of garbage. After all garbage enters the recycling station, centralized sorting is performed according to the type of garbage. At present, central sorting is mainly realized by manual or robots, among which robot sorting mainly relies on methods based on deep learning to perform target detection, classification, and recycling of garbage image information [4]. Local sorting needs to use the classified garbage bins instead of traditional garbage bins, that is, to achieve classified delivery at the front end [5]. The advantage of this method is that it can effectively avoid the problem of secondary pollution caused by the mixing of garbage in the central sorting method during the transfer of garbage. The disadvantage is that the user needs to put different garbage separately, which will increase the time cost of users but save the time cost of postprocessing. On the whole, the social time cost has not increased significantly. Therefore, more and more classified garbage bins are distributed in various locations of the city, and there have even been a large number of household classified garbage bins [6].

To achieve effective local garbage sorting, users need to have the knowledge of garbage separation so that garbage can be put into the right bins. However, there are many kinds of garbage. Even if people have the awareness of garbage sorting, they often cause wrong disposal due to the lack of knowledge of garbage sorting. In recent years, in order to avoid the problem of wrong disposal, a variety of automatic sorting garbage bins have been produced, which are mainly divided into methods based on image recognition [7, 8] and speech recognition [9, 10]. The method based on image recognition relies on the camera to capture the image of garbage and compare it with the database to determine the type of garbage. This method mainly relies on target detection algorithm based on deep learning. Its classification accuracy depends on the accuracy of target detection algorithm, and the effect is good. However, image recognition has high requirements on hardware and recognition environment, so the popularization cost is high. The method based on speech recognition recognizes the garbage name spoken by the user through speech recognition chip and compares it with the corpus to determine the type of garbage. The classification accuracy of this method depends on the accuracy of speech recognition, which is higher than that of image recognition, with lower cost and stronger environmental adaptability. But it is not friendly to people with certain speech and hearing difficulties. In addition, since the intelligent local sorting garbage bins are distributed outdoors, the problem of power supply needs to be considered.

To sum up, combined with the actual needs and based on the method of speech recognition, this paper designs an intelligent control garbage bin that automatically reminds and helps people to classify garbage scientifically and accurately. Compared with the traditional classification garbage bin, the intelligent garbage bin designed in this paper can automatically and accurately classify garbage items according to the name of garbage items informed by the user’s speech and automatically open the corresponding bin lid, which is convenient for the user to put in. In addition, ultrasonic ranging and wireless data transmission are added in the box. When a certain type of garbage is almost full, the data will be automatically sent to the garbage management department to facilitate the timely cleaning of garbage, ensure environmental hygiene, and improve work efficiency, avoiding unnecessary garbage removal and transportation work. Compared with the automatic sorting garbage bin based on speech recognition designed in the literature [9, 10], manual mode has added to the garbage bin designed in this paper, which combines the traditional sorting garbage bin with the automatic sorting garbage bin. The advantage is that there is no need for secondary sorting for some common garbage that is easy to classify, or for the garbage that users have already sorted at home, saving the delivery efficiency. More importantly, it is more friendly to users with certain speech and hearing difficulties, ensuring the harmonious development of society. In terms of electricity, since the power consumption of the garbage bin is not high, it can be powered by small solar cells outdoors [11].

The rest of the paper is organized as follows: in Section 2, we describe our system, including the overall design and the design of each functional module; the system implementation is in Section 3; the system testing and result analysis are discussed in Section 4, followed by the conclusion in Section 5.

2. The System Design

2.1. The Overall Design

The STM32F103 is taken as the main control data transmission part, which also includes the part of garbage type recognition by speech, the part of ultrasonic detection whether garbage is full, the part of steering gear for opening the garbage bin lid, and the part of WiFi module for storing and sending data. The system block diagram of intelligent garbage bin is shown in Figure 1.

When the user is not sure which type of garbage belongs to, just say the name of the garbage, the speech recognition module will automatically recognize the input voice (garbage name), the system will automatically search for the garbage that belongs to that category and make a voice reminding and, at the same time, drive the steering gear to open the lid of the corresponding type of garbage bin for people to put this type of garbage. The ultrasonic ranging module will detect the garbage loading in each bin in real time. If the garbage reaches a certain level, the wireless transmission module will send the data of which bin needs to be cleaned and replaced to the background staff, reminding them to clean up the garbage in time.

2.2. Functional Module Design
2.2.1. Speech Recognition Module

Speech recognition [12, 13] is to convert the content of human speech vocabulary into the input that can be read by the computer. It is divided into two stages: training and recognition. Both of these two stages must preprocess the input speech and extract the characteristics. During the training period, a large amount of speech corpus was collected, and the feature parameters were obtained by preprocessing and feature extraction. Finally, the training speech reference library was established through modeling. The recognition stage is to compare the features in the input speech with those in the reference model and then take the most similar input as the output of the recognition result, so as to achieve speech recognition.

The system designed in this paper needs to analyze the input voice content and give four results of “recyclable garbage,” “harmful garbage,” “food garbage,” and “other garbage” to drive different garbage bin lids. In this paper, the LD3320 developed by ICRoute Company in the United States [14] is used to achieve the realization. The core chip contains a speech recognition signal processor and some other external integrated circuits, which can be directly integrated with the company’s existing hardware products to easily achieve automatic speech recognition, automatic voice control, human-computer interaction dialogue, and other functions. The internal host computer has developed a configuration software, which can be opened to access and configure the internal resources of the speech module, and to add or delete human-computer interaction entries. The configuration of the speech module software entry is shown in Figure 2.

When the speech recognition program is powered on and initialized, it enters the state of waiting to be woken up. The microphone monitors whether there is voice command input from the outside in real time. After receiving the voice input with instruction, the input instruction is compared with the list of keywords to determine whether the input instruction is correct or not. After judging the correct operation instruction, the analysis results are determined whether it belongs to “recyclable garbage,” “harmful garbage,” “food garbage,” or “other garbage.” After the judgment is completed, the data will be stored and sent to the STM32 master control module to end the program running [15, 16]. The program flowchart of the speech recognition module is shown in Figure 3.

2.2.2. Steering Gear Drive Module

The steering gear [17] is mainly composed of shell, circuit board, driving motor, reducer, and steering gear position motion sensor. Its working principle is that the receiver sends a power signal to a steering gear swing arm and drives it through an IC, and the motor swing arm begins to rotate at high speed. The axial power is transmitted to the front end of the steering gear’s swing arm through the gear of the reducer, and the power signal is transmitted through the detector at a fixed position to determine whether the designated position has been reached. The signal of the controller is connected to the signal receiving chip of the modulator through the channel on the receiver to obtain the DC bias voltage regulator.

When the steering gear is powered on, the signal will be detected to determine whether the driving signal [18] is received. When the signal is received, the motor rotates to drive the torque shaft. At the same time, the stop signal will be detected and judged, and the rotation will end when the signal is received. In this paper, the MG90S model simulation steering gear is selected, which has a large pulling force and is suitable for various experimental scenes. The operation is fast, the service life is long, and the torque is large. The program flowchart of the steering gear drive module is shown in Figure 4.

2.2.3. Ultrasonic Ranging Module

Ultrasonic ranging [19] is to calculate the distance by measuring the time difference between the ultrasonic transmitter transmitting and receiving ultrasonic waves. The transmitter of the ultrasonic ranging module will transmit a certain frequency signal and then be reflected back by the object. It will be converted into a voltage of energy by the receiver, and then the module will process and calculate it internally. Use formula (1) to get the distance between the module and the target object:where t is the time from ultrasonic transmission to reception, the unit is s; C is the propagation speed of ultrasonic in the air, which is a constant 340 m/s; and L is the distance between the sensor and the target to be measured, the unit is m.

In this paper, the HC-SR04 module is used to realize ultrasonic ranging, and the capacity of the garbage in the garbage bin is obtained in real time. When the capacity reaches the preset value, an output signal is given to remind the staff to clean up. The HC-SR04 ultrasonic ranging mode (except the power cord) is a two-wire system. When starting, the module will send out a certain number of pulse signals with a certain frequency. The IO terminal of the master IC will detect the echo. When a signal returns, the IO terminal will output a high level. This time difference is calculated by the duration of the high level. In these programs, the measurement time of ultrasonic wave is calculated by the STM32 timer [20], and then the program calculates the average value and judges whether it is in the normal range to decide whether to run the next step. The program flowchart of the ultrasonic ranging module is shown in Figure 5.

2.2.4. Wireless Transmission Module

The WIFI module uses a specific channel to quickly connect to the Internet. The wireless signals received from the antenna [21] are filtered and transmitted to the power amplifier circuit to achieve power increase. After being processed by the WiFi chip, the information is transmitted to the CPU through the SDIO interface and then sent to the software or application program, which is converted into data signals suitable for transmission and sent to the antenna.

In this design, the ESP8266 series WIFI module is selected to realize the transmission function of garbage-filled signal. After the system is powered on, it will automatically connect to WiFi, automatically connect to the server, synchronize data with the server, and wait for the user to input instructions. After receiving the operation instruction, the ESP8266 will store and send data in real time. The program flowchart of the wireless transmission module is shown in Figure 6.

3. The System Implementation

In order to test the function of the designed garbage bin, the hardware system is designed, and its hardware system module connection diagram is shown in Figure 7(a). It contains wireless transmission module, transceiver, garbage bin, speech recognition module, ultrasonic ranging module, and control system. Among them, the wireless transmission module is used to receive the digital control signal from the control system and forward it to the transceiver in the garbage bin, to receive the garbage height feedback signal from the transceiver and forward it to the control system, and to receive the digital speech information keywords from the speech recognition module and forward it to the control system. The transceiver is used to receive the digital control signal from the wireless transmission module and transmit it to the signal modulation chip, to receive the garbage height signal from the ultrasonic ranging module and package it into the feedback signal, and to send the feedback signal to the wireless transmission module. The garbage bin is used for sorting and storing rubbish. The speech recognition module is used to receive the analog speech message from the user, then to convert the analog speech message into the digital speech message, then to recognize the keywords in the digital speech information, and finally to send the keywords to the control system. The ultrasonic ranging module is used to detect the height of the garbage stored inside the garbage bin in real time. The control system is used to receive the feedback signals and keywords from the wireless transmission module, then to process the digital control signals according to the feedback signals and keywords, and finally to send them to the wireless transmission module. The assembly diagram of hardware system is shown in Figure 7(b).

The software flowchart of the system is shown in Figure 8. First, the system is initialized, and the speech recognition module judges whether the command is received. If it receives a voice command, it judges whether the command belongs to a correct detection command and then judges the content of the command and analyzes which type of garbage belongs to. If no voice command is received, it determines whether there is a manual operation, and if there is manual operation, it directly locates a certain type of garbage according to the manual operation button. The system drives the steering gear to open the corresponding garbage bin according to the speech recognition result or the garbage type selected manually. The ultrasonic ranging module detects the garbage loading height in the garbage bins. If it is full, it will be reported to the back-end control system by the WIFI module.

4. System Test and Result Analysis

The software is written by Keil µVision5 software. The program includes speech recognition part, ultrasonic ranging detection part, steering gear driving part, and WiFi module used to store and send data. After the program is compiled, a .hex file is generated, and then the program is downloaded and recorded into the STM32 minimum system for functional testing.

4.1. Function Test and Realization of Speech Recognition and Steering Gear Modules

First, adjust the appropriate distance to the microphone of the speech recognition module, and say the wake-up word “Xiao Deng” to wake up the speech recognition module. Before the speech recognition module is woken up, the working indicator light is off, and at this time, any key words shouted into the microphone will not be recognized by the system. When the speech recognition module is successfully woken up, the working indicator light on the speech recognition module will light up and enter the state of waiting for command input. The state before and after the speech recognition module is successfully awakened and is shown in Figure 9.

After the speech recognition module is successfully awakened, it shouts “Open all the garbage bins” to the speech recognition module, and the module replies “05” through the serial port and sends the corresponding data to the STM32 master control module. According to the internal program, the steering gear is controlled to drive the motor to rotate, open the lids of all the garbage bins, and wait for people to put garbage in or replace the garbage bins and other operations. During the waiting process, the waiting delay is automatically closed, and the lid will not be closed automatically before the voice input “close all the garbage bins” command. After inputting the “close all the garbage bins” command, the ultrasonic ranging module detects the loading status of the garbage bins and sends the data to the back-end management APP in real time, which is convenient for management staff to observe the garbage loading level in the garbage bins and replace some bins in time.

Select the appropriate distance to the microphone of the speech recognition module, and say the preset keywords corresponding to the classification, and the speech recognition module will automatically recognize and compare the keywords. The voice broadcast provides the garbage category that people throw and feeds back the data to the STM32 master control module. The internal program controls the corresponding steering gear to drive the motor to rotate and open the corresponding garbage bin lid for people to throw. Say the internally set keywords of “recyclable garbage,” “harmful garbage,” “food garbage,” and “other garbage,” respectively, the speech recognition module can identify and broadcast the garbage to which category it belongs to quickly, effectively, and accurately, and drive the steering motor to rotate, open the corresponding garbage bin lid, and wait for people to put the garbage in, the waiting time is 3–5 s. After the waiting time is over, the lid of the garbage bin is closed automatically. If it is necessary to continue throwing, you can say the garbage keywords again. After the lid of the garbage bin is opened, the garbage can be put into the garbage. This design can recognize and operate the next keyword again after responding to one instruction. The six states of the garbage bin are shown in Figure 10.

The classification accuracy of the system mainly depends on the accuracy of speech recognition. The recognition accuracy of the speech recognition chip used by the system is 95% [22]. The recognition results are affected by excessive speed, low voice, surrounding noise, and dialect problems. After all kinds of common garbage, people in the natural environment, using normal speed and volume to test the system, the garbage bin can open the correct lid. However, human factors can lead to the problem of misplacement of garbage. For example, there are various types of paper. “Book paper” belongs to “recyclable garbage,” but “toilet paper” belongs to “other garbage.” Therefore, if the user speaks the garbage name incorrectly, it will lead to misclassification and reduce the reliability of the system to some extent.

4.2. Function Test and Realization of Ultrasonic Ranging and Wireless Transmission Modules

When the lid of the garbage bin is closed, the ultrasonic ranging module starts to detect the garbage loading condition and sends the detected data to the STM32 master control module, and then the WiFi module sends the data to the back-end management APP. It is convenient for back-end management staff to grasp the loading status of garbage in the garbage bin in real time, realize the intelligent service. The data display of the back-end APP is shown in Figure 11. At this time, it shows that the garbage loading in the four garbage bins have not reached the state of early warning and replacement.

After adjusting the distance from the microphone of the speech recognition module, say the keywords of the food garbage set internally, and the speech recognition module successfully identifies the food garbage and gives a voice notification. The STM32 master control module drives the motor of the steering gear to rotate, opens the corresponding bin lid, and waits for the garbage to be placed. In this experiment, a plastic cylinder with a height of about 9–10 cm is used to replace the garbage and put it into the garbage bin. After waiting for the lid of the garbage bin shut down automatically, the ultrasonic ranging module starts to detect the garbage loading condition and sends the detected data to the STM32 master control module. The STM32 master control module synchronizes the data to the internal ESP8266 of the WiFi module. After the data synchronization is completed, the data is sent to the produced back-end management APP, and the garbage loading height in the garbage bin is fed back in real time. The internal control program sets the ultrasonic ranging module to reach the state of early warning replacement if the detected distance is less than 5 cm. The height of the test cylinder is 9–10 cm, and the height of the garbage bin is about 13 cm. Therefore, the system judges that the loading height of No. 3 garbage bin (food garbage) has reached the state of early warning. The data fed back by the WiFi module to the back-end management APP shows that the food garbage is in an early warning and replacement state, as shown in Figure 12. The judgment process for other types of garbage is similar.

If the user puts in a large amount of garbage at one time after the garbage can is opened, it may cause the lid of the garbage cannot be closed properly and even affect the environment because of garbage overflow. Therefore, we have designed the software accordingly. When the lid of the garbage bin is opened for more than the set time (1 minute set in the experiment, adjustable), and the closing signal of the lid is still not received, the status of the garbage bin will be judged as “full” directly, and the WiFi module will be triggered to feed back to the back-end management module to prompt the garbage removal and transportation in time.

5. Discussion

This design uses speech recognition technology to achieve local sorting of garbage. Before people put garbage in, say the corresponding garbage name, the system automatically compares the keywords, prompts people which category of garbage they want to put in, and automatically drives the steering gear to open the lid of the corresponding type of garbage bin, which is fast, convenient, and effective to help people intelligent garbage classification. For common easy-to-sort garbage or garbage that has already been classified, people can also choose to manually open the corresponding category of garbage bins for delivery. Manual mode saves time in garbage disposal and is friendly to people with certain speech and hearing difficulties. When a certain type of garbage is about to be filled, it can also automatically send a full-load signal to the data center, prompting the management department to deal with the garbage in time. The test results show that the intelligent garbage bin is simple and effective and provides a feasible solution for garbage classification and public environmental protection.

Data Availability

The data used to support the findings of this study are included within the article.

Conflicts of Interest

The authors declare that they have no conflicts of interest.

Acknowledgments

The authors gratefully acknowledge the financial support provided by the Natural Science Foundation of Xiaogan (XGKJ2021010005).