Abstract: With STM32F103 as the microprocessor, a low-cost wireless WiFi music player system is designed. The WM-G-MR-08 (wm631) module and the VS1003B audio decoder that receive WiFi data are used to realize MP3 music playback. The client software developed based on Android system adopts mobile phone control, completes the data transmission between the mobile terminal and the control terminal, and realizes the remote control of the music player by the mobile phone. The results show that the system is simple and convenient, low cost, reliable and easy to expand.
This article refers to the address: http://
Keywords: Android; WiFi; VS1003B; STM32; SD card
introduction
At present, the music player on the market has various styles, can realize a very rich function, and the appearance design is more beautiful, and can better meet the needs of users. However, most of the existing music playing systems use a keyboard, a touch tablet and the like to control the music playing system. The control terminal can only perform local control, and can not realize remote control, which makes the control method not convenient and fast. Modern people are increasingly demanding quality of life, requiring the operation of the music playback system to be more simplistic and intelligent.
The design is based on the already mature WiFi wireless network, making full use of the advantages of wide coverage of WiFi coverage, fast transmission speed and strong anti-interference ability. Android has the advantages of open source, encapsulation, and high cost performance. The client software developed based on Android system has strong portability and high versatility. The mobile phone is used as a control terminal for easy operation. The mobile phone controls the music playing system through the wireless network (WiFi), which can realize convenient, fast and intelligent requirements.
1 system design
There are many advantages to using the STM32F103 as a microcontroller. The STM32F series is a medium-capacity enhancement. It is a 32-bit ARM core-based microcontroller with 64 or 128 KB flash memory. It is a very cost-effective product on the market. This design mainly has control module, WiFi wireless module, audio decoding module VS1003B, SD card, its system structure block diagram shown in Figure 1.
Workflow: Click the play button on the smartphone client software, after receiving the command through the WiFi module, STM32F103 reads the MP3 music file in the SD card, and then transfers the read data to the audio decoding chip VS1003B through SPI, and decodes After conversion, it is sent to the earphone to realize the function of playing music; when the pause button is clicked, STM32F103 stops reading the MP3 music file data in the SD card, so that the function of stopping the music can be realized; clicking other buttons can also realize the corresponding function.
The main features of this design are as follows:
1 Based on the open Android system control terminal, use the support component to reuse and replace the application framework. The use of an interactive graphical interface is clear and beautiful, the operation control is simple, and the designed product is very well reflected by the user experience.
2 This design eliminates the dependence of the traditional music playing system on the dedicated control buttons, and can realize the control of the music player playing, pause, etc. through the user's mobile phone, which greatly facilitates the user's operation. The music playing system designed in this way not only has the function of a general music player, but also has the advantage of separating the control end and the hardware part, and realizes the remote control of the music playing system.
2 hardware circuit design
2.1 audio decoding module
The VS1003B is a single-chip MP3/WMA/MIDI audio decoder and ADPCM decoder. It includes a high-performance, proprietary, low-power DSP processor core, VS_DP4, which provides 5 KB of instruction ROM and 0.5 KB of data RAM for user applications. It also features a serial control and data interface, a high quality variable sample rate ADC and stereo DAC, four general purpose I/O ports, a UART, and a ground buffer and headphone amplifier.
The STM32F103 transmits the MP3 audio data stream read from the SD card to the audio decoding module, and the audio decoding module parses and converts the data stream into an analog signal before outputting. The data communication between VS1003B and STM32F103 is performed by the SPI bus method on the J2 pin header. The schematic diagram of the audio decoding module circuit is shown in Figure 2.
2.2 SD card interface module
The SD card is the most versatile data storage card. It has the advantages of low price, large storage capacity, convenient use, versatility and security. Therefore, the memory cards on MP3, MP4, MP5, Pad and digital cameras are SD. card. The bus mode supported by the SD card is SD mode and SPI mode. The SPI mode is adopted in this design. Figure 3 shows the interface circuit of the SD card module (SPI mode on the J10 pin).
2.3 WiFi wireless module
The biggest advantage of WiFi (Wireless Fidelity) is that the transmission speed is high, and the bandwidth can be automatically adjusted, which can effectively ensure the stability and reliability of the network. The WM-G-MR-08 module used in this design not only has WiFi function, but also provides small size and high data rate wireless connection, which can be applied to wireless PDA, DSC, media adapter, micro printer, barcode scanner, VOIP. Telephone, etc. The data storage device is a potential application of the WM-G-MR-08, and the embedded application is mainly focused on the mobile device. In the design, the WM-G-MR-08 module communicates with the main control chip through the SPI pin of the J1 pin header on the development board, and the ANT1 SMACON is the wireless network card. The schematic diagram is shown in Figure 4.
3 embedded software design
The design uses RealView MDK development kit as the software development platform, embedded software is written in C language, and the operating system adopts μC/OS-II. μC/OS-II is written in C language and assembly language. The structure is simple and concise, and it is very readable. At the same time, it has most functions of real-time operating system, and can be widely used in various kinds after appropriate expansion. Application.
After the system is started, the STM32F103 is initialized, then the SD card, the audio decoding module, the WiFi wireless module are initialized, and finally the μC/OS-II system is initialized. When the WiFi command is determined to be a play command, the microcontroller sends some basic information of the SD card to the FAT file system interface for reading, and obtains the capacity of the SD card, the FAT table, and the starting sector where the root directory is located. Through this information, it can be determined whether the SD card stores a music file that the audio decoding module can decode and play. If there is the music file, the controller will read the audio information of the file through the SPI bus mode, and send the audio stream information to the audio decoding module, which is decoded by the VS1003B chip, and then passed through the included high quality The stereo DAC and the headphone driver circuit can realize the music playing. The program flow chart is shown in Figure 5.
4 mobile client software design
Development tools for mobile client software development include Eclipse, JDK, ADT, and Andrid SDK. The development environment is built as follows: First install the JDK, then extract the Eclip se and Android SDK separately, then install the ADT plugin for Eclipse, and finally configure the Android SDK, and finally build the Android development environment.
For the client software, use ImageView+TestView for UI design, select the appropriate image as the background and add ButtonStart, Button Stop, ButtonOff and other function buttons to control the playback, pause and close of the music playback system. After designing the UI interface, respond to user actions by adding a setOnClickListener event to each button. According to the different command buttons, different commands are sent to the slave nodes through the network in the response function to implement the corresponding control functions.
Conclusion
This design is to build WiFi on the ARM7 platform, and the cost advantage is obvious. Adopting the newer control method - smart phone software control + wireless network, not only can make full use of the advantages of fast transmission speed and wide coverage of WiFi, but also the platform based on Android is low in construction cost and convenient to use. At the same time, the mobile phone software adopted in this way has universality, high market application value, easy to promote, and can provide users with high quality, convenient and fast music broadcasting service.
- STM32 microcontroller Chinese official website
- STM32 microcontroller official development tools
- STM32 microcontroller reference design
Professional Subwoofer For Stage,Active Subwoofer With Dsp,Advanced Bluetooth Speaker,Subwoofer Premium Speaker
NINGBO RFUN AUDIO TECHNOLOGY CO.,LTD , https://www.mosensound.com