Voice Communication System Based on IEEE802.1 5.4/ZigBee

Publisher:oplndctkl出Latest update time:2012-04-13 Source: 电子技术 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

ZigBee is a low-speed wireless personal area network (LR-WPAN) technical specification specified by the ZigBee Alliance based on the physical layer (PHY) and media access control layer (MAC) defined by IEEE802.15.4. Its main goal is to build a short-range wireless communication network with simple layout, reliable data transmission, low equipment cost and low energy consumption with a simple and flexible protocol. ZigBee has a flexible working frequency band, and the frequency bands used are 2.4 GHz, 868 MHz and 915 MHz, all of which are unlicensed frequency bands; the transmission rate is 250 kbit·s-1, and the effective transmission distance is 10 to 75 m. By adding a power amplifier at the transmitting end, longer-distance communication can also be achieved. ZigBee technology has a multi-hop transmission (Muhi-hop Relay) mechanism, good network expansion performance, easy deployment, and self-organization and self-repair capabilities. It is widely used in inventory management, product quality control, industrial process control, disaster area monitoring, biological monitoring and supervision, positioning and fire safety. Although voice communication was not the original goal of the ZigBee Alliance, the lack of voice communication in many fields will greatly limit its application. On the other hand, ZigBee has advantages that are difficult to replace with other communication technologies in urgent needs and difficult to deploy environments. If ZigBee networks can be used for voice transmission, it will have great practical value. At the same time, in the application of wireless sensor networks, sound is also a sensor quantity, and the transmission of sampled sound data is the basic requirement of sound sensor applications. Therefore, this paper proposes a research topic on voice communication based on the application environment of IEEE802.15.4/ZigBee, and considering that the theoretical communication rate of ZigBee is 250 kbit·s-1, and the actual rate can also meet the requirements of voice communication. And make full use of the performance characteristics of the MCU selected in this solution, as well as fewer peripheral devices, to achieve good voice communication.

1 Hardware Solution

1.1 Overall architecture of the solution

The overall architecture of the system is as follows: When the MSP430 microcontroller at the remote end of the voice processing function is used as the transmitter, the ADC on the chip completes sampling from the microphone, converts the input voice signal and sends it, while the DAC on the MSP430 chip at the near end converts the received data into a sound signal and then plays it through the speaker. The square wave output function is realized by using the near end as the transmitter to send a control command to the remote end. After receiving the control command, the remote end outputs a square wave signal with an adjustable duty cycle. This realizes two-way communication under half-duplex communication. The data transmission and reception is completed through the RF front end with CC2420 as the core, and the peripheral amplification and filtering circuits are attached. The principle block diagram of the platform is shown in Figure 1.

The preamplifier completes the amplification of the weak signal of the microphone to match the full-scale measurement range of the ADC and improve the signal-to-noise ratio; the pre-low-pass filter filters out signals higher than 1/2 of the sampling frequency, that is, stacked signals, to reduce voice distortion; the embedded processor completes data processing and transmission and reception; the RF transceiver CC2420 completes data reception/transmission, receives/sends data from the device, and sends the data to the embedded processor. The post-low-pass filter filters the voice signal after D/A conversion and restores the voice signal. A low-noise, non-chopper-stabilized bipolar op amp is used to design a second-order active filter circuit. The audio amplifier amplifies the filtered voice signal, improves the load capacity, and outputs it to the speaker, ultimately realizing wireless voice communication. The circuit has few peripheral components and the voltage gain is adjustable.

1.2 Device Selection

MSP430 is a 16-bit microcontroller with ultra-low power consumption. The solution uses MSP430F168, and the power consumption current has reached the μA level. The CPU core is powerful: 16-bit CPU and efficient RISC instruction system, no external data address bus, and can reach an instruction cycle of 125ns at 8MHz. It has 16 fast response interrupts and can handle various emergency events in time. Rich on-chip peripheral function modules: The 12-bit A/D converter ADC12 includes an ADC core with sample/hold function, conversion storage logic, internal reference level generator, multiple clock sources, sampling and conversion timing circuits. It has 8 external channels and 4 internal channels, with a sampling rate of up to 200 kbit·s-1, and has multiple sampling modes. Two USART communication serial ports can be used in UART and SPI modes; there are precision hardware multipliers and two 16-bit timers on the chip, which have 48 kB flash memory and 2 kB RAM for storing collected data.

The RF chip uses CC2420 from Chipcon of Norway. This chip has a fully integrated voltage-controlled oscillator and only requires very few peripheral circuits such as antenna and 16 MHz crystal oscillator to work in the ISM free band, with an operating frequency of 2.4 GHz. It has 2 Mchip·s-1 direct spread spectrum sequence baseband modulation and demodulation and an effective data rate of 250 kbit·s-1; it is suitable for simplified function devices and full-function device operations: low current consumption; low power supply voltage requirements. Programmable output power; independent 128 Byte transmit and receive data buffers. The chip has good performance, especially extremely low current consumption and package size, which fully meets the design requirements of small size, low power consumption and low cost of wireless network equipment. CC2420 only provides an SPI interface to connect to the microprocessor, through which the settings and data transmission and reception are completed. Many microcontrollers have integrated SPI controllers, which can be easily used with CC2420.

Based on the SPI communication between the single-chip microcomputer MSP430 and the wireless radio frequency chip CC2420, the SPI register of the single-chip microcomputer is designed to drive CC2420. The processor accesses the internal registers and storage areas of CC2420 through the SPI interface. The connection between CC2420 and the processor uses the four pins SFD, FIFO, FIFOP, and CCA to indicate the state of sending and receiving data; and the processor exchanges data and sends commands with CC2420 through the SPI interface. The SPI of MSP430F168 is full-duplex, so when sending data to the slave through SIMO, the SOMI interface is also receiving data. [page]

1.3 Hardware Implementation

The hardware solution makes full use of the 12-bit ADC and DAC on the MSP430 chip, eliminating the need for external voice codecs and making the system more streamlined. The hardware circuit of the voice transmission system is shown in Figure 2.

The working principle of the microphone amplifier and pre-low-pass filter circuit: The reverse amplifier formed by U1 provides microphone amplification, and its gain is determined by R4 and R5; R2 and R3 provide appropriate bias for U1 after voltage division, R1 provides bias voltage for the electret microphone, and C2 prevents the DC component from being input to the amplifier; the first-order Sallen-key structure Chebyshev low-pass filter R8 and C5 form a first-order low-pass filter for anti-stack filtering of ADC. The post-filter consists of a first-order Sallen-key structure Chebyshev low-pass filter, a first-order RC low-pass filter, and a first-order voltage follower U4. The cutoff frequencies of the three-stage filters are slightly offset from each other to limit the ripple of the passband of the entire filter circuit. The cutoff frequency of the entire circuit is set at 3,400 Hz, and the voltage follower is used to prevent the circuit from obtaining feedback from the output and provide current drive.

When designing the circuit of the audio part, considering that the sampling rate is 10 kHz, according to the Nyquist sampling theorem, the effective sampling frequency Os of the system must meet the requirement of Os ≥ 2ON. Here ON is called the Nyquist frequency and ON is called the Nyquist rate. When the sampling frequency is less than the Nyquist frequency, the signal recovered at the receiving end is distorted because of the presence of signal aliasing; when the sampling frequency is greater than or equal to the Nyquist frequency, the recovered signal is basically the same as the original signal. The maximum input signal frequency cannot exceed 5kHz, and a low-pass filter must be added before inputting the ADC to filter out signals above 5 kHz.

2 Software Implementation

The software design is mainly based on the SPI communication between MSP430F168 and CC2420. By designing the SPI register of the microcontroller to drive CC2420, the register value of the RF chip is set and read to realize the corresponding sending and receiving functions.

2.1 System Function Implementation

The remote end performs A/D conversion on the voice data and sends it in packets. To achieve real-time voice communication, the waiting time between frames should be minimized to increase the effective data rate. In theory, the maximum payload should be used to achieve maximum transmission efficiency, but longer data frames are more easily damaged by external interference signals, and voice delay is also increased. Considering the filter cutoff frequency and the node transmission speed of CC2420, the A/D conversion uses a sampling frequency of 10 kHz and an 8-bit resolution. The main frequency of MSP430 is 8 MHz, and the ADC divides it by 8, with a single channel single conversion. Timer B is synchronized with its clock and generates an interrupt every 50μs. A conversion is performed every two interrupts, and the data is read out to take the upper 8 bits. The ADC samples 84 8-bit signals as a data packet at a time, and a 12-byte header is automatically added to this data packet by the protocol stack before it is sent out by RF. Since the transmission rate of CC2420 is 250kbit·s-1, it takes about 3.072ms to transmit each data packet.

The near-range end restores the received voice data. The D/A conversion clock is set to be synchronized with the A/D conversion. And the frequency is also 10 kHz. The timer A module of the microcontroller generates an interrupt every 100 μs, and performs a D/A conversion in the interrupt. The size of an ADC input buffer or a DAC output buffer is 84 bytes. It takes 8.4 ms to fill these buffers. The system flow chart is shown in Figure 3.

[page]

2.2 Send and receive subroutine implementation

The transmitter obtains the result of A/D conversion and stores it in the opened buffer. When sending data, the data stored in the buffer, plus the frame headers of the network layer MAC layer and the physical layer, are sent to the transmit FIFO of the RF transmitter chip through the SPI bus. To simplify the transmission of data, 16-bit short address addressing is used instead of 64-bit IEEE address. When receiving data, the RF transmitter chip first monitors the data in the channel to determine whether the data is sent to the device. If so, the data is read into the receive FIFO, and then triggered to send the data to the MCU through the SPI bus; the MCU processes it, removes the frame headers of each layer, and finally stores the data in the specified buffer area. The specific subroutine flow for completing the sending and receiving part is shown in Figure 4.

2.3 Reverse Control and State Switching

In the process of wireless communication, the CC2420 communication module of the host or the extension can only be configured in one transmission mode at a time, that is, the transmission mode or the reception mode, so the wireless channel actually provides a half-duplex communication mode. In practice, the two parties cannot use buttons to switch between the transmission and reception modes like a walkie-talkie, so it is necessary to ensure the real-time and accuracy of the voice data and the effective transmission of the reverse control signal. The state switching of the software has become an urgent problem to be solved.

The transceiver subroutine shown in Figure 4 is used to control whether the remote end outputs a square wave. When the button is pressed, a control command is sent to the remote end. After receiving the control command, the timer comparison mode is used to output a square wave. From a system perspective, each communication node has both transceiver and receiver functions. The CC2420 state machine can be used to easily switch states, and the wireless transceiver module can be restored to the receiving state after each transmission.

3 Conclusion

During the system debugging process, considering the synchronization of voice transmission, avoiding the conflict between the wireless reception of voice signals and the speed of SPI reading data RXFIFO, the receiving end adopts a double buffer design; in addition, since each node has the function of sending and receiving at the same time, considering the characteristics of half-duplex, the voice signal is given high priority, and the method of detecting the square wave control signal only at each interruption is adopted, which not only ensures the real-time transmission of the voice signal, but also ensures the real-time effectiveness of the control signal. Since CC2420 does not have a dedicated software monitoring package, the voice transmission signal is simulated by a sine wave signal, and the square wave output control signal is transmitted in reverse. After debugging, the D/A output port finally outputs a stable step-shaped sine wave, and the speaker output port outputs a basically smooth sine wave. Experiments have shown that the voice transmission effect is best when the waveform has no wave clipping distortion and the waveform is stable. After testing, the transmission distance is about 50m.

The system does not use independent ADC and DAC, which makes the cost and power consumption lower; it uses the five power saving modes of MSP430, plus the low power consumption and low cost characteristics of ZigBee technology itself, so that it can work longer when powered by batteries only. The system involves a variety of theories and technologies such as communication principles, wireless technology, anti-interference technology, and software design, providing a basis for the widespread application of ZigBee technology.

Reference address:Voice Communication System Based on IEEE802.1 5.4/ZigBee

Previous article:Design of electronic blood pressure meter based on MSP430F449
Next article:Real-time monitoring and management system for core items based on RFID technology

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号