1. Working principle:
The firmware is generated using the AI-Thinker voice open platform and downloaded to the microcontroller. It can then control the high and low level switching of the microcontroller's GPIO port through pre-set Chinese statements, and realize the analog switch through the external circuit to control the LED to turn on and off.
Here I chose high-level
triggering.
After generating the SDK and firmware on the platform, I downloaded both. The flashing tool is in the SDK. Serial port flashing has a fixed filename. Select the last one: uni_app_release_update.bin.

The flashing tool is located in the example below. After entering the flashing tool, you need to manually select the above bin file:
D:Downloadsuni_hb_m_solution-144646-20240317.tar uni_hb_m_solution-144646-20240317 uni_hb_m_solutionimage_demo Hummingbird-M-Update-Tool
2. Function:
Desk lamps are common. To save space, we usually choose wall-mounted desk lamps. They are generally powered by a USB cable and have a switch to control the on/off state and change the brightness.
Based on my living situation, my light switch is located behind the display screen, and there's a secondary screen on the right. It's inconvenient to reach out and turn off the light, so I designed this voice switch. It's very user-friendly and convenient for me; sometimes when I'm short on time, I just need to say it.
3. Working conditions
: Because I have many data cables and two 12V lithium battery packs that I don't want to waste, I used a DC power connector. Since the microcontroller operates at 5V, a converter is needed. I used a DC-DC step-down converter with the MP2225 chip. DC-DC power conversion circuits can withstand large voltage differences, have a relatively large output current, and a strong load capacity, easily providing several A outputs, which is perfectly adequate for LED lights. It can also be powered by a 12V 1A lithium battery charger.
If there is no DC line, the DC-DC circuit can be removed and a Type-C power supply can be used. Fewer components are required, but the function can still be achieved.
4. Test parameters:
Measure the output current and voltage of the circuit respectively. Powered by a mobile phone charger (5V 1A) and a 12V lithium battery charger (12V 1A).
5V interface output voltage,

mobile phone charger power

supply voltage, 5V interface

current, mobile phone charger current.
Reading the parameters through a multimeter will actually have some error because the current will also be lost when passing through the multimeter. In fact, under the measurement of a multimeter, the difference between the two power supply currents is not that large, so the difference is not visible to the human eye and it can be used normally.
5. Circuit sharing:

Here, an NMOS transistor - AO3400A - is used. High level turns on and low level turns off, thus becoming an analog switch to control the LED's on and off.

The MOS transistor is voltage-controlled to turn on, and I use it here to control the GND on and off.
Next is the more complex DC-DC circuit in this design. During the selection process, it's crucial to follow the official datasheet for appropriate choices. By changing the resistance values, different voltages can be obtained.

This is the official reference design

, recommended resistor and capacitor values for common output voltages


, and a layout reference.

Finally, pay attention to the pin orientation during soldering.