Bluetooth is a radio technology that supports short-range communication between devices (generally within 10 m). It can exchange wireless information between a wide range of devices, including mobile phones, PDAs, wireless headsets, laptops, and related peripherals. Bluetooth technology can effectively simplify the communication between mobile communication terminal devices, making data transmission faster and more efficient. Bluetooth uses a decentralized network structure, fast frequency hopping, and short packet technology to support point-to-point and point-to-multipoint communication. It works in the globally used 2.4 GHz ISM (industrial, scientific, and medical) frequency band and uses a time-division duplex transmission scheme to achieve full-duplex transmission with a data rate of 1 Mb/s. Bluetooth technology is essentially a short-range wireless communication standard.
The C8051F020 single-chip microcomputer is selected as the processing and controller of the wireless communication system, and the BC03MM Bluetooth module is selected as the transceiver module of the wireless communication system. The single-chip microcomputer and the Bluetooth terminal device are connected to each other through serial communication. By writing relevant control programs, the keyboard signal is processed and converted by the single-chip microcomputer module and then sent to the Bluetooth module. Related commands are sent to control the corresponding Bluetooth terminal (mobile phone) to play music, make calls, etc. The use of a single-chip microcomputer as the command control and data display processing and controller of the Bluetooth module has the advantages of simple circuit structure, flexible control, low cost, and portability.
1 Overall solution design
The main task of the scheme is to complete the communication and control with the Bluetooth module through the C8051F020 single-chip microcomputer UART0, realize the interconnection between the Bluetooth mobile phone or PC computer and the BC03 Bluetooth module, and complete the hands-free (Hand Free Profile, HFP) and music playback (Advanced Audio Distribution Profile, A2DP) functions. The system consists of a keyboard, a single-chip microcomputer, an LCD display, and a BC03MM Bluetooth module with a solidified cable communication protocol (RFCOMM). The keyboard is used to input control signals, the LCD is used to display communication data to facilitate system operation, the single-chip microcomputer is used to control the operation of the system, receive the command signal from the keyboard and transmit it to the Bluetooth module, and the BC03 Bluetooth module is used to connect to an external Bluetooth terminal (mobile phone or PC computer), and control the connected terminal by sending commands to realize system functions.
2 Hardware Circuit Design
2.1 Overall hardware design
The whole system uses a C8051F020 microcontroller and a CSRBC03 Bluetooth module to complete the system design. Among them, UART0 is configured on P0.0 (TXD) and P0.1 (RXD) of C8051F020, and is connected to the serial port of the BC03 module through a 1 kΩ resistor in series. Since both C8051F020 and BC03 Bluetooth modules are 3.3 V systems, there is no need to add additional level conversion serial communication circuits, which simplifies the system design. Port P3 of C8051F020 controls the command and data display of LCD1602, and port P2 completes the input of keyboard information. For the BC03MM Bluetooth module, the voice signal input is completed through the electret microphone, and the audio signal output of the Bluetooth module is driven by TDA2030A to drive the load. The overall circuit design block diagram of the system is shown in Figure 1.
2.2 Bluetooth module wiring design
The wiring of the BC03MM Bluetooth module mainly involves three parts:
(1) Voice signal input: Voice signal input is completed by an electret microphone and a filter processing circuit, and is set to a single-ended input mode.
(2) SPK stereo output of 16-bit stereo audio decoding part. For the two-way stereo output of the Bluetooth module, TI's stereo audio power amplifier chip TPA6112 is selected for pre-amplification, and the gain can be set by yourself. [page]
(3) Connection with MCU.
2.3 MCU control and communication circuit
The MCU control and communication circuit includes three parts: serial data communication circuit, control signal input and communication data display.
C8051F020 has built-in enhanced serial port UART0 and digital cross switch. By configuring the cross switch control registers XBR0 and XBR2, the TXD and RXD digital signals of UART0 are configured on the port I/O pins. In this article, UART0 is configured on P0.0 (TXD) and P0.1 (RXD) of C8051F020, and connected to the UART (RX and TX) of the BC03MM module through a series 1 kΩ resistor to complete the reception and transmission of serial data.
The control signal input part is mainly completed by the C8051F020 I/O port P2 controlling the matrix 4×5 keyboard. The use of a matrix keyboard has the characteristics of occupying less I/O resources and simple programming. The system needs to implement HFP and A2DP functions, and the key functions are shown in Figure 2. SHIFT is a function switching key that switches between HFP and A2DP. Keys 0 to 3 are multi-function keys. When the SHIFT key is not pressed, it means the number keys 0 to 3 for dialing a phone or the functions of answering a call, hanging up a call, rejecting a call, and redialing; when the SHIFT key is pressed, it indicates the functions of music pause/start, connecting Bluetooth music, next song, and previous song. Keys D, E, F, and G are reserved for system function expansion keys, and have no effect when pressed.
The display part uses port P3 of C8051F020 as an 8-bit data line to communicate with LCD1602, mainly completing the display of communication data and status information.
The audio power amplifier TDA2030A from CONTEK is used to form an OCL connection, with a maximum output power of 14 W. The audio signals SPKR+ and SPKL+ output by the Bluetooth module enter two TDA2030A chips for power amplification to drive the speaker with RL=4 Ω.
The normal operation of the system requires ±12 V, +5 V and +3.3 V voltage power supply. This paper converts the mains 220 V/50 Hz into a voltage-down converter through a 2×12 V/40 W transformer, and generates ±12 V after bridge rectification and filtering, which directly supplies power to TDA2030A. The rectified and filtered voltage passes through the LM7805 voltage regulator chip, and the output is a stable +5 V to power LCD1602. The LM7805 output voltage is then passed through the ASM1117-3.3V to power the microcontroller system and Bluetooth module, completing the system power supply.
3 Software Design
The system software mainly includes three parts: the construction of Bluetooth protocol stack, Bluetooth communication software design and microcontroller control software design.
The main purpose of software design is to provide an efficient command to avoid the changing standards and complex Bluetooth functions between different Bluetooth devices. The software interface is a serial interface, which is used for communication between two processors with a transmission rate of 19 200 b/s, 8,N,1.
Bluetooth technology is an open system (OSI), and its main purpose is to enable various devices that comply with the specification to communicate with each other, which requires that the local device and the remote device use the same protocol. Of course, different applications may use different protocol stacks, but they must all use the physical layer and data link layer in the Bluetooth technology protocol specification. The complete Bluetooth protocol stack mainly involves baseband protocol (Basebaria), link manager protocol (Link Manager Protocol, LMP), logical link control and adaptation protocol (Logmal Link Control and Adaptation Protocol, L2CAP), service discovery protocol (Service Discovery Protocol, SDP), cable replacement protocol (RFCOMM), telephone control protocol (Telephony Control Pro-tocols, TCS), point-to-point protocol (PPP), object exchange protocol (OBEX), wireless application protocol (WAP), Bluetooth audio transmission model protocol (A2DP) and other protocols. This article mainly involves baseband protocol (Baseband), LMP, L2CAP, SDP, RFCOMM, TCS, PPP, A2DP and other protocols, as shown in Figure 3. [page]
Since the system uses the CSR BC03 Bluetooth module that solidifies the cable communication protocol (RFCOMM) and other underlying protocol stacks, the module only gives simple interface instructions for the communication part with the microcontroller. When the module receives the status inquiry command (blank +?) sent by the C8051F020 control unit, the module will transmit the parameter characters and the end character "0x0D0x0A" to the host via the TX pin. When the C8051F020 control unit sets the command to the BC03 module via TXD, the module will be commanded to perform the corresponding action at the same time. The command has several characters, the first one is "space" (ASCII=20H), and the rest are command characters. At the same time, the BC03 module will have a feedback character sent to the control unit through the BC03MMUART within 100 ms, indicating the current execution of the system and the current status of the Bluetooth system.
The C8051F020 microcontroller control software mainly completes the following functions: BC03 Bluetooth module command control, LCD1602 system status display command control and key input command decoding.
The control flow chart of the BC03MM Bluetooth module system based on the C8051F020 microcontroller is shown in Figure 4.
4 Conclusion
The function of the system built based on the C8051F020 microcontroller and the BC03MM Bluetooth module is verified. The system can realize the interconnection between a Bluetooth mobile phone or PC device and the BC03 Bluetooth module, and complete the HFP and A2DP functions of the Bluetooth module. The maximum audio output power can reach Po=14 W (RL=4 Ω), and can directly drive a 4 Ω or 8 Ω speaker load. In addition, the system has a friendly human-machine interface, simple operation, low price, good portability, and is convenient for commercial use.
Previous article:Design of wireless display system based on GSM network
Next article:Design of three-phase inverter power supply based on SA8282
Recommended ReadingLatest update time:2024-11-16 14:45
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- RT-Thread Reading Notes] RT-Thread Study Chapter 5-6 Reading Notes
- Basic knowledge of MCU
- Writing Verilog Code for AD Sampling FPGA Program
- capacitance
- The basic principles and methods of SRIO error handling
- FPGA button problem
- How to effectively choose a lithium battery protection board
- About continue in for loop
- ARM programming mode and some conceptual understanding
- Detailed explanation and selection of pull-up resistors and pull-down resistors for microcontrollers