newlandmark

# Sixth Lichuang Electric Competition# Weather Clock Voice Assistant

 
Overview

Note: * is a required field, please fill it in during the registration stage↓

* 1. Introduction to project functions

This is an online weather clock (offline voice control version) that can reply to a series of information such as the current "time", "month", "week", "temperature", etc. based on specific command words issued by the user.

Project design requirements and functions:

  1. Can display real-time time on OLED screen
  2. Support web configuration and reconfiguration
  3. Show weather
  4. Adjust screen brightness function
  5. Button to rotate screen 0 degrees/180 degrees
  6. Adjust screen brightness
  7. Respond to a series of information such as the current "time", "month", "week", "temperature" and so on based on the voice command words.
  8. You can set the volume according to the voice, and turn the voice on and off.
  9. Set usage prompt tone when powering on
  10. When waking up and exiting, there are specific voice announcements to remind the user.
  11. Designed in Mini style

WEB network configuration interface

image.png Physical display

image.pngimage.pngimage.png

*2. Project attributes

First published, original

Note: Please indicate whether the project has been made public for the first time; whether the project is original; whether the project has won awards in other competitions; if so, describe the details of the award; whether the project has participated in a defense in school.

* 3. Open source agreement

GPL3.0

Note: Altruism means self-interest, please read the following content carefully.

  1. Embrace open source and give projects unlimited value. It is recommended that more than 80% of the core functions of the project be open source;
  2. If a certain part of the function is irreplaceable and the project cannot solve the corresponding problem after deletion, then the function implemented by this part is the core function of the project; for example, if an electronic load is designed and a host computer software is designed to monitor power changes, the electronic The load is the core function, and the host computer software is the auxiliary function; for example, an isolated 485 module is used in the electronic load to communicate with the host computer, then the communication function implemented by this 485 module is an auxiliary function;
  3. Projects should choose an open source agreement that suits them. If the project references other open source projects, the source should be indicated and follow the original author's open source agreement. It is recommended that original projects use the GPL3.0 open source agreement;
  4. Functions implemented by directly quoting the original circuits or original codes of open source projects cannot be used as the core functions of one's own projects, and functions directly implemented using common modules on the market cannot be used as core functions of one's own projects.

Please fill in during the competition stage↓

*4. Hardware part

  1. The main controller uses ESP8266-12F. The module core processor ESP8266 integrates the industry-leading Tensilica L106 ultra-low power consumption 32-bit micro MCU in a smaller size package with 16-bit streamlined mode. The main frequency supports 80 MHz and 160 MHz. , supports RTOS, integrated Wi-Fi MAC/ BB/RF/PA/LNA, onboard antenna. Supports standard IEEE802.11 b/g/n protocol and complete TCP/IP protocol stack. Users can use this module to add networking capabilities to existing devices or build independent network controllers. In addition, it only requires very few external circuits and can reduce the size of the PCB to the minimum, which is very suitable for making Mini products. Moreover, ESP8266 has a very good ecology and supports a variety of programming methods. Essence has provided ESP8266 IDE2.0 Development environment, it also supports Arduino IDE for development (this project is developed based on the Arduino IDE environment). In addition, Lua language, Python language, etc. can be used to develop ESP8266 control programs. image.png
  2. The offline voice part uses Qiyingtailun's CI-C22GS02S module. The control chip on the module is CI-1122. It has rich pin resources, supports custom wake words and command words, and also supports noise reduction processing. Price It is cheap, so this project adopts this solution for offline voice.

image.png

  • Design an independent button using the GPIO0 pin. You can use this pin to start the download mode or use it as an ordinary button to further save PCB space. Users can use this button to control screen brightness, flip and other functions.

  • Reserved ESP8266 serial port download interface and offline voice module serial port download interface

  • Use an OLED 0.96-inch screen with a total of 128*64 pixels. The aspect ratio is just right for displaying weather, time and other elements. You can also add some UI. The communication interface uses IIC communication and only requires 2 pins (not included). power and GND)

  • Using 5V USB-Type-C for power supply, there is no need to consider the issue of forward and reverse plugging. In addition, most Android phones on the market now use this interface, and users do not need to find additional power cords to adapt.

  • AMS1117-3.3LDO step-down chip is used. This chip converts 5V to 3.3V power supply, mainly to power ESP8266-12F.

  • The offline voice module comes with a 5V-3.3V DC-DC chip, so you only need to supply the 5V power supply to the offline voice module.

  • According to the offline voice module manual, capacitors and diodes need to be added to the peripheral circuit. image.png

  • Speakers and microphones use differential wiring

image.png

Note: It is recommended to use Lichuang EDA. If you choose other EDA tools, please upload schematics in PDF format, PCB drawings in PDF format, and PCB files in Gerber format in the attachments. Here you can explain in detail your project implementation principles and mechanisms, precautions, debugging methods, testing methods, etc. It is recommended to introduce your ideas to others in the form of pictures and texts.

*5. Software part

Overall programming ideas

image.png

Adopt modular design ideas. In this project, two microcontrollers run independently and communicate through the serial port. It can be considered that ESP8266-12F is the main controller and the offline voice module is the secondary controller.

  • Get time module
  • Get weather status module
  • Key status detection module (not pressed, single click, double click, triple click, long press)
  • OLED screen display driver module
  • Serial port receives data and unpacks the module
  • Serial port to send data, package module

Ideas for implementing OLED related functions:

  • Display the time on OLED: call the time acquisition module, save the time in a variable, and call the OLED display module
  • Display the weather on OLED: call the weather status module, save the weather code into the corresponding variable, save the temperature and humidity data into the corresponding variable, and finally call the OLED display module to display the corresponding weather icon according to the weather code.
  • Adjust screen brightness function: Set the screen brightness adjustment as a click execution event, call the key status detection module in a loop, when the click mark is returned, execute the screen brightness adjustment function, and then call the OLED display module to refresh
  • Rotating screen function: Set the rotating screen as the execution event of double-click, call the key status detection module in a loop, when the double-click mark is returned, execute the rotating screen function, and then call the OLED display module to refresh
  • Display animation function: set the rotating screen as the execution event of three clicks, call the key status detection module in a loop, when the three-click mark is returned, execute the rotating screen function, and then call the OLED display module to refresh
  • Network reconfiguration function: Set the network reconfiguration as the execution event of long press, call the button status detection module cyclically, when the long press mark is returned, execute the network reconfiguration function, and then call the OLED display module to refresh

Design ideas for voice broadcast of information such as "time", "week" and "temperature":

When the correct command word is spoken, UART1 of the offline voice module will send a series of hexadecimal data packets. By unpacking the data, you will know what command word is spoken. For example, if you say "What time is it now?" The packet will get valid data as [0x14 0x00 0x00 0x3F] (this data can be set by yourself), thus forming a corresponding relationship between this string of data and the sentence "What time is it now". When ESP8266-12F receives the message sent by the voice module This string of data will know that the user wants to ask "what time is it" now, and then ESP8266-12F will obtain the current time and send it back to the offline voice module through a specific serial port protocol to make it broadcast. After the offline voice module receives this string of data , after unpacking, the broadcast corresponds to the digital tone 0-9. If it is "twenty-three forty-one", the data is processed on the ESP8266 side to split it, and "two" is sent first and then "ten". . . Send them one by one, pay attention to add a little delay, and broadcast the offline voices one by one. When combined, we will get the effect we want. Here is only one idea. With this idea, in theory, a lot of information can be broadcast, such as sunny days and rainy days. , thunderstorm, snowy day, etc. Note that the phonetic words can be reused, such as sunny day , rainy day , snowy day , all have the word "天" , then the voice package only produces "sunny", "rain", "snow", that is However, the rest is combined with "day", and the same is true for time one to nine. "Ten" is taken out separately for multiplexing, such as sending "two", "ten" and "three" voice packets continuously instead of making and sending "twenty-three" .

This is the serial port command format for offline voice

image.png The following is a human unpacking of data - after understanding the principle, you should use a program to unpack, judge the beginning and end of the data through the frame header and frame tail, and then judge the message type through the 5th bit of data, and block the notification type. (A3) and reply type (A2), only look at the command type (A1 or A0) image.png

  • When sending audio, since the audio ID number is not supported, the command word ID is used here as the audio, but the command word is not given a specific function and is only used for broadcasting the sound. This is what I can think of inside the offline voice. Program is a way to realize the broadcast function just by changing the ESP8266 program. If you have any better methods, you can share them together. image.png

This is a packet of data manually written and calculated based on the serial port protocol above. Note that when sending, you must check the HEX hexadecimal format, not the ASCII format.

【0xA5,0xFC,0x06,0x00,0xA1,0x92,0x02,0x80,0x92,0x02,0x00,0x00,0x00,0x49,0x02,0xFB】

【A5 FC 06 00 A1 92 02 80 92 02 00 00 00 49 02 FB】 无0x前缀版

The audio corresponding to the command word ID number 2 can be played. It should be noted that the message sequence number can be filled in at will, but the corresponding check digit also needs to be modified. After understanding the principle of the serial port protocol, you should use a program to automatically complete the packet assembly process. We only need to pass in the ID number to the interface. image.png This is the core code for sending offline voice (the personal program is very rough and only implements the functions. There may be bugs that have not been optimized. Welcome to communicate with each other)

/*
 * 函数功能:发送离线语音声音数据包
 * 形参:命令词 ID号
 * 返回值:无
*/
void send_voice(uint8_t cmd_id)
{
  int i = 0;
  sendBuf[i++] = 0xA5;  //帧头1
  sendBuf[i++] = 0xFC;  //帧头2
  sendBuf[i++] = 0x06;  //有效长度为 6
  sendBuf[i++] = 0x00;  //
  uint8_t temp = i;
  sendBuf[i++] = 0xA1;   //A1命令 A2回复 A3通知

  sendBuf[i++] = 0x92;   //命令词ID
  sendBuf[i++] = 0x02;   //消息序列号
  /* Data begin */
  sendBuf[i++] = 0x80;   //0x80:开始。仅开始后续ID才有意义。0x81:暂停 0x82:继续。0x83:停止。
  sendBuf[i++] = 0x92;   //播放方式
  /* 这里4位数据也应该低位在前,高位在后,本程序未使用语义id,所以未做处理 */
  // uint8_t  high_1 = (sum >> 8) & 0xff; //高8位
  // uint8_t  low_1  = sum & 0xff; //低8位
  sendBuf[i++] = cmd_id;   //data
  sendBuf[i++] = 0x00;
  sendBuf[i++] = 0x00;
  sendBuf[i++] = 0x00;
  /* Data end */
  int sum = 0;
  for (; temp < i; temp++)
  {
    sum = sum + sendBuf[temp];
  }
  uint8_t  high_check = (sum >> 8) & 0xff; //高8位
  uint8_t  low_check  = sum & 0xff; //低8位
  sendBuf[i++] = low_check;   //校验位 低位在前
  sendBuf[i++] = high_check;  //校验位,高位在后

  sendBuf[i++] = 0xFB;  //帧尾

  for (int m = 0; m < i; m++)
  {
    softSerial1.write(sendBuf[m]);
  }
  memset(sendBuf, 0, BUFF_SIZE);
  delay(300);
}

As for the offline voice module program burning method, Li Gong gave a more detailed explanation in the offline voice course of the 2021 Lichuang Summer Training Camp. I will not go into details here. The establishment of the ESP8266 Arduino development environment is lengthy and there are many blog posts on Baidu, so I will not go into details here. Narrative.

Let’s share how to customize your own personalized Web configuration page, and how to query the weather through the main program search. You can register the private key in the userkey with Hefeng Weather by yourself. image.png The location city code of the main program can also be queried online.

The third line of parameters for configuring the WiFi interface is on line 334 and can be modified.

/**********************************/
  page += String(F("<h1 style="color:#CCFF99">网络天气时钟</h1>"));
  page += String(F("<h1 style="color:rgb(0, 60, 255)" >离线语音版</h1>"));
  page += String(F("<span style="text-align:right;">"));
  page += String(F("<h3 style="text-align:right;color:rgb(0, 0, 0)" >--Elec0</h3>"));
  page += String(F("<h4>XXX</h4>"));
  page += String(F("<h2 style="color:#36ee3f">立创暑期训练营2021</h2>"));
  page += String(F("<h4>2021.XX.XX-2021.XX.XX</h4> "));
/****************************************/
/*上边这些语句可以自定义修改主界面文字,在WiFiManager.cpp中,460行左右,*/

If you want to change the color of the button, you can find the value after the button in WiFiManager.h, const char HTTP_STYLE[] PROGMEMin the statement around line 26, background-color:#8a0bdf;color:#e8f806; and change the value after the # number. You can search on Baidu to find out which number corresponds to what color.

Note: If your project involves software development, please upload the corresponding project source code in the attachment. Here you can describe in detail your software flow chart, functional module block diagram, explanation or popular science of related algorithms, source code structure, programming, source code compilation method, program burning method, etc. It is recommended to introduce your ideas to others in the form of pictures and texts.

*6. BOM list

image.png

Note: BOM list involved in the project. Please upload a screenshot of the BOM at this location. Please upload the list details in PDF format to the attachment. Suggest packaging, purchasing channels, uses, etc. The specific content and form should be based on clearly expressing the project composition.

*7. Contest LOGO verification

Not participating

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

Video requirements: Please shoot horizontally, the resolution is no less than 1280×720, the format is Mp4/Mov, and the size of a single video is limited to 100M; Video title: Lichuang Electronic Competition: {Project Name}-{Video Module Name}; if Innovation Competition: "Autonomous Driving"-Team Introduction.

More details: https://diy.szlcsc.com/posts/06c94d90c2c447dfbd9ed7339ff4a5b1

Retrieved from https://lceda.cn/account/user/projects/index/setting?project=1b1c881ca0514addbcaf94c0d3bc1fc6&folder=all

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-07-01 16:34:10
  • 【Design tools】user.manual.lpc17xx
  • How to develop MP3 files in wince5.0 VS2005 C#?
  • Know a little about the safe transportation rules for lithium batteries
  • Ji Shisan's High School Speech
  • Experts please help! --About EVC Bluetooth development
  • STM32 PWM generation under HAL library

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号