admin 管理员组文章数量: 887021
2024年1月4日发(作者:java的scanner类方法)
土壤温度测量的设计
1.简介
温度是土壤的一个十分重要的环境因素,它直接影响微生物的活跃性及有机物的分解,影响植物的根吸收水分与矿物质,同时它在植物生长率及根的范围上发挥着重要作用。据统计,植物的根一般在地下50厘米范围内,因此测量这一范围内不同深度的土壤温度变得十分有意义。
目前,土壤温度测量仪器可分为三类。第一种,是利用热敏电阻与土壤温度之间的关系测量实际温度。在使用这类仪器前,系统参数需要校正,同时当解决系统遇到的问题时,十分不便。第二种是非接触式的土壤测温仪器,它通过红外线测量温度,这种设备价格昂贵。第三种,通过数字温度计测量温度。目前,这类仪器不仅可测量一点的土壤温度,还可将数据进行存储与传输。
总之,上述设备因为价格过于昂贵或功能过于简单,而得不到广泛应用。因此,一种价格更廉价,更能更强大的仪器需要去开发设计。
2.设计与原理
本设计运用高品质单片机C8051F310作为核心控制器,它主要包括以下功能模块,如数据采集模块、显示与存储模块、时钟模块、串行通信模块、键控控制块及电源模块。如图1所示系统组成及如何工作。
电源管理
传感器 1
MCU
C8051
F310
键盘及LCD显示
··· ···
存储记忆模块
传感器 10 时钟模块
RS232串行接口
计算机
图 1 系统框图
该系统可在不同深度测量10点的土壤温度,在采集数据的同时,并将温度及时间 1
数据予以显示之后,系统通过串行通信接口将数据传送到计算机。用户可以通过按键设置系统参数及运行系统。经过试验,这种效率高成本低的便携式的仪器能平稳工作且运行良好。
2.1硬件设计
在硬件设计中,系统可利用的部分包括C8051F310单片机、DS18B20数字温度传感器、ISL6292可编程锂电池充电管理芯片、NCP500电压管理芯片以及DS1302时钟芯片,它们通过相应的外围电路连接在一起,同时这几部分是系统的核心结构。下面就介绍这些核心部分及其外围电路。
2.1.1高质量C8051F310单片机
C8051F310是一款兼容8051指令集的完全集成的混合信号ISP型MCU芯片。C8051F310主要由CIP-51内核、外围模拟电路、数字I/O口及电源模块组成。其中,CIP-51内核采用一种管线式结构,因此它大大增加其指令吞吐量,其最大时钟频率为25MHz,峰值为25MIPS。为我们所熟知的是它的CIP-51内核支持包括8052标准的所有外围设备。其数字数据交叉开关允许将内部数字系统资源的影像传送到I/O端口,并且C8051F310单片机总共有29个I/O端口。
2.1.2 DS18B20数字温度传感器
DS18B20数字温度传感器可测量温度范围为-55°C ~ +125°C。DS18B20共有3个引脚,分别为数据I/O口DQ、电源引脚VCC以及接地引脚GND。如图2所示,DS18B20的工作电路。
因为每一个DS18B20都具有一个唯一的芯片序列号,所以多个DS18B20可以连接在同一条数据总线上。这就使得不同的温度传感器放置在不同位置,同时为系统的硬件设计提供方便。
图2 DS18B20工作电路
本系统利用10个DS18B20数字温度传感器,去测量位于地下50厘米内的10个不 2
同位置的土壤温度。第一个DS18B20与第二个公用一条总线,第三个与第四个共享一条,剩余的DS18B20直接通过自身的总线接口连接在一起。因为系统用于太多的DS18B20传感器,因此需要接外部电源。通过DS18B20采集到的数据要经过一个0.1μF的电容过滤,使得单片机的I/O口与电路接口连接在一起。
2.1.3电源与充电电路
整个系统被包装在一个密封的盒子里,因此它需要充电的锂电池,而不至于频繁的打开盒子去更换电源。
ISL6292是一种单节锂离子或锂聚合物电池充电器 ,它能提供系统运行的最低输入电压2.4V。ISL6292也可用作传统的线性充电器。
因为锂电池输出电压范围在2.8V与4.2V之间,而系统需要工作在3V的稳定电压,因此需要利用NCP500电压管理芯片去提供系统稳定电压。如图3所示,NCP500的工作电路,其中VIN接口与锂电池的输出端连接在一起,AIN0接口与C8051F310单片机模拟接口相连,通过A/D转换获得锂电压的数字值。
图3 NCP500工作电路
2.2 软件设计
本设计利用KEIL C软件进行单片机C语言编程与调试。
2.2.1主程序
为了能过实现系统的功能,主程序结构设计如下所示。
当系统启动后,系统进行初始化设置,接着程序进入一个循环,首先检测电压源,接着C8051F310单片机读取来自DS18B20数字温度传感器以及DS1302时钟的数据,接着进行数据的显示与存储,之后主程序检测中断是否开启,如果中断开启,程序进入中断服务程序;如果中断未开启,程序进入下一个循环。
2.2.2中断子程序
中断子程序位于主程序最后,当主程序判读中断标志位为真时,将执行中断子程序。
3
键盘中断服务程序能帮助用户通过按动在仪器上的按键启动中断服务,以此来设定系统的初始值。键盘中断服务程序的结构与串行通信中断程序十分相似,因此下面作详细说明。
本仪器与计算机通过RS232串行通信接口相连。根据通信协议,每一中断被分配一个唯一的机器码。当仪器接收到来自计算机的中断时,首先程序将来自外部中断的机器码与自身的机器码作比较,如果机器码相符合,则仪器对中断做出相应反应。图4显示了串行通信中断服务程序。
中断服务程序入口
判断中断符号
N
接收到缓冲区
检测装置序号
N
中断响应
Y
Y
调整时间 发送数据 清楚记忆 设置测量间隔时间
执行标志位
Y
响应正确
N
响应错误
退 出
图 4 串行通信中断流程图
3. 结果与讨论
本系统主要用于测量土壤温度,其综合功能主要有显示、存储和传输。用户可以通过RS232串行通信接口将本仪器与计算机相连,因此可以将仪器所测的时间与温度数据传送带计算机。本系统较之前的仪器功能有很大改善与提高。首先,本系统可以进行多点土壤温度测量,因此温度数据十分充足。其次,本系统采用充电锂电池供电,很大程度上延长仪器的使用范围。最重要的是,在本系统的硬件与软件的设计过程中,很大程 4
度上考虑其低功率消费。总而言之,这是一款效率高成本低的、便携的、精密的新型土壤温度测量仪器。
鸣谢
感谢北京科技计划对本项目(编号:Z1)的支持。
5
The design of the soil temperature measurement
uction
The temperature of soil is a vital environmental factor, which directly influences the
activity of microorganisms and the decomposition of organic substances. It can affect roots
absorbing water and mineral elements. It also plays an important role in the growth rate and
range of roots. Statistically, roots of most plants are within 50 centimeters underground, so it
becomes very significant to measure the soil temperature of different depth in this level.
The Soil Temperature Measuring Instruments used nowadays mainly fall into three types,
the first type is the measure temperature by making use of the relationship between the soil
temperature and the temperature-sensitive resistor. Before using this sort of instruments, the
system parameters need to be adjusted; it is inconvenient to repair when the system runs into
trouble. The second type is non-contact Soil Temperature Measuring Instrument which use
infrared ray to measure temperature, this sort of instruments is quite expensive. The third type
is instrument measure temperature by making use of digital thermometer, at the present time,
this sort of instruments can only measure one point of soil temperature, and the data can not
be stored or transmitted.
In all, the products mentioned above can hardly become popular for they are either
costly too expensive or functionally too simple. So a new kind of cheaper and more advanced
instrument is required to be invented.
als And Method
This system applies the high quality Single Chip C8051F310 as the core controller, it
mainly includes some functional blocks such as Data Collection Block, Display and Storage
Block,Real Clock Block, Serial Communication Block, Keying Control Block and Power
Source Block. Fig. 1 shows what the system consists and how it functions。
The system can measure soil temperature of ten points in different depth, it can display
and store both the data of temperature and the time, at which the data is collected, after that, it
can transmit the data to the computer through serial communication port. The user can set
system parameter or operate the system by pressing keys. By experiment, this cost-effective
and portable instrument works stably and operates well.
6
Fig. 1 System block diagram
2.1 Hardware design
In the hardware design, the system utilizes parts including MCUC8051F310, Digital
Thermometer DS18B20s, power charge Chip ISL6292, voltage management Chip NCP500
and real-clock Chip DS1302, combining with corresponding peripheral circuits, and these
parts make the main structure of the system. Some of the main parts and its peripheral circuits
will be introduced as follows.
2.1.1 High quality MCU C8051F310
C8051F310 device is fully integrated mixed-signal system-on-a-chip MCU, whose
microcontroller is compatible with 8051 instruction set. C8051F310 mainly composes of
microcontroller core CIP-51, analog peripherals, digital I/Os and the power unit. The CIP-51
core employs a pipelined architecture that greatly increases its instruction throughput, with a
maximum system clock at 25MHZ, it has a peak throughout of 25MIPS. The CIP-51 core
offers all the peripherals included with a standard 8052, which is familiar to Chinese
technologists. The Digital Crossbar allows mapping of internal digital system resources to
Port I/O pins; C8051F310 device includes a total of 29 I/O pins.
2.1.2 The DS18B20 digital thermometer
The DS18B20 Digital Thermometer(He Xicai 2001;Chen Liangguang 2001 ).measures
temperatures from -55℃ to +125℃.
7
DS18B20 includes three pins, respectively are data I/O PinDQ ,power supply Pin VDD and
the GND Pin.2 shows the DS18B20 application chart.
Because each DS18B20 contains a unique silicon serial number, multipleDS18B20s can
exist on the same 1-Wire bus. This allows for placing temperature sensors in many different
places and provides convenience for the hardware design in this system.
Fig. 2. Application chart of DS18B20
This system utilizes ten DS18B20s to measure temperature of ten points soil in
different depth within 50 centimeters. The first DS18B20 and the second share a 1-Wire bus,
the third and the fourth share one, the other six DS18B20s communicate through their own
1-Wire bus respectively. The system applies external power source, as there are too many
DS18B20s. The data collected by DS18B20s is filtered by a 0.1uF capacitor, and then lead to
the I/O port of MCU by interface circuits.
2.1.3 Power source and recharge circuits
The whole system is contained in a sealed box; it employs a rechargeable lithium
battery so as not to open the box frequently.
The ISL6292 is an integrated single-cell Li-ion or Li- polymer Battery Charger, which
is capable of operating with an input voltage as low as 2.4V. The ISL6292 can be used as a
traditional linear charger.
For the output voltage of lithium battery ranges from 2.8V to 4.2V, and the system
works at a constant voltage of 3V, so it utilizes a voltage variation chip NCP500 to supply the
system with a stable voltage. Fig. 3 shows the application chart of NCP500, the Pin VIN
connects to the output of lithium battery ; Pin AIN0 outputs to an analog pin of C8051F310,
8
the digital value of lithium voltage can be acquired after a A/D conversion.
Fig. 3. Application chart of NCP500
2.2 Software design
The MCU program written in C Language was assembled and debugged in Keil C
Assembler (Ma Zhongmei et al. 1998).
2.2.1 The main program
In order to realize its functions, the structure of the main program is
designed as follow. When the system is powered on, the system starts initialization, then the
program runs into a circle, firstly it check the source voltage, secondly the MCU reads data
from DS18B20s and real clock DS1302, thirdly the data is displayed and stored, after that, the
main program check whether the interruption flag is set or not, if it equals one, the program
runs into the part of interruption program, if not, the main program runs into another circle.
2.2.2 The interruption sub-programs
The interruption sub-programs are at the end of the main program, when the main
program discovers the interruption flag true, it will runs into the interruption sub-programs.
The Key-Interruption helps to set the system parameters by pressing keys on the box to
intrigue the interruption program. The structure of Key-Interruption Sub-Program is somehow
similar to the Serial Communication Interruption Sub-Program, so only the later is described
in detail.
9
Fig. 4. Flow chart of serial communication interruption
The instrument and the computer are connected via RS-232 SerialCommunication Port.
According to the communication protocol, every instrument is assigned a unique machine
number. When the instrument receives instructions from the computer, the program first
compare its own machine number with the machine number sampled from the instructions,
if the machine number is matched, the instrument then respond to the instructions. Fig. 5
shows the flow chart of Serial Communication Interruption Program.
s And Discussion
Combining with functions such as display, storage and transmission, this system is
mainly used in measuring soil temperature. User can connect this instrument to computer via
RS-232 Serial Port, through which the data of temperature and time can be transmitted to the
PC. It makes a lot of improvements as well as makes full use of the previous products. First,
this instrument is capable of obtaining temperature of multipoint soil, so the temperature
data is adequate. Second, this system employs rechargeable lithium battery, which largely
prolongs the span of the rmore, in the process of hardware and software
10
design, low power consumption was always taken into consideration. In a word, this
instrument is cost-effective, portable and precise.
Acknowledgments
This work is funded by the project for Beijing Science and Technology Plan (Contract
Number: Z1).
11
版权声明:本文标题:温度监测中英文翻译 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.freenas.com.cn/free/1704342149h455551.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论