Multifunctional Bluetooth sound equipment based on stm32f103c8t6 design
By designing a multi-function Bluetooth speaker based on the stm32f103c8t6 microcontroller, it integrates local music playback, clock, alarm clock, voice control and menu interface functions, solving the problems of limited functions of existing Bluetooth speakers and single user interaction methods, achieving higher user experience and versatility.
Patent Information
- Application Number
- CN202411793852.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-09
- Publication Date
- 2025-03-28
AI Technical Summary
The existing Bluetooth audio functions are limited, and it is impossible to play music independently without mobile phones or computer devices. The user interaction method is single, and lacks intelligence and versatility.
Design a multi-function Bluetooth speaker based on stm32f103c8t6 microcontroller, integrating local music playback, clock, alarm clock, voice control and menu interface functions, and realize user interaction and multi-functional operation through OLED display and voice control module.
It realizes independent music playback of Bluetooth audio in wireless devices, enhances the convenience and versatility of user interaction, meets the diverse needs of users, and supports subsequent function expansion through reserved interfaces.
Smart Images

Figure CN119729267A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of electronic information science and technology. The present invention relates to a Bluetooth speaker for daily life, which is designed with an STM32F103C8T6 single-chip microcomputer as the core. The speaker is suitable for various scenes such as home, office, and outdoor. The speaker can be used as a music player, alarm clock, clock, and other devices to provide users with convenient music entertainment and daily life services. Background Art
[0002] Bluetooth speakers are audio equipment that use Bluetooth communication instead of traditional speakers connected by wires. This not only increases the transmission distance of the speakers but also avoids the drawbacks of wired transmission. Through Bluetooth technology and mobile phones, notebooks, tablets, computers and other Bluetooth-enabled devices, wireless connections can be made through Bluetooth to achieve the purpose of fast transmission and wireless transmission. Bluetooth speakers are small and convenient, and as the most commonly used audio external speaker device in life, with the development of technology, the appearance and types of Bluetooth speakers are becoming more and more diverse, and their functions are becoming more and more powerful. As an audio signal external speaker device, Bluetooth speakers have evolved from mono to dual-channel, multi-channel and audio playback systems. There are many types of Bluetooth speakers with various functions, but they can be roughly divided into three types according to their functions.
[0003] First of all, the most common Bluetooth speakers only have the functions of buttons and speakers and are only used as audio external devices to replace ordinary wired speakers. After development, some Bluetooth speakers have the function of reading and playing music files from TF memory cards, and some Bluetooth speakers can also play radio.
[0004] The second is the smart Bluetooth speaker, which expands the basic functions of traditional Bluetooth speakers and is also convenient for meeting market demand and solving the problem of limited functions and small application range of Bluetooth speakers. The music played can be displayed by adding a display screen, adding another window for human-computer interaction, and the time can be displayed on the display screen. The added control chip can add an alarm clock function, and the temperature and humidity sensor is added to receive temperature and humidity information and display it on the display screen.
[0005] Moreover, some powerful Bluetooth speakers have simple human-computer interaction functions to realize the intelligence of Bluetooth speakers. Due to the iteration of technology, smart Bluetooth speakers have also been updated on the display screen, from traditional LED display screens to touch-screen LCD screens and mirror display screens. Moreover, compared with traditional Bluetooth speakers, some smart Bluetooth speakers have real-time schedule reminder functions, light and temperature and humidity sensing devices. Finally, there is a smart Bluetooth speaker with multiple patented technologies, which is not just a functional extension. With the development of the times, smart homes have begun to enter the public's field of vision, and Internet of Things technology has become popular. Smart homes are not only controlled by people themselves, but also can respond to corresponding functions through real-time data sent back by sensors, and handle dangerous situations through controllers, even alarms, rather than manual control. In the smart home scene, it is necessary to plan a suitable solution through people's real-time data, and smart Bluetooth speakers that can customize corresponding solutions based on real-time data are undoubtedly the best "smart butlers". It can realize human-computer interaction, store artificial intelligence in Bluetooth speakers, and use Bluetooth speakers as control terminals. Now it is too expensive to buy smart speakers. Summary of the invention
[0006] The overall development process of the multifunctional Bluetooth speaker based on STM32F103C8T6. From the overall architecture design of the system, the selection of devices and the introduction of STM32F103C8T6, to the design of each module of the hardware circuit. Bluetooth speakers use Bluetooth transmission instead of the wired data transmission of ordinary speakers to solve the length limitation of the data transmission line of ordinary speakers. This paper adds the function of a music player on the basis of Bluetooth speakers, so that the Bluetooth speaker can play music independently without mobile phones, computers and other devices, and bring a moment of tranquility during leisure time. In the process of realizing the music player function, the voice control function is added so that users can directly control the music playback by voice during self-study. Bluetooth speakers are electronic devices frequently used by many college students and ordinary families, as external speakers for laptops, tablets, mobile phones, the best partner for square dancing, speakers for home TVs and many other scenarios. Its appearance and function need to meet the basic aesthetics of most people. At the same time, electronic products such as desk lamps, alarm clocks, and power banks are commonly used devices in daily life. The multifunctional Bluetooth speaker designed in this article introduces local music playback, clock, alarm clock, voice control and other functional extensions on the basis of realizing the functions of traditional Bluetooth speakers, realizing the multifunctional and diversified design of traditional Bluetooth speakers. In order to enrich the functions of the Bluetooth speaker, a clock function was added during the design process, so that the time can be seen on the OLED display screen during the idle time period when the Bluetooth speaker is not playing music. However, in order to enrich the use of OLED in idle time, the function of displaying English words was added, so that users can also learn words during their leisure time. At the same time, in order to make full use of the function of the clock, the present invention has added the function of an alarm clock, and users can realize the alarm function of the Bluetooth speaker by setting the time. The framework of the OLED display screen is built to integrate the functions of the above-mentioned Bluetooth speakers, so that users can use the Bluetooth speaker more effectively, visualize the program functions, and enhance the convenience and versatility of the Bluetooth speaker. The design of this multifunctional Bluetooth speaker is developed using KeiluVision5 using C language. During the development process, the corresponding functions of the stm32f103c8t6 microcontroller are used to realize the functions of the Bluetooth speaker. The key status is judged by interrupt EXIT, and the clock alarm function is realized through RTC and BKP. The serial port communication is configured to control the data received from the MP3 module and the data returned by the LD3320 voice control module. Each function is encapsulated through the program design menu bar. STLINK is used in the KeiluVision5 software to test and burn the corresponding code. During the test, the MP3 module and LD3320 voice control module are debugged through the serial port debugging assistant software, and different data packets are tested to control the MP3 module through the SUART serial port, and the serial port return value of the LD3320 voice control module when receiving different voice commands is tested.
[0007] This Bluetooth speaker has the following functions: • Bluetooth music playback: connect to your phone or other devices via Bluetooth to play music wirelessly; • Local music playback: read music files from the SD card for playback without connecting to a mobile phone; • Voice control: recognize user voice commands to control music playback, set alarms, enter different control interfaces, etc.; • Clock display: displays the current time and provides clock functions; • Alarm function: set an alarm to remind users at regular intervals; • Menu interface: The menu interface is displayed through the OLED display screen to facilitate user operation.
[0008] Technical advantages The present invention has the following technical advantages: • Rich in functions: It integrates multiple functions such as Bluetooth music playback, local music playback, voice control, clock display, alarm function, etc. to meet the diverse needs of users.
[0009] • Easy operation: Through voice control, button operation and menu interface, it is convenient for users to operate and improve the user experience.
[0010] • Intuitive display: The OLED display clearly displays time, song information, menu interface, etc., making it easy for users to view.
[0011] Strong scalability: reserved interfaces are provided to facilitate subsequent functional expansion, such as adding temperature and humidity sensors, light sensors, etc., to achieve more functions. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] · Figure 1 :Menu design diagram · Figure 2 :Display interface design block diagram · Figure 3 :Alarm clock design block diagram · Figure 4 :Clock design block diagram · Figure 5 :Music playback design block diagram (main) · Figure 6 :Music playback design block diagram (sub) · Figure 7 : Hardware Schematic DETAILED DESCRIPTION
[0013] like Figure 1The menu structure designed in this paper is shown in the figure. The entire user interface is set as the first-level menu, the second-level menu, and the third-level menu, and these interfaces are named with different numbers. The display interface function, its own number and its upper level, lower level, and confirmation corresponding numbers are encapsulated in a structure and named with this structure, for example: {1,4,3,2,0,Function_Interface1}. When the button is pressed, these numbers are changed to enter different display interfaces. The multi-level menu designed based on this user interface is highly extensible, and other function menus can be added according to actual needs. If the demand for subsequent products increases, the cost of development and maintenance is very low.
[0014] like Figure 2 As shown, this process is the interface design idea of the present invention. A single interface display will display all the required displays on the OLED display screen. When a button is pressed, the corresponding function is executed, and a return value is set in these functions. If the changes of these functions need to be displayed on the OLED display screen, the changes of the OLED screen display are performed through these corresponding function return values. If multiple display interfaces are required, this design process is used as the basis for the design and the menu bar structure of Figure 1 is combined to realize the construction of the menu bar.
[0015] like Figure 3As shown in the figure, this is the design control flow of the clock. The Key_number in the figure is the representative value of the key, indicating that the key is pressed. When the time needs to be changed, the up and down keys will trigger an interrupt and assign values to the global variables. STM32 recognizes the value of the global variable and adjusts the corresponding value of the global variable array in the future, and displays the corresponding value of the array. The array value is assigned to the corresponding function in the time.h library and used to change the timestamp of the RTC of STM32. If the value needs to be displayed through OLED, the timestamp value of STM32 will be calculated by the function in the time.h library and transmitted to the OLED display. The clock time display is based on the Uinx timestamp. In the electronic clock designed in this article, in order to keep the various parts synchronized, the electronic clock shares a crystal oscillator, which is used to provide a basic clock signal. When the time, year, month, and day need to be displayed, the Uinx timestamp is converted into the corresponding display time through the Time.h function. Supply 3.3V voltage to VBAT in stm32, turn on PWR and BPK clocks under RCC_APB1 through stm32 function library, connect RTC to crystal oscillator and divide the frequency of crystal oscillator, divide 1s time and assign initial value to RTC timestamp. Convert required time and date into corresponding timestamp through Time.h function library, and read out the timestamp data stored in BKP of RTC and convert it into corresponding date and time when displaying time, and then display it on OLED display through OLED display function.
[0016] As shown in Figure 4, this is the design process of the alarm clock. The value of Key_number above indicates that the button is pressed, and the corresponding operation is performed in the process when the button is pressed, changing the value in the Alarm_Clock_Time[] array, and Number indicates the position where the value is to be changed. If the alarm clock function is to be realized, the ALR part in the RTC of the stm32 microcontroller is also needed to be used. The function of the alarm clock function will be given and the corresponding hours, minutes, and seconds will be converted into timestamp values, and the timestamp value will be assigned to ALR and stored in ALR. When CNT and ALR in RTC are the same, an interrupt is triggered, and after the interrupt is triggered, the corresponding operation is performed to play the alarm.
[0017] like Figure 5 , 6As shown in the figure, when the key is pressed, the interrupt of stm32 is triggered to assign the flag bit (1,2,3,4). When the corresponding value is recognized, the corresponding operation is performed. When the key flag bit is recognized as 2, the stm32 microcontroller transmits the data packet of the next song to the MP3 module. Similarly, when the confirmation key and the up key are recognized, the corresponding data packet is sent to the MP3 module to control the previous song, next song, pause and play of the music. When it is necessary to play the corresponding song, configure the play mode and adjust the volume, three keys are not enough. To solve this problem, a similar interface is redefined and a special method is designed to enter this interface. Long press the confirmation key to jump into this special interface. The program design is shown in the flowchart of Figure 6. When it is necessary to adjust the volume, change the play mode and specify the song to play, it jumps into another interface and takes the inverted color to display the current control position. Use the up and down keys to adjust the value and play mode. The confirm key controls the table to confirm and jump to the next value. Use the up and down keys to control and adjust. When adjusting different play modes, different icons will be displayed, including single loop, all loops and random play. Press the up and down keys to switch different icons and enter different play modes.
[0018] The contents not described in detail in the specification of the present invention belong to the prior art known to the professional and technical personnel in this field.
Claims
1. A multifunctional Bluetooth speaker based on stm32f103c8t6, including: STM32F103C8T6 microcontroller; Bluetooth audio player module; MP3 music player module; 0.96-inch OLED display; LD3320 voice control module; menu bar design program; music playback control program.
2. The multifunctional Bluetooth speaker based on STM32 according to claim 1, characterized in that: The STM32F103C8T6 microcontroller is used as the control core. It uses SPI, IC, and USART serial ports for data transmission. It processes the data input by the slave through the serial communication protocol and then transmits it to other slaves through the GPIO port or serial communication to realize different functions.
3. The multifunctional Bluetooth speaker based on STM32 according to claim 1, characterized in that: The LD3320 voice control module is used to identify user voice commands. The LD3320 module matches the voice database inside the module with the voice signal recognized by the built-in microphone. If the required command and the voice signal recognized by the built-in microphone are the same, different hexadecimal numbers are sent through the USART serial port communication, and the stm32f103c8t6 performs the corresponding command operation by identifying the hexadecimal number sent by the USART serial port. The microcontroller controls the MP3 module to play music, turn on or off the Bluetooth function, and enter different display interfaces through voice according to the instructions.
4. The multifunctional Bluetooth speaker based on STM32 according to claim 1, characterized in that: The Bluetooth audio playback module is used to connect to a mobile phone, realize the connection of a mobile phone or other Bluetooth-enabled device and realize the playback of music or audio.
5. The multifunctional Bluetooth speaker based on STM32 according to claim 1, characterized in that: The MP3 music player module is used to read music files in the SD card and play music through the speaker. It can communicate with the stm32f103c8t6 microcontroller through serial communication, identify the signal transmitted from the microcontroller and perform the next song, previous song, play mode, etc.
6. The multifunctional Bluetooth speaker based on STM32 according to claim 1, characterized in that: The 0.96-inch OLED display screen is used to display the Bluetooth speaker's menu interface, playback status, playing tracks, time, alarm switch, Bluetooth switch, voice control function switch, interface display and other information.
7. The multifunctional Bluetooth speaker based on STM32 according to claim 1, characterized in that: The menu bar uses the index method to encapsulate the various functions used. First, the data type of the multi-level menu is defined. The data type of the interface menu function is designed through the structure declared by typedef, the current index number, three buttons, and the currently executed function pointer. The index number represents the interface page number. To enter the interface, you must enter its index number (just like the room number in a hotel, you must know its room number to enter the room). The index number is assigned by pressing the button to achieve the purpose of jumping (the front desk waiter who gives the room number). Finally, the executed function pointer points to the function to be executed (which can be understood as the path to the room).
8. The multifunctional Bluetooth speaker based on STM32 according to claim 1, characterized in that: When designing the music playing program, it plays local music by default. If you want to play music via Bluetooth, you can control the high and low levels of the PA4 pin through the stm32 microcontroller, and then the relay disconnects NC and connects NO through the PA4 level, powering off the MP3 module and powering on the Bluetooth audio receiving module, so as to play the Bluetooth music. In addition, two different control interfaces are designed to control the playback of local music. The main interface controls the previous song, next song, pause / play, and the other sub-interface controls the playback track, volume, and playback mode. From the main interface to the sub-interface, long press the confirmation button to enter and the return button to exit.