check in
Completed

gsm-fm desktop multi-function radio

PROgsm-fm desktop multi-function radio

tag

13
0
0
0
Mode:Full

License

GPL 3.0

Creation time:2025-01-16 07:31:32Update time:2025-01-20 02:40:12

Description

1. Project introduction

In his spare time, he makes a desktop radio. This project uses ESP32-S3 as the main control, the FM chip uses RDA5807, the integrated CS4344 I2S audio chip can play audio, and the integrated INA199 can collect the working current of the whole machine. The interaction with a rotary encoder has now been completed:

1. Network clock.

2. FM broadcasting.

3. Weather forecast.

4. Data statistics of station B.

5. Old Yellow Calendar.

6. Backlight adjustment.

7. Shut down regularly.

8. Temperature and humidity display. (Updated on May 21, 2023)

Hardware open source address:https://oshwhub.com/yeshengchengxuyuan/gsm-fm-desktop-multi-function-radio

Software open source address:https://gitee.com/gsm-fm

Video viewing address:https://www.bilibili.com/video/BV1X24y1J779/?share_source=copy_web&vd_source=d4639a3234ac108fc95036ba5d81874d

WeChat: GM8988
QQ:1063503277
Fork group: 607741525

Note:

1. Part of the technology of the work comes from the Internet, because the original author cannot be found, the source can not be named, if you find any infringement, please contact me for modification.

2. The work belongs to the author to develop, design, post, etc., if you find that there are mistakes in the work, we hope to give advice.

2. Hardware introduction

2.1 ESP32-S3 circuit

The ESP32-S3 main control circuit is shown in Figure 1, and the chip is selected with 8MRAM inside + 16M FLAM externally.

主控

Figure 1 Master controller

2.2 Automatic power switching circuit

The automatic power switching circuit is shown in Figure 2, Q1 is a PMOS tube, BAT+ is the battery, 5V is the charger input, when the charger is not connected, Q1 is on, BAT+ flows through Q1 to supply power to VCC, and when the charger intervenes, Q1 flows through D1 to supply power to VCC up to 5V.

Figure 2 Automatic power switching circuit

2.3 Software power on and off circuit

The software power on and off circuit is shown in Figure 3, U1 is a voltage regulator chip with an output of 3.3V, the chip has an enable function, that is, the third (CE) pin, to the pin input high level to open the output input low level to close the input, VCC_KEY is a key pin, one end is connected to the power supply (VCC), and the other end is connected to the microcontroller pin (KEY_POWER) and U1 enable pin circuit.

Button boot process: (when not plugged in) when the key is pressed VCC flows through the VCC_KEY, D4 gives the CE pin a high level to enable 3.3V output, at this time the whole system power up the single-chip microcomputer starts to run, the program first detects the KEY_POWER pin level, if the voltage is high, it means that the key is turned on to control POWER_IO the pin output high level of the pin to lock the CE pin level, then after releasing the hand, it will continue to enable the U1 output because the POWER_IO is high.

Charging and booting process: (when the button is not pressed) plug in the charger, at this time, the 5V power is obtained through D3 to the CE pin high level to enable the 3.3V output microcontroller to run, the program begins to detect the KEY_POWER level due to the internal configuration of the pull-down input, so it is identified as a low level, and the program judges that the case is running when pressed, that is, charging and booting.

Shutdown process: After entering the shutdown function to confirm the shutdown, the system will pull down the output of POWER_IO disability 3.3.

Figure 3: Switching on and off and stabilizing voltage

2.4 USB to serial port circuit + automatic programming circuit

ESP32-S3 supports serial port download, because the computer does not have TTL serial port interface, so it needs a USB to serial port chip, as shown in Figure 4, U7 model is CH340C, the chip supports a usb to serial port ttl, with RTS, DTR control pins, and the internal integrated crystal oscillator greatly simplifies the external circuit.

According to the ESP3S3 data sheet, to enter the serial port download mode, you need to pull down IO0 before powering on, the above describes that CH340C has RTS, DTR pins, which can be added to the switch control circuit to achieve automatic reset and pull down IO0, as shown in Figure 5, the Q6 chip model is UMH3N, the chip has two transistors inside and integrated bias voltage, as shown in the circuit, the RTS and DTR pins of CH340C can be used to automatically download the program.

Figure 4 USB-to-serial circuit

Figure 5 Automatic download circuit

 

2.5 PCB Design

The whole project uses a double-layer PCB, as shown in Figure 6 and Figure 7.

Figure 6 The back of the PCB

Figure 7 Front side of the PCB

3. Shell design

The enclosure was designed and made using Autodesk Fusion 360.

Figure 8 Enclosure design

 

3.1 Screen Installation

The screen is attached to the PCB by double-sided tape.

 

3.2 PCB Mounting

The PCB is stuck in a slot in the inner wall of the housing and is secured by a screw.

Figure 9 PCB mounting

3.3 Antenna Installation

 The antenna is inserted inside through the housing slots, and the wires are secured to the housing using screws.

Figure 10 Antenna installation

3.4 Speaker Installation

The speaker is stuck directly in the housing slot.

 

Figure 11 Speaker installation

3.5 Battery Installation

The battery is placed in an empty space inside.

Figure 12 Battery installation

3.6 Exterior Color

Once the enclosure is designed, it is 3D printed and then the enclosure color is changed using self-spraying paint.

Figure 13 Exterior color matching

4. The introduction of the software part

Once the hardware circuit has been designed and soldered, you can start writing code, and this project uses Espressif's official ESP-IDF5.0.

The code part is not all introduced, friends who need it can go to the Lichuang open source hardware platform to search for this project (gsm-fm), there is a complete annotated code in the project description, you can read it yourself, the following is a brief introduction to the two:

4.1 Boot animation

The LVGL GIF library used in the boot animation,In the development process, the VS simulator can be played normally,But when transplanted to ESP32 to play the boot animation,I thought it was because the animation was too long,Cut the animation into two parts or not,After a variety of bug fixes,Finally, the problem is solved by preloading to PSRAM,The specific implementation code is as follows:

1. Define two null pointers

char *p_gif1 = NULL;

char *p_gif2 = NULL;

2. Load the GIF

load_gif(&p_gif1,"/spiffs/power_on_gif_01.gif");

load_gif(&p_gif2,"/spiffs/power_on_gif_02.gif");

3. Loading process

bool load_gif(char **p,char *file)

{

    bool r_dat = false;

    long size=0,r_size=0;

    main_debug("加载文件:%s",file);

    FILE* f = fopen(file, "r");

    if (f != NULL)

    {

        main_debug("打开成功");

        size = get_file_size(f);

        main_debug("文件大小:%ld",size);

        *p = malloc(size);

        if(*p != NULL)

        {

            main_debug("内存申请成功");

            r_size = fread(*p, 1, size, f);

            if(r_size == size)

            {

                main_debug("读取成功");

            }

            r_dat = true;

        }else

        {

            main_debug("内存申请失败");

        }

        fclose(f);

    }

    return r_dat;

}

4. Use

lv_gif_create_from_data(lvgl_power_on_data.cont_main, p_gif1);

lv_gif_create_from_data(lvgl_power_on_data.cont_main, p_gif2);

5. Release the memory after use

free(p_gif1);

free(p_gif2);

4.2 Modify the configuration file

整个系统通过spiffs_image/system/config.json配置文件配置参数,文件内容如下:

{

    "wifi":[

        {

            "name":"name",       //wifi名

            "password":"pin",  //wifi密码

            "auto connect":"true"      //自动连接(暂未使用)

        }

    ],

    "system set":[

        {

            "wifi switch":"on",            //wifi开关 (暂未使用)

            "backlight":50,                 //背光强度

            "language":0,                   //语言

            "bilibili id":"430380301"  //b站数据ID

        }

    ],

    "radio data":[

        {

            "background":1,       //后台播放开关

            "p1":"89.1",              //存台1

            "p2":"93.1",              //存台2

            "p3":"95.7",              //存台3

            "p4":"102.8",             //存台4

            "p5":"104.8"              //存台5

        }

    ],

    "clock data":[

        {

            "type":1,                 //时钟主类型(模拟/数字)

            "style":1                 //时钟样式

        }

    ]

}

 

Design Drawing

Download File
The preview image was not generated, please save it again in the editor.

Attachments

OrderFile nameDownload times
1
The main components of GSM-FM desktop radio bom.xlsx
161
2
gsm-fm enclosure 3D printing file .rar
139
Add to Album
0
0
Share
Report

Comment

All Comments(1)
Sort by time|Sort by popularity
Followers0|Likes0
Related projects
Empty

Bottom Navigation