桂花蒸

# Sixth Lichuang Electric Competition#Multifunctional voice desk lamp

 
Overview

 

* 1. Introduction to project functions


    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)

 

*2. Project attributes


Original project, published for the first time

 

 

* 3. Open source agreement


GPL3.0

 

 

*4. Hardware part


  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.

6Tm1BwLBp10Gj4HpqOj8NkC4yOZWoiKBJjopzKlE.png

  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.

  AADk2yKNqwXDCYNDAFCLgNq5D8nnIxwGbfpMaUco.png

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.

  zDQ9KA64LQOq31s0eICPXKaA4tc1Hd44lMbRDA1m.png

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.

IGm7rMzHXok6ARfJpZUDDNAODwPsAJWfYzFlAqcG.png

 

 

  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.

 

 

*5. Software part


     The software part is relatively simple, because it uses 8266 for main control. The software part is mainly divided into the following tasks.

ofRw5d1aKbinwNycjD7DaOJsDIH0fB2o9IDniOvF.png

    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.

MaesjD20Ic0Y1fbOPnjsauomkjozV19syYvJTZfq.png

           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.

juERrGLA8a4NrWkwkM3Mf7dbeVfIsvNeO8g2sBiQ.png

xFvAySUMSmG9rNxkdMugDEeICG4dQEyIIxqz6ahZ.png

                    (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.

utKZG38viUxANbQTiYKOtNmg7RTY0oeulOqvnYjb.png

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.

3NZPGcp359zFF25ukOHkBf1RXMNpZAjEgMWVZZE7.png

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.

Racl1zgIEKj63QQATllBO3ywZH1q3FMrcuCTOiFn.png

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.

Pze3NF0qxroC02jg9h0tzucsYzYLr7Gzte2mwT8c.png

  ( 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.)

*6. BOM list


q7nJ8MbpXEfotK2Shz7zKeBIOwXXQKxrhN5l4and.png

oPoxoHNwcLvN7OKw5xM466vnNvaFyLWuPOgr5Pg5.png

*7. Contest LOGO verification


 

dlFogCZryW6Tc0DLuo4kXwhnSGxTDQT2sUeGcjWi.png

HWlSsPr2LxUM2SxjiUY2mJOlrlXZT3wFRBNjmzn5.png

 

* 8. Demonstrate your project and record it as a video for uploading


 

   (The project source code is Taideng_V2 in the project attachment)

 

 

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-08-04 09:01:03

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号