- Home >> News >> Blog articles >> Internet of things
Bluetooth wireless headset control board development
Bluetooth works in the license-free frequency band of 2.4GHz. It uses frequency hopping spread spectrum technology to support the transmission of voice and data. Its transmission distance is 10-100m, which is a short-distance wireless communication technical specification. The Bluetooth specification provides a method for devices to transmit data and voice at the same time, using an asynchronous connectionless (ACL) channel to transmit data, and using a synchronous directional connection (SCO) channel to transmit voice, and also allows up to 3 duplex voice (SCO) Channels are active at the same time. Bluetooth uses circuit-switched technology to process voice. Circuit-switched channels (SCO) can regularly provide reserved bandwidth channels. When the link is first established, the master devices have allocated the fixed time slots they occupy. Different packet types (high-quality voice HV1, HV2, HV3 or data voice DV) are used on the SCO link. They occupy different bandwidths and provide different quality voices. The application that initiates the connection selects an HV packet type to configure the voice link, which is transmitted in periodically reserved time slots, providing symmetric transmission at 64kbps. Different types of packets need to reserve time slots at different intervals, but they are all single-slot packets without CRC. Bluetooth supports three audio coding schemes on the air interface: continuously variable slope delta modulation (CVSD), logarithmic pulse code modulation (A-PCM) using A-law, and logarithmic pulse code modulation (u-PCM) using u-law. PCM). CVSD is a differential waveform quantization technique using a two-stage adaptive quantizer, while PCM uses a non-uniform quantization, and CVSD is more reliable than PCM in the presence of bit errors. But PCM is simple, cheap, and has been used in a large number of devices.
Compared with other wireless communication technologies, Bluetooth has outstanding performance in voice transmission. In addition, Bluetooth also has the advantages of automatic access to mobile networks, strong anti-interference, high cost performance, small size and low power consumption. Based on the above factors, Bluetooth technology is the preferred solution for wireless headsets. At present, many manufacturers have launched mobile phones with built-in Bluetooth functions, and Bluetooth headsets have also emerged as the times require.
1. Overall Solution of Bluetooth Wireless Headphone System
(1) System composition. The basic components of the Bluetooth headset system are voice access devices, namely voice gateway (AG) and Bluetooth headset (HS). The voice gateway acts as a gateway for voice input and output, and a typical voice gateway device is a PC or a mobile phone. The Bluetooth headset extends the voice input and output interface of the voice gateway in a wireless manner, and acts as a voice input and output device at the far end of the voice gateway.
(2) Communication mechanism. According to actual application needs, earphone voice dialing needs to actively initiate a connection, and the voice gateway also needs to actively initiate a connection when a call is received, and the communication activity is bursty, so in the Ad2hoc network composed of earphones and voice gateways, there is no fixed The role of master and slave devices.
Two-way voice data is transmitted between the headset and the voice gateway through the SCO link of Bluetooth, and only one SCO link is supported in this solution. Since the headset is limited by volume and energy consumption, the cumbersome link control is concentrated on the voice gateway side. Both the headset and the voice gateway can act as the master device to initiate an ACL connection, but the SCO link established on the ACL link is created by the voice gateway. Both the headset and the voice gateway can issue commands to terminate the call between the two, but the real release of the SCO link is done by the voice gateway.
Two situations where the earphone and the voice gateway act as the active requesting end are listed. The earphone and the voice gateway can also alternately send requests, between them through the simulated serial port of RFCOMM (radio frequency communication), in a mechanism similar to Modem, use AT commands and Modem control signals to transmit signaling (such as earphone volume control). After the voice gateway creates an ACL connection, it sends AT+RING signaling to notify the headset to generate a ring tone to remind the user that there is a call from the voice gateway. The user sends the keypad signaling AT+CKPD to the voice gateway through the RFCOMM channel to accept the call. The headset and the voice gateway transmit synchronization commands through the SCO link to keep the volume settings of both ends synchronized, thereby realizing remote volume control. When there is no SCO voice connection, the volume cannot be changed, and the voice gateway has a memory for the volume setting of the last call.
2. Wireless bluetooth headset hardware design
2.1 Voice Gateway
The hardware composition of the voice gateway is divided into a host (PC or mobile phone), a Bluetooth module and a CODEC module. The bluetooth module is composed of bluetooth chip BlueCore02, flash memory and antenna. BlueCore02 adopts a single-chip integrated radio frequency and baseband control module solution, which is not only small in size but also has good performance, so it is used as the main control chip of the Bluetooth module, and an external 8Mbit FlashRom is used to store the Bluetooth protocol stack and voice gateway applications. Codec module uses MotorolaMC145483 to connect to PCM interface of BlueCore02. MotorolaMC145483 is a 13-bit linear PCM filter encoder and decoder with 3V low operating voltage. It adopts 2s compensation data format and includes an on-chip accurate reference voltage. It can handle voice digitization and recombination, and is suitable for synchronous and asynchronous applications.
The voice data accessed by the host (if it is a digital signal, skip the codec process) is sent to the CODEC through the audio interface to be encoded into a digital signal, and then transmitted to the Bluetooth module through the PCM interface. The Bluetooth module converts the digital signal into a wireless signal and transmits it to the earphone. According to the same principle, the bluetooth module receives the wireless signal from the headset and converts it into a digital signal and transmits it to the CODEC through the PCM interface to decode it into a voice analog signal (if the host needs to receive digital signals, skip the codec process) and then transmit it to the host .
2.2 bluetooth headset
The hardware of the Bluetooth headset system consists of four parts: the core control module of the headset, the code/decoder (CODEC) module, the sound input and output module and the power management module.
(1) The core control module of the headset is composed of a Bluetooth module, buttons and LEDs. The Bluetooth module is composed of Bluetooth chip BlueCore02, flash memory and antenna, among which FlashRom is used to store Bluetooth protocol stack and headset application program. BlueCore02 has a wealth of PIO lines, these PIO lines support two-way communication and the chip has a pull-up resistor inside, after the key is connected, the pulse signal of the key being pressed can be read directly, and interrupt processing is triggered accordingly. There are 4 buttons Talk, VolumeUp, VolumeDown and On/Off on the headset. Two LED indicators, one blue and one white are on, off and flashing to indicate the state of the headset: Idle (idle), Paring (pairing), ConnectasSlave (connected as a slave device), ConnectasMaster (connected as a master device) and Connected (connection).
(2) The encoding/decoding module uses MotorolaMC145483 to connect to the PCM interface of BlueCore02.
(3) The sound input and output module includes a microphone and a speaker. As a voice input device, the microphone converts the sound wave signal into an analog electrical signal; as a voice output device, the speaker converts the analog electrical signal into a sound wave signal.
(4) The power management module is one of the most important parts in the design of portable mobile devices. Portable mobile devices have low power consumption and long standby time requirements, so the power management module mainly includes two parts: the power monitoring of the codec and the low power mode control of the Bluetooth module. Control the power of the encoder/decoder through the Bluetooth module, turn on the power at a high level, and cut off the power at a low level.
3. Bluetooth wireless headset software design
Both the Bluetooth protocol stack and the application layer protocol are finally encapsulated in the Bluetooth module used in the form of firmware. CSR's development kit BlueLab provides APIs from baseband to RFCOMM layer and SDP layer, so it only needs to develop application layer protocols based on these protocols according to user needs.
The connection control layer is located between the application layer and the RFCOMM layer, and provides a common message interface between the high-level application and the bottom protocol stack.
The messages are divided into 3 categories: pairing related, connection management and connection related messages. From the user's point of view, due to the existence of the connection control layer, complex instructions at the bottom layer are shielded, which simplifies the design of the application layer.
The communication flow steps between the headset and the voice gateway are as follows: ① The initialization process completes the setting of the current state of the device, the initialization of the connection controller, and the service registration of the connection controller. ② Use the Bluetooth device search program to find a suitable device nearby, once the voice gateway application discovers the headset device, it needs to use the SDP service search protocol and perform a service search to find the headset service. ③ After the service search phase is completed, it is the matching process. It is mainly responsible for sending pairing requests, inputting PIN codes and generating link keys. AG and HS are in a many-to-many relationship. The headset and the voice gateway are mapped one-to-one by pairing. At the same time, for security reasons, pairing is used to establish a link key. ④Connect to the audio service. The connection process is mainly to complete the initialization of RFCOMM connection (including parameter negotiation, execution of Modem status command), establishment and release, control AG initialization, establishment and release of SCO connection.
The power supply energy of the earphone is very limited, and the limited power supply must be used to the maximum effect, and the voice gateway has a relatively long-lasting power supply, so the power management overhead is placed on the voice gateway end of the link, which is responsible for the power management of the link, so the voice gateway end The software part designs the asynchronous power management application. The application mainly considers the energy saving status of Bluetooth in 3 aspects:
① pairing. In the pairing state, the headset is in a discoverable state, and the interval between paging and inquiry scanning is lengthened to reduce the power consumption time of the radio receiving device, so as to achieve the purpose of energy saving.
② Establish SCO connection. After the RFCOMM connection is established, set the earphone to be in the connectable state, and the voice gateway initiates the SCO connection, which is the same as the energy-saving principle of pairing, and reduces the earphone scanning time.
③The gap between the two connections of RFCOMM and SCO. Once the RFCOMM connection is established, the headset enters the PARK mode, until the PARK mode needs to be established when the SCO connection needs to be established, both the headset and the voice gateway can terminate the PARK mode, which saves the time and energy consumption of establishing an RFCOMM connection for each call. Once the SCO connection is interrupted, the RFCOMM connection enters the PARK mode again. If the headset end needs to transmit data (such as button information) after the SCO connection is interrupted, it can enter the SNIFF mode, and the headset can send data without exiting the SNIFF mode.
The software design takes into account the dynamic setting of the low power consumption mode of the earphone, that is, the opening and closing of the PARKöSNIFF mode and the dynamic setting of parameters, so that users can trade off between high responsiveness and low power consumption according to their needs, so as to achieve the best use effect .
Summarize
This paper utilizes the Bluetooth module with good performance and the underlying protocol stack provided by CSR to design and implement a wireless headset system that conforms to the Bluetooth headset profile and has excellent performance. If the part of the voice gateway in this solution is connected to the audio interface of the mobile phone that does not have the Bluetooth function, the Bluetooth function of the ordinary mobile phone can be realized conveniently. At the same time, this solution can be further promoted as a reference solution for applications such as car kit (CarKit). This program has been applied to many fields such as information home appliances and automotive electronics.
The above is the development example of bluetooth wireless headset introduced by Shenzhen Zuchuang Microelectronics Co., Ltd. for you. If you have wireless Bluetooth headset solution development needs, you can trust us. We represent a variety of single-chip microcomputers, voice chips, dual-mode Bluetooth ICs, and wifi chips. Brands include Songhan MCU, Yingguang MCU, Jerry Bluetooth, Ankai Bluetooth, Allwinner, and Realtek. Our technical services include: PCB design, microcontroller development, Bluetooth solutions, software and hardware custom development, APP development, small program development, WeChat official account development, etc. It can also undertake the design of intelligent electronic products, the development of living appliances, the research and development of beauty equipment, the application of Internet of things platform, the smart home control system, the development of TWS earphones, Bluetooth earphone speakers, the development of children's educational toys, the design of electronic education products, etc.
Proposal recommendation
- TOP