This paper mainly introduces the design of a wireless voting base station based on Zigbee technology, with ARM7 chip AT91SAM7X256 as the core and μC/OS-II as the operating system. The base station is used to connect the Zigbee network and Ethernet. It realizes the functions of remote monitoring of wireless voting machines and simultaneous voting in multiple conference rooms. It mainly analyzes the software design of the base station, introduces how the base station establishes a wireless voting machine network, collects voting results of voting machines, and accepts remote monitoring access. And the structure of its hardware platform is described accordingly.
1 Introduction
Voting machines are widely used in elections, meetings, teaching, and entertainment programs. The current wireless voting system uses a single wireless network to enable wireless terminal devices to communicate with the host computer. Due to the limited transmission distance and poor penetration of obstacles of wireless networks, remote monitoring and simultaneous voting in multiple conference rooms cannot be achieved. This paper uses the low power consumption of Zigbee technology and the free use of frequency bands and the long transmission distance and fast transmission rate of Ethernet to combine the two and design a wireless voting machine base station. The wireless voting machine remote monitoring and simultaneous voting in multiple conference rooms are realized.
2 System Overview
The entire wireless voting system consists of a monitoring center, a base station, and a voting machine, as shown in Figure 1. The base station serves as a hub for communication between the remote monitoring center and the wireless voting machine equipment, and also serves as a coordinator in the wireless voting machine network to maintain and manage the entire wireless network. The base station collects the voting status of each voting machine and accepts instructions and scheduled visits from the remote monitoring center.
Figure 1 Overall structure of wireless voting system
3 Hardware Design
The hardware structure of the base station is shown in Figure 2, which consists of an ARM7 processor AT91SAM7X256, a wireless module, an Ethernet module, a storage module, a power module, and a display module.
Figure 2 Overall hardware structure
AT91SAM7X256 is the main control chip of the entire base station, produced by Atmel. It integrates an ARM7TDMI processor, 256KB Flash and 64KB SRAM on the chip, as well as peripheral devices such as USART, SPI, CAN controller, Ethernet port, etc.
The wireless module uses CC 2520 chip. CC2520 is the second generation transceiver chip based on Zigbee/IEEE802.15.4 protocol launched by TI. Rich hardware supports frame processing, data caching, data encryption, CCA and other operations. CC2520 communicates with AT91SAM7X256 through SPI interface. AT91SAM7X256 selects and enables CC2520 through /CSN pin and VREG_EN pin respectively, and GPIO4 pin provides AT91SAM7X256 with start signal of receiving data frame and end signal of sending data frame.
The Ethernet module uses the DM9161 chip, which is a low-power, high-performance physical layer transceiver launched by Dav IC om that can realize all 10M/100M Ethernet physical functions.
4 Software Design
Figure 3 Overall software structure.
The overall software structure diagram is shown in Figure 3. This base station uses the μC/OS-II operating system, and completes the porting of the LwIP protocol stack based on the TCP/IP protocol and the msstatePAN protocol stack based on the Zigbee protocol on this operating system, as well as the Ethernet network card driver, wireless transceiver chip driver, and application program writing work [3,4]. The driver and application program will be described in detail below.
4.1 Ethernet network card driver
The EMAC_INIT() function completes the initialization of EMAC, including the configuration of EMAC operation mode, MII interface and PHY, and the setting of send and receive buffer descriptors [5]. MII interface is an Ethernet industry standard defined by IEEE-802.3, which is used to connect FastEthernet MAC-b LOC k with various types of PHY [6]. It includes a data interface and a management interface between MAC and PHY. After the PHY is powered on, the DM9161 is first reset by software. After the software reset is completed, the EMAC and PHY are initialized and enabled. The EMAC and PHY interfaces are then enabled, and the auto-negotiation process is implemented. During the auto-negotiation process, the EMAC and PHY communicate via the MDIO interface, so that the two are configured to the same speed and duplex mode. Finally, the EMAC address is set and the initialization of the receive and send buffer identifiers is completed, so that each descriptor points to the correct buffer address and the descriptor head address is written into the queue pointer register. The data packet reading and data packet transmission of EMAC are completed by EMACReadPAC ke() and EMACSendPacket() functions respectively . In order to ensure the correct data packet reading position, the GetInputPacketLen() function must be called before reading the data packet to obtain the length of the data packet.
4.2 Zigbee transceiver chip CC2520 driver
It consists of an initialization module, a data transmission module and a data reception module. The initialization module is used to initialize and configure CC2520, including starting CC2520, setting the network channel number, transmission power, automatic CRC check, and configuring the GPIO4 pin to receive the SFD frame start signal.
The transmitting module completes the task of sending data. The following program is the data sending process.
First clear the send buffer, then write the data packet to be sent into the send buffer and enter the send state, then determine whether the data has been sent according to the GPIO4 pin signal. If not, continue to wait. If the data has been sent, clear the SFD flag, and finally put CC2520 into the idle state.
The receiving module completes the task of receiving data. When the SFD signal of the GPIO4 pin of CC2520 is detected, an interrupt is generated and the receiving interrupt service routine is entered. The receiving interrupt service routine is similar to the sending routine and will not be listed here one by one.
4.3 Application Layer
Main implementation: 1. Establishment of Ethernet and Zigbee network. 2. Accepting access and various instructions from the remote monitoring center. 3. Maintaining and managing the entire Zigbee network. 4. Receive voting data frames from each voting device in the Zigbee network. The program flow chart is shown in Figure 4.
First, establish an Ethernet network. After completing the connection with the host computer, the host computer sends a basic information frame to the base station to establish a wireless voting device network. The base station establishes a Zigbee network based on the frequency band, PAN number, transmission power and other parameters specified in the basic information frame. Each wireless voting device applies to join the network. After successfully joining, it will obtain a 16-bit dynamic network short address assigned by the base station (coordinator in the Zigbee network). At the same time, it prompts the user that the voting device communication is normal. Otherwise, it prompts that the communication failed.
Within the set time limit, the base station counts the number of voting devices that successfully join the network and sends the statistical results to the host computer. All voting devices that apply to join the network are blocked until the base station receives the command from the host computer to update the network. If the total number of voting devices participating in this stage received by the host computer is greater than the set minimum number of people, the host computer sends a voting information frame to the base station. If the total number of voting devices participating in this stage is less than the set minimum number of people, the host computer sends a time limit instruction to the base station to extend the waiting time for the voting devices to join the network. If the time limit is exceeded again and the specified number of people is still not reached, it will prompt that the voting in this stage is invalid. The voting information frame includes the voting format and voting type of this stage. After receiving the voting information frame, the base station broadcasts it to the entire Zigbee network, and the voting begins. Each voting device in the Zigbee network will prompt the user to perform the corresponding voting operation based on the received voting information frame. After the user completes the voting operation, the voting device sends the voting data frame to the base station, which stores the voting data frame in the Zigbee_BUF data buffer and sends a reply frame to the voting device to indicate the successful transmission to the user. Then the network short address of the voting device is reclaimed to make it leave the network to prevent the user from voting twice.
Figure 4 Application.
The host computer periodically accesses the base station. After receiving the access request, the base station transmits the data buffer content to the host computer. After receiving the information confirmation frame, the host computer returns the information confirmation frame. After receiving the information confirmation frame from the host computer, the base station clears the data buffer content. Within the specified voting time limit, the base station reclaims all network short addresses, so that all voting devices that have joined the network this time are disconnected, and users are stopped from voting.
After completing the voting process of this stage, when entering the new voting stage, the host computer sends a network update command to the base station. At this time, the base station allows the voting device to join the network again, and a new round of voting begins.
4.4 Result
The base station has completed the joint debugging work and successfully realized all the functions introduced in this article. Figure 5 shows the data transmission when the spectrum analyzer monitors the communication between the base station and the wireless voting device.
Figure 5: Monitoring software of the host computer of the remote monitoring center.
5 Conclusion
The base station designed in this paper realizes the connection between Ethernet and Zigbee network, and provides some ideas for realizing remote monitoring of Zigbee network. The base station has been put into the market and achieved good economic benefits. How to improve the performance of the base station in terms of power consumption and transmission speed and design a base station that can be interconnected with multiple existing protocols is the focus of our future research.
Previous article:High-performance, low-power LPC2000 series microcontrollers based on ARM7 meet embedded needs
Next article:Design of electronic fuse for detonator based on STM32 microcontroller
Recommended ReadingLatest update time:2024-11-16 16:18
- Popular Resources
- Popular amplifiers
- Wireless Sensor Network Technology and Applications (Edited by Mou Si, Yin Hong, and Su Xing)
- Detailed explanation and engineering practice of unmanned monitoring technology (Xie Jianbin, Li Peiqin, Yan Wei, Liu Tong, Lin Chenglong, Hong Quanyi, Zhou Hongfei, Cui Yibing)
- Introduction to Wireless Sensor Networks (Edited by Ma Sasa et al.)
- Introduction to the Internet of Things (Liu Yunhao)
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
- Follow the power expert to make a "high-efficiency bidirectional DC-DC converter"
- Duty cycle setting problem
- Detailed explanation of Zigbee networking principle
- Ask a question about operating ESP8266 with STM32
- How to write pointer array in stm32
- [Evaluation of domestic FPGA Gaoyun GW1N-4 series development board]——12. Two tips (multi-function pins and board silk screen)
- Questions about the CAN bus ID part
- [Classic C language knowledge] Summary of C/C++ programming difficulties
- Is this a series voltage regulator circuit?
- Shenzhen Yezhan Electronics is looking for talents||Looking forward to your joining