GSM-Weather-S3
PROGSM-Weather-S3
License
:GPL 3.0
Description
1.Project Introduction
Inspired by the desktop weather forecast and small TV made by netizens on the Internet, and I am also very interested in electronics. So I decided to make a desktop ornament of my own.The official start time of this project is National Day in 2020.After half a year of modifications, the hardware made it to version 7, finalised a gsm-weather version, and only made the PCB and part of the ui.In the following two years, through continuous development, it has taken on its current appearance.
2.Hardware Introduction
The gsm-weather-s3 hardware is mainly divided into a main control board and a USB & SD board. The two boards are connected by FPC.
2.1 Main Control Board.
The main control board uses the ESP32-S3-WROOM-1-N16R8 module for screen display, audio acquisition and playback. Figure 1 is a physical picture of the main control board:
Figure1 Front and back sides of the main control board
2.1.1 The Minimum System Circuit of ESP32-S3-WROOM-1-N16R8
The ESP32-S3-WROOM-1-N16R8 is a module packaged with the ESP32-S3 chip at its core (Figure 2), and the complexity of an engineer's design can be greatly reduced by using this module. If a pure chip is used for design, the designer needs to consider whether the designed antenna can achieve the best performance by himself.We need to adjust the capacitance and inductance to achieve impedance matching in order to design an antenna with the best performance, but this adjustment process is difficult for novices.The design of using the module is greatly convenient for beginners, who can use it directly.
Figure2 ESP32-S3-WROOM-1-N16R8 module
The peripheral circuit of ESP32-S3-WROOM-1-N16R8 is still relatively small. As shown in Figure 3, it is the schematic diagram of the minimum system of ESP32-S3-WROOM-1-N16R8. Except for R18 and C7 of the reset circuit, no other components are needed, and it integrates 16M FLASH and 8M RAM internally.
Figure3 Schematic diagram of the minimum system of the main control
2.2 USB&SD Board
The USB & SD board is mainly responsible for functions such as program download, power management, and SD card base. Figure 4 is a physical picture of the USB & SD board.
Figure4 USB&SD board
2.2.1 Power Automatic Switching Circuit
The power automatic switching circuit is shown in Figure 5, Q6 is a PMOS tube, BAT+ is the battery, and 5V is the charger input, when the charger is not connected Q6 conducts, BAT+ flows through Q6 to supply power to VCC, and when the charger is intervening Q6 cuts off 5V flows through D4 to supply power to VCC.
Figure5 Power automatic switching circuit.
2.2.2 Software Power On/Off Circuit
As shown in Figure 6, U5 is a voltage regulator chip with an output of 3.3V. This chip has an enable function, that is, the third pin (CE). Inputting a high level to this pin turns on the output. Inputting a low level turns off the input. SW2 is a key. One end is connected to the power supply (VCC) and the other end is connected to the single-chip microcomputer pin (KEY_POWER) and the U5 enable pin circuit.
The key power-on process: (When not plugged in for charging) When the key is pressed, VCC flows through SW2 and D5 to give a high level to the CE pin to enable the 3.3V output. At this time, the entire system is powered on and the single-chip microcomputer starts to run. The program first detects the level of the KEY_POWER pin. If the voltage is high level, it indicates that it is a key power-on. Control the POWER_IO pin to output a high level to lock the level of the CE pin. At this time, after releasing the hand, since the POWER_IO is at a high level, it will continue to enable the output of U5.
The charging power-on process: (When the key is not pressed) Insert the charger. At this time, the 5V power is applied and passes through R22 to give a high level to the CE pin to enable the 3.3V output. The single-chip microcomputer runs. The program starts to detect the KEY_POWER level. Since R27 is a pull-down resistor, it is recognized as a low level. The program judges that when the case is pressed, it runs, that is, charging and power-on.
The key shutdown process: The program continuously detects the KEY_POWER level during operation. When it is at a high level, it starts timing. After timing reaches 2 seconds, it starts to detect whether the key is released. When it is released, it pulls down the POWER_IO to enter shutdown.
figure6 On the left of the figure is the main control board, and on the right is the USB & SD board
Note: POWER_IO2 on the left picture is connected to POWER_IO on the right picture through an FPC cable.
2.2.3 USB to serial port circuit + automatic programming circuit
ESP32-S3 supports serial port download. Since the computer does not have a serial port interface, a USB-to-serial port chip is needed. As shown in Figure 7, the model of U13 is CH340C. This chip supports one USB-to-serial port TTL and has RTS and DTR control pins. The internal integrated crystal oscillator greatly simplifies the external circuit.
According to the ESP3S3 datasheet, entering the serial port download mode requires pulling down IO0 before power-on. As mentioned above, the CH340C has RTS and DTR pins. A switch control circuit can be added to realize automatic reset and pull down IO0. As shown in Figure 8, the chip model of Q4 is UMH3N. This chip has two transistors inside and integrates a bias voltage. As shown in the circuit, using the RTS and DTR pins of the CH340C can realize automatic program download.
Figure7 USB to serial port circuit
Figure8 Automatic download circuit.
2.3 PCB Design
Figures 10 and 11 are PCB design diagrams. When designing the casing, the installation and size of the PCB have been determined. In order to reduce costs, both PCBs use a two-layer board design. Due to the relatively small size, the USB & SD board was completed only after multiple layout attempts.The audio chip WM8978 of the main control board is in QFN packaging.,This chip has pads on the bottom,The bottom pad is hollowed out (as shown in Figure 9), so that it can be soldered on the back.
Figure 9
Figure10 Main control board.
Figure11 usb&sd PCB
3.Casing Design
The casing is designed and manufactured using Autodesk Fusion 360.
3.1 Screen Installation
When I was conceiving, I defined the overall appearance of this work under the label of small and mini. Since I don't know how to design the casing, I specially learned Autodesk Fusion 360 to complete this work. This software is a 3D structure design tool. I followed video tutorials on the Internet for three weeks. I encountered many difficulties when designing by myself. The biggest problem is the installation method of the front screen.The front of the casing is a full-screen beveled design. Since it is a beveled surface, it is relatively difficult to calculate the size of the outer frame. Finally, after three 3D printings, the appropriate size is obtained.
Figure12 Bevel and cross-sectional view of the casing
In the left picture, the black part is the screen.
3.2 USB & SD Board Installation.
The USB & SD installation also uses a snap-on style and is directly clipped onto the casing. There are three clamping points at the bottom to fix the USB & SD PCB, as shown in Figure 13.
Figure13 USB & SD fixing points
3.3 Installation of mainboard and battery
The battery is glued to the inner wall of the case via double-sided tape, and the motherboard can be placed directly inside due to the two FPC cable supports.
3.4 Appearance color
After designing the casing, use 3D printing. Then use spray paint to change the color of the casing.The design drawing and physical picture of the casing are shown in Figures 14 to 16.
Figure14 Casing design drawing
Figure15physical picture
Figure16 physical picture
4.Software part introduction
After the hardware circuit design and welding are completed, you can start writing code. For this project, Espressif's official ESP-IDF 5.0 is used.Implemented functions:
- Weather Forecast
- Information of bilibili
- Taoist almanac
- clocks
- Language switching
- Wifi search
The code part will not be fully introduced. If needed, you can go to the LCSC open source hardware platform to search for this project (gsm-weather-s3). In the project description, there is complete annotated code that you can read on your own.
4.1 Software shutdown
The shutdown code is in the “bsp_power.c” file. The shutdown code is shown in Figure 17.The shutdown logic is as follows: when the device is powered on, it detects whether the key is pressed. When pressed, it starts timing. When the timing reaches 2 seconds, it is considered that the user wants to shut down.
The program calls the window to prompt "Release to shut down" (line 71). Then it detects whether the key is released. After being released, it calls the function bsp_power_off(). This function pulls down the power-on pin POWER_IO (refer to 2.2.2 power on/off circuit). It turns off the output of the 3.3V voltage regulator chip to power off the entire system.When the program was downloaded to the chip, a problem occurred. When the code execution reached line 79, the device did not shut down immediately but waited for a while before shutting down.
Using an oscilloscope to check, POWER_IO was correctly pulled down, ruling out software issues. After troubleshooting, it was found to be a circuit problem at Q1 (Figure 6). After closing the control pin of Q1, the ESP32 module did not shut down when there was still residual power. It could only shut down after waiting for the discharge to end. Later, two lines of code were added to solve this problem.
As shown in the red rectangle in Figure 18, line 78 is to turn off the backlight, and line 79 is to perform a Wi-Fi connection operation once to accelerate the consumption of the residual power of the ESP32 module.
Figure17
Figure18
4.2 Interface interaction animation effects
The interaction animation effect is implemented using the lvgl anim function. The anim function specifies the change style when a variable completes the change within the set time as shown in Figure 19.The function lv_anim_path_set_cb is used to specify the change style. There are a total of seven styles. In this way, when a variable changes, it can achieve non-linear movement to present a more vivid effect.
Figure19
5.Open Source Information
1.Hardware open source address:https://oshwhub.com/yeshengchengxuyuan/b4b67ab1e8234aeebea054b4eda6f549
2.Software open source address:https://gitee.com/gsm-wheather-project
3.Video viewing address:https://www.bilibili.com/video/BV1VU4y1v7VD?vd_source=2847f5d974d73d579ce40eb1213b09ff
4.Screen purchase link:https://item.taobao.com/item.htm?spm=a1z09.2.0.0.12222e8dxpsZO3&id=662619384744&_u=kud5m325157
5.Shell 3D printing file:https://gitee.com/gsm-wheather-project/gsm-weather-s3-comprehensive-information/tree/master/3D%E6%89%93%E5%8D%B0
6.The esp32s3 module needs to use ESP32-S3-WROOM-1-N16R8.
Purchase link:https://item.szlcsc.com/3198300.html
6.Else
6.1、About copyright
You can freely use and copy all the materials. If it is used for sales and profit-making, please contact me in advance. Otherwise, it will be regarded as infringement.
6.2 Physical picture and renderings of the work
For more pictures, click:https://gitee.com/gsm-wheather-project/gsm-weather-s3-comprehensive-information/tree/master/%E5%A4%96%E8%A7%82
Designed by 野生程序员 (from OSHWHub)
Link:https://oshwhub.com/yeshengchengxuyuan/b4b67ab1e8234aeebea054b4eda6f549
Comment