Design of networked intelligent temperature sensor based on LPC2210 and DS18B20

Publisher:凌晨2点369Latest update time:2012-08-24 Source: 21ic Keywords:LPC2210  DS18B20 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

Keywords:LPC2210  DS18B20 Reference address:Design of networked intelligent temperature sensor based on LPC2210 and DS18B20

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

DS18B20 program with decimal point
#include REGX52.H #define uchar unsigned char sbit DQ=P2^0; //Data transmission line connected to the corresponding pin of the microcontroller unsigned char tempL=0; //temporary variable low bit (unsigned character variable) unsigned char tempH=0; //temporary variable high bit unsigned int tempa; //temperature value
[Microcontroller]
AT89C52 controls the temperature sensor DS18B20 and displays it on the LM016L_LCD
//-------------------------------------------------------- //File name: Temperature_Control // //File description: AT89C52 is used as the master control to obtain, process and send data in real time and perform global control; // DS18B20_Sensor temperature (-50 ~ 255℃) data is input in real time; // LM016L_LCD tempera
[Microcontroller]
Temperature display circuit based on DS18B20 and 89C2051
An economical household temperature measurement system composed of a single bus digital temperature sensor DS18B20 and 89C2051. Its temperature display is "-XXC", with an accuracy of ±0.5℃ and a temperature measurement range of -55℃ to +125℃. The following is a detailed analysis of the system composition and the imp
[Microcontroller]
Temperature display circuit based on DS18B20 and 89C2051
【Blue Bridge Cup MCU】DS18B20
DS18B20 and the microcontroller use a single bus connection. The file used in the competition is the provided "onewire.c" Programming steps: (1) Initialization (2) Send ROM operation commands, including: Read ROM , Match ROM , Skip ROM , Search ROM , Alarm search (3) Send memory operation commands, including:
[Microcontroller]
Design of Networked Intelligent Temperature Sensor System Using LPC2210
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 on-site measurement to long-distance real-time on
[Microcontroller]
Design of Networked Intelligent Temperature Sensor System Using LPC2210
ARM Litian Electronics LPC2148 Temperature Control System Based on DS18B20
//Read one bit of data (read bit procedure) 1unsigned char tmpreadbit(void) //read a bit 2{ 3 unsigned char dat;  4 DS_OUT(); //Set the port to output 5 DS_L(); //DS=0 6 //Delayn(1); //2uS 7 DS_IN(); //input 8 //Delayn(1); 9 if(DS_R()!=0) 10 dat=1; 11 else  12 dat=0; 13 DelaynUs(50);     14 return (dat); 15} //Read
[Microcontroller]
PIC16f877a MCU DS18b20 source code
//Debug summary: //The obvious problem is that in the write timing and read timing, the PIC MCU writes 1 to the bus by changing the direction to the input direction and pulling up the data line with a pull-up resistor, rather than outputting 1 in the output direction, which is different from AVR. //When the 8 bits of
[Microcontroller]
AT89C51+DS1302+DS18B20 six-digit digital tube display clock program
#include #define uchar unsigned char #define uint unsigned int #include"DS1302.h" #include"DS18B20.h" #define sec 0x80 #define min 0x82 #define hou 0x84 #define read 0x01 unsigned char hour,minute,second,id=0,timecount,re_disp=0,p,n0,n1; bit flag; #define leddata P0 //Define the segment selection of the digital tube s
[Microcontroller]
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号