This work is a multi-functional voice-enabled night light . We can interact with the desk lamp through voice, and let it turn on the light, turn off the light, and adjust the brightness. There are 2 infrared transmitting tubes on the control panel , so it can also be used to control home appliances by voice. The USB socket can be plugged into any USB powered device, the maximum power supply is 5V/2A (try not to be close to 2A, the actual maximum is probably 1.5A!) .
The small desk lamp has a built-in 900mAh rechargeable lithium battery, which can be charged using a commonly used mobile phone typec charger at home . With the battery, you can carry it with you, and there is no need for a wire to limit the placement of the small desk lamp, allowing it to appear anytime and anywhere. at your side. The design of the desk lamp is very user-friendly. When the small desk lamp is not awakened, it is in a dormant state and the dot matrix screen will not light up the expression. This means that it can be kept on and placed beside the bed during sleep, and can be called at any time. After waking up the small desk lamp, it will blink and make expressions like humans , which adds a little spirituality to the small desk lamp . A button is configured on the panel, click to switch the light switch state, double click to display the remaining battery power . In addition, there is a blue charging indicator light on the control panel , which will light up when charging and will go out after charging is completed. This makes it easy to observe the battery status and facilitate use.
The small table lamp shell is made of paper (because I don’t know 3D modeling).
I call the voice desk lamp Little B. Just call Little B and he will show his expression to interact with you. Below are the shapes of the small fan mode and night light mode .
The voice commands are as follows
Voice call command | |||||||
Little B | Turn on the light | Turn off the lights | Turn on the fan | Turn off the fan | Reduce brightness | Increase brightness | Reduce wind speed |
Increase wind speed | Turn on the TV | Turn off the TV | continue | pause | return | tell a story | Act cute |
TV volume down | TV volume up |
Little B is the wake-up word, and the rest are literal meanings. Continue, pause, and return use infrared to control my Tmall box. When watching a video, I can control the video to pause and continue with my voice. (All effects have video demonstrations in the project attachment)
Original project, published for the first time
GPL3.0
The hardware part is very simple. It is composed of two boards assembled using pin headers and female headers, and is divided into the following modules.
1. ESP12F minimum system
This is the main control, and the circuit is also fixed.
2. tp4056 charging circuit
R8 in the circuit diagram uses 3k. This resistor controls the charging current. Because the 1A charging of tp4056 is too hot, the smaller 400mA charging is used.
3. DCDC 5V boost, 3.3V linear regulator
There is nothing special about the power supply part.
4. CH340 circuit
Connected to 8266 for easy programming, plus a typec port and a micro port. Both data lines can program the microcontroller.
5. NMOS driver circuit
In this circuit diagram, C1 and C3 can be removed. This is the pad for debugging. Soldering it will not affect the circuit operation.
6. Power supply switching circuit
It is implemented using P-channel. When there is an external charger input, the power supply is switched from the battery to USB.
Hardware verification:
All functions can be perfectly realized according to the schematic diagram, and there are no errors after verification. Below is the bare metal appearance.
The software part is relatively simple, because it uses 8266 for main control. The software part is mainly divided into the following tasks.
1. ASRCheck()
That is, by reading the serial port data of the voice module, we can determine which instruction has been specifically recognized, and then what response is issued. This is an important function of the main loop, and operations such as infrared emission are written in the corresponding responses.
2. breath() sleep() LEDShow()
The first two are task functions for controlling dot matrix screen expressions. breath() uses the timer effect implemented by millis() to make the blinking effect more realistic. sleep() is an expression management function that enters sleep. It is to make this night light more practical. The expression cannot be on all the time, otherwise it would not be called a night light. When the voice module issues a leave command, the small desk lamp will enter the sleep state, the expression will change to the sleep state, and then the dot matrix screen will turn off after 2 seconds. Finally, LEDShow is a dot matrix screen display function written by myself, which is more convenient for me to use.
After debugging, the blinking time is 4 seconds and the eye opening time is 0.4 seconds for the best effect. The blinking characteristics turn it into a spiritual little desk lamp.
(You can watch the video for specific effects)
3. click() doubleclick()
These two event response functions are respectively key click and key double click. Using Arduino's OneButton library, you can easily implement key click and double click responses.
4. checkbat()
This function is called after double-clicking the button to check the battery voltage. It is very simple. It uses ADC to detect the battery voltage, processes the voltage, and then obtains the corresponding battery graphic, which is displayed on the dot matrix screen. The picture below shows the fully charged condition.
5.lightset()
This function is a function that manages the dimming/brightening of lights, and is also the main function in the main loop. We are using pwm dimming, so we can use analogWrite to dim or turn on and off.
6. Main loop
Therefore, with the above functions, the following main loop is formed. You can see that the code level is clear and the readability is good. These codes perfectly realize all the functions of this work.
( The only regret is that the power consumption of this night light is relatively large, with a quiescent current of 190mA and a battery life of only 5-6 hours. Even if the WIFI circuit function of the 8266 is turned off, it still consumes so much current. The same voice module The power consumption is also there, because I will not write about the low power consumption of the two modules, so I may study it in the future to extend the battery life.)
(The project source code is Taideng_V2 in the project attachment)
All reference designs on this site are sourced from major semiconductor manufacturers or collected online for learning and research. The copyright belongs to the semiconductor manufacturer or the original author. If you believe that the reference design of this site infringes upon your relevant rights and interests, please send us a rights notice. As a neutral platform service provider, we will take measures to delete the relevant content in accordance with relevant laws after receiving the relevant notice from the rights holder. Please send relevant notifications to email: bbs_service@eeworld.com.cn.
It is your responsibility to test the circuit yourself and determine its suitability for you. EEWorld will not be liable for direct, indirect, special, incidental, consequential or punitive damages arising from any cause or anything connected to any reference design used.
Supported by EEWorld Datasheet