As an important tool for obtaining information, sensors play a significant role in industrial production, science and technology, etc. However, with the rapid development of microprocessor technology and the development of automation and intelligence of measurement and control systems, traditional sensors have been combined with various microprocessors and connected to the network, forming intelligent sensors with a series of functions such as information detection, signal processing, and logical thinking.
1 Introduction to Networked Intelligent Sensors
Networked intelligent sensors enable sensors to develop from single function and single detection to multi-function and multi-point detection; from passive detection to active information processing; from local measurement to remote real-time online measurement and control. Networking allows sensors to access the network nearby, and there is no need for point-to-point connection between sensors and measurement and control equipment, which greatly simplifies the connection lines and facilitates system maintenance and expansion. Networked intelligent sensors are generally composed of signal acquisition units, data processing units, and network interface units. These three units can be composed of different chips or monolithic structures. The core of networked intelligent sensors is embedded microprocessors. Embedded microprocessors have the characteristics of small size, low power consumption, high reliability, and strong anti-interference ability. This system uses embedded microprocessors as the core and digital temperature sensors as acquisition units. The system design adopts the latest B/S (Browser/Server) structure in the field of information technology, using browsers as unified clients, without software installation, and more convenient to use.
2 System Hardware Design
2.1 Overall Framework
The embedded microprocessor LPC2210 is a microcontroller based on a 16/32-bit ARM7TDMI-S CPU that supports real-time simulation and embedded tracing. It has extremely low power consumption, multiple 32-bit timers, 8-way 10-bit ADC, PWM output, and up to 9 external interrupts, and is particularly suitable for industrial control and medical systems; due to the built-in wide range of serial communication interfaces, it is also very suitable for communication gateways, protocol converters, embedded soft modems, and other types of applications.
The overall framework of the embedded Web intelligent temperature sensor system design is shown in Figure 1.
2.2 Power supply module
LPC2200 series ARM7 microcontrollers all use two sets of power supplies, the I/O port power supply is 3.3 V, and the core and on-chip peripheral power supply is 1.8 V. As shown in Figure 2, firstly, the 9 V DC power supply is input from the CZ1 power supply interface, and the diode D1 prevents the power supply from being reversely connected, and is filtered by two capacitors C1 and C2; then, the power supply is stabilized to 5 V by LM7805, and then the LDO chip (low voltage difference power supply chip) is used to stabilize the output voltage of 3.3 V and 1.8 V.
2.3 Temperature sensor
The temperature sensor uses a single-wire digital temperature sensor DS18820, which is a new generation of intelligent temperature sensor adapted to microprocessors produced by Maxim. The temperature measurement range is wide, from -55 to +125°C, and the inherent temperature measurement resolution is 0.5°C. It supports the "one-wire bus" interface, that is, only one line (single-wire interface) is required to read information from or write information to the DS18820. The temperature conversion power comes from the data bus, and the bus itself can also supply power to the connected DS18820 without the need for an additional power supply. The DS18820 integrates temperature measurement and A/D conversion, and can realize a 9- to 12-bit digital value reading method through simple programming according to actual requirements. It has the characteristics of small size, convenient interface, and long transmission distance.
The connection diagram of DS18820 and microprocessor LPC2210 is shown in Figure 3. Note that a pull-up resistor with a resistance of 5.1 kΩ should be added.
2.4 Network interface
The network interface uses the currently commonly used 10 Mbps embedded Ethernet control chip RTL8019. It is a highly integrated Ethernet control chip that integrates DMA controller, ISA bus controller, 16 KB SRAM and network PHY transceiver. Users can write the data to be sent into the on-chip SRAM through DMA, and let the chip automatically send the data out; after the chip receives the data, users can also read it out through DMA.
RTL8019AS and LPC2210 are generally connected through an external bus, and their connection relationship is listed in Table 1.
[page]
As shown in Table 1, RTL8019AS uses the Bank2 part of LPC2210 external storage control, and the I/O address of RTL8019AS is 0x00300~Ox0031F, so RTL8019AS is selected when SA8=1, SA5=0, and its data address is 0x83400000~Ox83400001F.
NET_RST is the output pin of LPC2210, and the interrupt signal of RTL8019AS is the interrupt input signal, and it is an external interrupt. SDO~SDl5 of RTL8019AS is connected to D0~D15 of LPC2210 through a 470 Ω resistor. In addition, the system also adds an LCM interface, which can directly support the SMG240128A dot matrix graphic LCD module, so that the temperature received by the sensor can be displayed in real time through the LCD.
3 System software analysis
3.1 Overall design
The system development uses ARM's ADS1.2 as the development and compilation environment. The μC/OS-II operating system was ported, mainly written in C language. To port μC/OS-II to the ARM processor, three files related to the ARM architecture need to be modified: OS_CPU.H, OS_CPU_A.ASM, OS_CPU_C.C. For specific porting, please refer to relevant books.
The program first calls OSinit() to initialize μC/OS-II and completes the initialization of some variables, data structures and macro definitions inside the operating system. Before starting multitasking, it is also necessary to create a task named Task0(), which is very important, otherwise the user's application will crash. In the main task, the TargetInit() function is first called to initialize the target board. The template contains this initialization function, which completes some initialization work on the hardware on the board. After that, the multitasking environment is started and three tasks are created to achieve the ultimate goal of the system. These three tasks include: temperature acquisition and processing by the sensor; temperature comparison and LCD display; and establishment of a Web server. The following is a detailed explanation of the more critical issues in the design process.
3.2 Key technical issues in software design
3.2.1 Temperature acquisition of sensors
In the software programming of sensor data acquisition, the single-wire bus protocol is used. The protocol for accessing DS18820 through the single-wire bus includes: initializing DS18820, ROM operation commands, memory operation commands, and reading data/processing data.
According to the initialization timing, writing timing, and reading timing of DS18820, three subroutines are written respectively: Init_DS18820 is the initialization subroutine; WriteOneChar is the writing (command or data) subroutine; ReadOneChar is the reading data subroutine. All data reading/writing starts from the lowest bit.
The flow of the system's read byte subroutine is shown in Figure 4.
The key task program code for temperature sensor collection is as follows:
3.2.2 Establishment of Web Server
To establish a Web server in a microprocessor, it is mainly necessary to implement the transplantation of the TCP/IP protocol stack. The design mainly uses the ZLG/IP software package, which is a TCP/IP protocol stack for embedded system development developed by Guangzhou Zhou Ligong Single Chip Microcomputer Development Co., Ltd. and is one of the important members of the ZLG series middleware. ZLG/IP provides the function of implementing IP nodes on the Internet network and is a high-performance embedded TCP/IP protocol stack software. It uses the signal mechanism of the μC/OS-II real-time operating system to implement a multi-task parallel and reentrant protocol stack. It is completely written in ANSI C and can support multiple CPUs like μC/OS-II. ZLG/IP also has the characteristics of clear hierarchy and easy upgrade and modification. The specific details of the ZLG/IP software package can be found in the references.
ZLG/IP adopts a modular hierarchical design, and its structure is shown in Figure 5.
In Figure 5, the TCP/IP application is a μC/OS-II task written by the user. It is the user of ZLG/IP and is located at the highest level of the entire program. The TCP/IP application calls the Socket API interface function provided by ZLG/IP to perform corresponding operations on the network. The Socket API interface is located between the TCP/IP protocol and the application. It is a tool for users to operate the protocol stack program. In the application, the protocol stack software is operated by calling the Socket API interface function. The TCP and UDP processing modules are modules that process the transport layer protocol in the protocol stack program. They are responsible for encapsulating and disassembling the data of the transport layer and saving the connection status of the transport layer. The dotted line is the receiving process, including the processing of IP packets, ARP packets, ICMP packets, and the data receiving driver of the Ethernet layer. After receiving the data, the receiving driver module first classifies it. If it is an IP packet, it is processed by the IP processing module. If it is an ARP packet, it is processed by the ARP protocol. The ARP request packet calls the Ethernet sending module to send the ARP reply packet. The IP processing module classifies the data, and the TCP or UDP packet is transferred to the upper transport layer module for processing, while the ICMP protocol processing module is responsible for processing the IC-MP protocol. The IP sending module is responsible for encapsulating IP packets and transmitting the encapsulated IP packets to the lower-layer sending module. The IP sending module has four upper-layer module calls: Socket API interface, UDP processing, TCP processing and ICMP processing. They transmit the corresponding parameters to the IP sending module, which is then encapsulated. The Ethernet sending driver module is a processing module belonging to the Ethernet layer, responsible for encapsulating Ethernet packets and sending data. The modules that call it are the ARP processing module and the IP sending module.
[page]
Since the B/S structure is used, the programming adopts the Socket API of TCP communication. When programming TCP communication tasks, there are two modes: server mode and client mode. The server mode needs to monitor the connection and can only process data after establishing a connection with the client. The client mode actively connects to the server and can only process data after the connection is successful. Figure 6 is a function application diagram of the communication between the server and the client during TCP communication.
When programming, the temperature sensor has a unique IP address, i.e. 192.168.0.174. The subnet mask is 255.255.255.0, and the gateway address is the same as the IP address. The Web server is built in the microprocessor, and the personal PC is the client. When an individual needs to query the value of the temperature sensor, he can enter the IP address of the sensor (i.e. http://192.168.0.174) in the browser through the HTTP protocol to enter the web page temperature browsing interface of the system.
The Web server task program code is as follows:
Conclusion
This system has been tested and runs well. It can easily query the temperature value collected by the temperature sensor in real time through the browser. Networked intelligent sensors are a new direction in the development of sensor technology. This system uses embedded technology to implement a basic network-based intelligent sensor. The design focuses on the implementation of the TCP/IP communication protocol, that is, transplanting the TCP/IP protocol stack into the system, and then calling related API functions to achieve network communication. The implementation of Web functions mainly adopts the B/S mode, and the interaction between the browser and the embedded network sensor is realized through the upper-layer HTTP protocol. The networked control of sensors can be well applied to the control of household appliances or industrial sites, and has good application prospects.
Previous article:Intelligent temperature sensor based on network control of LPC2210
Next article:Design of autonomous mobile robot based on LPC2119
Recommended ReadingLatest update time:2024-11-16 15:50
- Popular Resources
- Popular amplifiers
- MCU C language programming and Proteus simulation technology (Xu Aijun)
- 100 Examples of Microcontroller C Language Applications (with CD-ROM, 3rd Edition) (Wang Huiliang, Wang Dongfeng, Dong Guanqiang)
- Single-chip microcomputer technology and application - electronic circuit design, simulation and production (edited by Zhou Runjing)
- Principles and Applications of Single Chip Microcomputers and C51 Programming (3rd Edition) (Xie Weicheng, Yang Jiaguo)
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
- The problem of repeated declaration of global variables in embedded C programming
- UWB can use the frequency band in China,,,,
- What should I do if I have a colleague who is nagging and incompetent?
- A feasible solution to the problem that the USB-Blaster driver cannot be successfully installed during the Quartus II 9 software installation and configuration
- The SGM42507 is a full-bridge driver designed for small motors and electromagnets.
- EEWORLD University ---- HVI Series: Design Considerations for High Power Density and High Efficiency Adapters
- MSP430Ware use notes to initialize XT1
- Open source program for automatic generation of dq current lookup table for permanent magnet synchronous motor of electric vehicle based on weak magnetic field lookup method
- What are the causes of IGBT damage in variable frequency power supply?
- Design and Application of Serial Communication Interface between TMS320F24x and PC