1 Overall system design
ZigBee technology is a wireless communication technology with low speed, short distance, low power consumption, low complexity, low cost, reliable communication and large network capacity. According to the IEEE 802.15.4 protocol standard, ZigBee's operating frequency band is divided into 868 MHz, 915 MHz and 2.4 GHz. The 2.4 GHz band is divided into 16 channels. This band is a universal industrial, scientific and medical band. This band is a free and application-free radio band. In this band, the data transmission rate is 250 Kb / s, and the power consumption emission output is only 0~3.6 dBm. Considering all factors, the 2.4 GHz band is selected.
The system mainly consists of three parts: illumination terminal acquisition node, coordinator master node and host server monitoring center. The overall structure of the system is shown in Figure 1.
Figure 1 System overall structure diagram
2 System Hardware Design
The ZigBee wireless transmission network of this system consists of 4 terminal collection nodes with light intensity sensors and 1 coordinator master node. The light intensity data collected by the terminal collection node BH1750 digital light intensity sensor is sent wirelessly to the coordinator master node CC2530 RF transceiver module through the CC2530 RF transceiver module. The master node CC2530 RF transceiver module then communicates with the main controller S5PV210 and transmits the data to the remote host server monitoring center through the 3G network.
2.1 Coordinator Master Node Design
The main role of the coordinator master node in the entire ZigBee wireless network is to establish, maintain, and control the joining of terminal nodes as well as the aggregation, caching, and forwarding of data. It is the control center of the ZigBee network, and its structural block diagram is shown in Figure 2. The wireless RF transceiver chip CC2530 completes networking and wireless data transmission and reception; 3G Internet access completes long-distance wireless transmission of data; the main control chip S5PV210 is responsible for the coordination and control of the entire master node module.
Figure 2 LAN control master node structure diagram
CC2530 is a true system-on-chip (SoC) solution for IEEE802.15.4, ZigBee and RF4CE applications. It can build powerful network nodes with very low total material cost. CC2530 combines the excellent performance of RF transceiver with industry-standard enhanced 8051 CPU, in-system programmable flash memory, 8 KB RAM and other powerful features. CC2530 has 4 different flash versions: CC2530F32/64/128/256, with 32/64/128/256 KB of flash memory respectively. Short transition time between operating modes can further ensure low energy consumption.
2.2 Terminal collection node design
The terminal acquisition node is responsible for transmitting the collected light intensity data to the coordinator master node, and its hardware circuit schematic is shown in Figure 3. The digital light sensor BH1750 is responsible for collecting light intensity data; the wireless RF transceiver chip CC2530 is responsible for wireless communication with the LAN control center, collecting data and sending data to the LAN control center.
Figure 3 Schematic diagram of the LAN acquisition node circuit
BH1750 is a digital light intensity sensor integrated circuit for two-wire serial bus interface. This integrated circuit can adjust the brightness of LCD or keyboard backlight according to the collected light intensity data. Its high resolution can detect a wide range of light intensity changes, from 1 to 65,535 lx. It supports I2C bus interface (f/s Mode Support) and has a spectral sensitivity characteristic close to visual sensitivity (peak sensitivity wavelength is typically 560 nm) [6]. It outputs a digital value corresponding to the brightness. It achieves low current through power reduction function. It achieves stable measurement through 50 Hz/60 Hz light noise reduction function. It supports 1.8 V logic input interface. No other external components are required. It has weak dependence on light source (incandescent lamp, fluorescent lamp, halogen lamp, white light LED, fluorescent lamp). There are two optional I2C bus slave addresses. The factor that has the greatest impact on the adjustable measurement result is the size of the light entrance. The minimum error variation is ±20%; it is very little affected by infrared rays.
3 Software Design
The system software design includes the software design of terminal node acquisition program, ZigBee network wireless transmission program, 3G network wireless transmission program and host computer server monitoring program.
3.1 Terminal node collection program design
The communication between BH1750 and the host controller uses the standard I2C bus communication protocol. The I2C bus is a two-wire serial bus developed by NXP for connecting microcontrollers and their peripherals [7]. The host controller sends various control commands to BH1750 and reads measurement data through the I2C bus interface. The main control commands are as follows: power-on command is 0x01; power-off command is 0x00; continuous H resolution mode is 0x10; continuous L resolution mode is 0x13; one-time H resolution mode is 0x20; one-time L resolution mode is 0x23.
Taking "continuous high resolution mode" as an example, the measurement steps are as follows:
① Send the “power on” command.
② Send the "Continuous High Resolution Mode" command.
③ Wait for the first high-resolution mode measurement to complete (maximum time 180 ms).
④ Send a read command.
⑤ Read the measurement results.
3.2 ZigBee network wireless transmission program design
After the ZigBee coordinator node is powered on, the ZDO layer performs a series of initialization tasks for the first time, then calls the initialization device function of the ZDO layer, and finally triggers the network initialization function to start building a new network. When establishing a network, the coordinator node first scans each channel one by one, sorts them according to the energy value of each channel, and selects channels with energy values reaching a certain size as available channels. Secondly, the network layer selects a channel from the available channels and randomly selects a 16-bit network identifier (PANID) that is unique in the selected channel and assigns it to the newly created network [8]. The software design flow chart of the coordinator is shown in Figure 4. [page]
After the terminal acquisition node is powered on, it will initialize the device and then detect whether there is a network around it. When a network is found, the network layer will give the ZDA layer feedback information about the network discovery, and then the network layer will send a request to join the network with relatively large energy intensity; if the network is successfully joined, the network layer will give the ZDA layer feedback about joining the network. After successfully joining the network, it will start to send a binding request to the coordinator. After the binding is successful, it will start to collect light data, pre-process the collected data and send it wirelessly to the coordinator node. The software flow chart of the sensor terminal acquisition node is shown in Figure 5.
3.3 Design of 3G Network Wireless Transmission Part
3.3.1 Porting of usb_modeswitch
usb_modeswitch is a tool for switching the working mode of USB devices under Linux system, which is used to control USB devices with multiple USB sub-devices. In Linux environment, manufacturers generally do not provide drivers for USB devices on Linux system, so the usb_modeswitch tool is needed to switch the mode. The device mode depends on usbstorage and usbserial, so the development board needs to have the support of these two modules, and the device can work normally in these two modes.
usb_modeswitch depends on a series of library files provided by libusb. You need to install libusb first. Unzip and enter the libusb1.0.6 directory. Use the following command to create a subdirectory install to store the last surviving library files and header files. The porting process of usb_modeswitch is omitted - Editor's note.
3.3.2 Transplantation of PPPD
Linux already supports 3G module driver and PPP network protocol stack in the kernel. What needs to be done is to configure the relevant options of 3G module driver and PPP network protocol stack in the kernel. The transplantation process of PPPD is omitted - Editor's note.
Create three files in the /etc/ppp/peers directory of the development board file system. The code is omitted - Editor's note.
3.3.3 Design of communication program between master node and host computer
Through PPPD dialing, a data link layer connection can be established. The data link layer uses the PPP protocol, which is a character-oriented protocol designed for transmitting data packets between two peer entities. The extensible link control protocol LCP is used to establish, configure and test data links. The network program also requires the support of the TCP/IP protocol. The Linux kernel has retained support for TCP/IP and other network protocols. Finally, write the network client application on the embedded Linux and the Windows network server application to transmit the data you want to transmit. The program flow chart of the communication between the main node main controller and the host computer server is shown in Figure 6.
Figure 6 Flowchart of the communication program between the master node and the host computer
3.4 Server host computer monitoring part
The server software is developed in Microsoft Visual C++6.0 development environment, using object-oriented programming methods. For each window, a corresponding class is established, and objects are created based on the class. The operation of the object is the operation of the corresponding window. The monitoring center software mainly realizes the following functions: establish the server and receive the connection of the client; receive and display the data sent by the client; real-time curve display; historical data query.
4 Debugging and testing
4.1 System Debugging
During the system debugging process, some of the data received by the host computer when transmitting data was wrong. By checking the binary code, it was found that the characters 0x11 and 0x13 were not received. Narrowing the scope to see which link the problem lies in, it was found that the main node controller S5PV210 did not receive the characters 0x11 and 0x13, while the main node CC2530 microcontroller had received the characters 0x11 and 0x13, so the problem must be on the serial port.
In Linux serial port programming, the variable c_iflag (termios member variable) is not set effectively, so there is no problem in transmitting ASCII code, but when transmitting binary data, 0x0d, 0x11 and 0x13 will be discarded. These characters are special characters and are used as special controls. You only need to turn off the ICRNL and IXON options.
The specific method is to add the following statement to the main controller Linux serial port initialization function:
options.c_iflag &= ~(ICRNL | IXON | IXOFF);
options is a termios structure defined before. The above settings can shield the special functions of characters 0x11 and 0x13, so that the above characters can be transmitted normally.
4.2 System Function Test
After connecting the hardware devices, configure and compile the kernel, download the compiled kernel to the development board via USB, and then restart. Then download the compiled application to the development board through the serial terminal. Insert the 3G network card into the USB interface and use the following command to create three TTY device file nodes. The code is omitted - Editor's note.
We can see that the Sina WEB server can be pinged, indicating that it has successfully connected to the Internet. Then place the four terminal nodes in different lighting environments, start the host computer software, establish the server side, and start waiting to receive the connection request and data sent by the main node client and display it. Start the main node client program to connect to the server, and finally start the collection and transmission program of the node. The monitoring data received and displayed by the host computer is omitted - Editor's note.
Conclusion
This paper describes a remote wireless photometry system that combines low-cost, low-power short-range wireless ZigBee technology with long-range 3G mobile communication technology, and completes the hardware and software design of the acquisition terminal node and the coordinator master node. By writing Windows platform host software, the collected data is displayed and analyzed in real time.
Previous article:Study on Watchdog Timer in MSP430 MCU
Next article:Using Flash MCU to implement agricultural grid meter application solution
- Popular Resources
- Popular amplifiers
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
- Another technical solution for power-type plug-in hybrid: A brief discussion on Volvo T8 plug-in hybrid technology
- DSP28335 implements high frequency filtering through FFT transformation
- Error: Can't route source node of type max_io to destination node ...
- Harbin Engineering University 1999 Digital and Analog Circuits Postgraduate Entrance Examination Questions
- The new Tektronix AFG31000 arbitrary wave function generator has all the functions you want!
- Discussing STM32H750 Part 4 (Briefly Talking about CANFD Part 1)
- Could you please help me figure out what component this is?
- EEWORLD University Hall----Design considerations for a robust interface between J6 and vehicle displays via FPD-Link
- Pearl River Delta: The third pole of China's semiconductor industry?
- [Analog Electronics Course Selection Test] + User Experience
- What is the relationship between baud rate and USB or network bit rate? For example, 900 (Baud, symbol/s) is used in some places...