Introduction: Based on Wuhan Xinyuan Semiconductor CW32F030C8T6 and Qiying Tailun CI-C22GS02, the intelligent voice classification trash can can recognize voice to determine the type of garbage and open the corresponding trash can at the same time. It can be connected to ordinary buttons or touch buttons, or it can be connected to infrared proximity sensors to open the corresponding trash can.
Project Description


This design uses Wuhan Xinyuan Semiconductor's CW32F030C8T6 as the main control, which is mainly responsible for serial port communication with the offline voice module, responsible for outputting 4-way PWM signals, driving IPS display, controlling 2-way MOS drive circuits (controlling fans and lights), and driving 4 WS2812B lights. The voice recognition module uses the Qiying Tailun CI-C22GS02 module (the main chip uses Cl1122, which supports offline voice recognition of less than 200 local command words), which is mainly responsible for voice recognition and broadcast voice, and can communicate with the MCU through the serial port.
Introduction to project related functions
1. The command words of the offline voice module can be customized, and up to 200 command words can be entered. Currently, 168 garbage nouns and some control instructions have been entered. When the voice module recognizes the correct command word, the serial port outputs the data of the specified protocol. The voice module can also receive serial port data of the specified protocol to broadcast the specified voice. The serial port 1 of the offline voice module and the serial port 2 of the MCU main control are connected with jumpers to facilitate separate development and debugging.

2. The main control outputs 4 PWM signals (cycle 20us, frequency 50Hz), which can directly drive 4 servos.

3. Four WS2812B lights are used as indicator lights for 4 types of garbage. After the voice module recognizes the correct voice, the CW32 main control controls the specified lights to light up the corresponding colors.

4. The circuit is powered by DC 12V, and outputs 5.2V after DC-DC step-down, and 5.2V outputs 3.3V after LDO step-down. The CI-C22GS02 module, servo, WS2812B, external lights and fans are all powered by 5.2V, while the MCU main control and IPS display are powered by 3.3V.

5. The circuit is designed with 2 MOS drive circuits, which can be connected to a 5V small fan and a 5V powered light. In addition, 2 screen interfaces are reserved, supporting 8-pin SPI interface screens or 4-pin I2C interface screens. 3 groups of expansion interfaces are reserved to lead out all the remaining IO ports for easy expansion.

Hardware introduction
The intelligent voice classification trash can mainly includes the main control board, display screen, independent button module, trash can model with servo installed, and 12V power adapter.
Software introduction
The software is divided into two parts, one is the program development for CW32F030C8T6, and the other is the command words, language model, acoustic model and firmware production for the CI-C22GS02 offline voice module.
1. Program development for CW32F030C8T6. Developed with Keil5, it draws on the official CW32 routines and some programs from big guys on the open source platform. The program involves the implementation of GPIO, DMA, timer, ADC, UART, PWM, SPI and other functions.
Due to my limited level, the program I wrote can only be said to be usable, but not guaranteed to be easy to use. It uses a large number of global variables and there are still many areas for improvement.
Some programs are shown below.
(1) Main program


(2) Serial port sending program

(3) Serial port receiving program (there is a bug, it takes two rounds to receive the complete program)

(4) The program for the servo to execute the action
uses a timer and a flag to slowly open the servo and then slowly close it automatically after a certain period of time. The 4 servos are not affected by each other.
2. The command words, language model, acoustic model and firmware of the CI-C22GS02 offline voice module. For specific production tutorials, please refer to the Qiying Tailun Document Center
(1) Command word list (customized according to your needs)

(2) The corresponding files of the generated language model are placed here


(3) The corresponding files of the generated acoustic model are placed here

(4) Before generating the firmware, you need to manually modify here, and modify it in numerical order (hexadecimal).

(5) Merge and burn the firmware

(6) Pack the firmware

(7) Burn the firmware. Use the CH340 serial port tool, connect the TX of CH340 to the RXD of the voice module serial port 0, connect the RX of CH340 to the TXD of the voice module serial port 0, and GNG to GND. Insert CH340 into the computer first, and after the corresponding serial port appears in the burning software, check the box on the right, then press and hold the UPDATE button, connect the 5V of CH340D to the +5V of the voice module, and the burning software will display the start of burning until the burning is completed. After
the firmware is burned successfully, the speaker should broadcast the welcome words entered in advance, which means that the burning is successful.
Video address: https://www.bilibili.com/video/BV1oh411w7x2/?vd_source=2462ee6bfbc931195c4c43b3838c417c