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 peripherals such as USART, SPI, CAN controller, Ethernet port, etc.
The wireless module uses CC2520 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 Davicom that can realize all 10M/100M Ethernet physical functions.
4 Software Design
Figure 3 Overall software structure.
The overall software structure 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-block 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 . EMAC's data packet reading and data packet transmission are completed by EMACReadPacke() 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:Design of remote control system for ARM controller and home intelligence using ZigBee technology
Next article:Design of intelligent trip device data acquisition system based on ARM microcontroller
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Keysight Technologies Helps Samsung Electronics Successfully Validate FiRa® 2.0 Safe Distance Measurement Test Case
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- How to choose and use 2.4G antenna applications?
- Automotive Power Electronics and Motor Drives Handbook
- [NXP Rapid IoT Review] + Finally climbed out of the pit (Second week review summary)
- National Undergraduate Electronic Design Competition Module Design Series (II)
- allegro16.6 Questions about via opening and via cover oil?
- MSP430 interrupt mechanism
- The internal matching drive amplifier is actually an internal two-stage process as shown below:
- Using a microphone to measure light? It turns out there is such a cool operation!
- CC2540 Power Settings
- I'd like to ask for your advice, is there any cheap solution to remotely control LED advertising screens via the internet?