Sunteți pe pagina 1din 4

2010 International Conference on Measuring Technology and Mechatronics Automation

Design of Automatic Meteorological Data Acquisition System


Based on ARM and CAN Bus
Jvfang Jin1 Baoqiang Wang2
Department of Electrical Engineering Department of Electrical Engineering
Chengdu University of Information Technology Chengdu University of Information Technology
Chengdu, China Chengdu, China
jin_jv_fang@163.com bqwang@cuit.edu.cn

Abstract—Aimed at the current situation that the domestic expansion, improving the timeliness and accuracy of the
automatic meteorological data acquisition system is almost based meteorological observation, and achieving the commands of
the use of foreign products, a design method of multi-channel automatic meteorological observation.
meteorological data acquisition system was given which based on
ARM and CAN Bus. In the design, it fulfills the acquisition
requirements of the analog signals, digital signals and intelligent
II. SYSTEM DESIGN
sensor data through a combination of hardware and software As shown in Fig.1, the design of the automated
technologies. In order to improve system’s real-time answering meteorological data acquisition system is based on the
capability and multi-task processing capability, it is used “main embedded Linux and the CAN bus.
collector + external bus + sub-collector + sensors + peripheral
equipment” in structure design of hardware. At the same time, it
is transplanted Linux operating system to improve the reliability
and scalability of system. It is translated Linux operating system
to embedded processor, and making use of Internet to send
meteorological data in Linux operating system. Then the
complicated cabling project could be omitted, the data were sent
without PC, and in favor of constituting Large-scale
meteorological monitoring network. (Abstract)

Keywords—Data acquisition; Embedded Linux; CAN bus;


Driver(key words)

I. INTRODUCTION Figure.1 Automatic Meteorological Data Acquisition System


Nowadays meteorology has been closely related to the
human civil and industrial activities. Meteorological detection Embedded Linux is a kind of small operating system,
plays an important role in defense, social and economic which is composed by a cut-off core (kernel) and several
development. With the gradual implement of national modules that depended on the needs. Its characteristics are as
sustainable development strategies, meteorology detection is follows, micro-kernel of only several hundred KB; supporting
more and more important for us. Meanwhile, there are ever- X86 and more than 30 kinds of 8bit ~ 64 bit of the MPU and
increasing demands for meteorological observations. The MCU, supporting a variety of ROM memory; the features of
traditional design pattern of meteorological data acquisition multi-tasking, multi-process and a certain degree of real-time;
system was based on the single-chip microcomputer. In this supporting completed communications network; supporting
situation, there are many problem including system precision, TCP / IP protocol and other common agreement; supporting
real-time analysis capabilities, the man-machine interface and self-developed agreement; a graphical user interface (GUI);
so on.Computing power, storage capacity and the amount of supporting network, database and multimedia and
information were limited by this technica. In the same time, communicating data by the network and processing data in real
both the distance of data transmission and the use of data time; source opened which can be cut according to specific
acquisition module with PC or notebook computer cost too needs; a series of development tools;a good property of
much money and time. Compared with the situations above, software open and the program on the Linux host can be
the pattern of using embedded LINUX system assumes a transplanted to embedded Linux system freely, a strong
higher real-time and stability in meteorological data technical support and so on.
acquisition, meanwhile the hardware smaller, power CAN (controller area network) field bus is a kind of serial
consumption lower and expansibility better. multi-master communication network. CAN is not only a
The Linux operating system supports the TCP / IP protocol, network, but also a kind of protocol. Its main features are as
so it can transmit data directly without PC. This pattern also follows, the pattern based on the CSMA / CD-CR model, the
has many other advantages, such as speeding up the use of non-destructive arbitration mechanism, short-frame data
development of the system, facilitating the works of the future structure; the CRC data check function, the data transmission

978-0-7695-3962-1/10 $26.00 © 2010 IEEE 989


DOI 10.1109/ICMTMA.2010.598
based on the differential approach, queue priority according to
message ID, the system well expansibility, anti-interference
ability and reliability.
The automatic meteorological data acquisition system which
is based on the multi-tasking, real-time embedded Linux OS
and the CAN network constitutes a building-block structure,
facilitating future updates or changes.

A. System Hardware Design


As shown in Fig.1 above, automatic meteorological data
acquisition system’s hardware consists of main collector, sub-
collector, sensors and peripheral equipment (including power
supply, [terminal] computer, communications interface and Figure.3 Sub-collector Structure of Automatic Meteorological Data
Acquisition System
external memory). The main collector and sub-collector
microprocessor adopt an ATMEL chip — AT91SAM9263 When the system is needed of being expanded or increasing
which based on the ARM926EJ-S processor. Its frequency is element sensors as the change of environment or technology
up to 200MHz and it has a CAN bus controller integrated in progress, we have no need to change the connection of the
chip. Sub-collector is hang on to the main collector through existing sensors and wiring. We just need to add new sub-
CAN bus. collector and /or sensors to the system and conduct simple
In order to achieve the minimum allocation of automatic software upgrade or configuration.
meteorological data acquisition system, the main collector is
joined only several basic meteorological elements sensors, B. System Software Design
taking charge of the collection of the basic meteorological data System software includes embedded operating system and
(Its structure is shown in Fig.2). application software. We have chosen a high real-time, cost-
effective, stable and multi-tasking operating system—LINUX
OS as the platform of the system software design according to
the needs of the design.

1) Construction of Embedded Linux System


The system software is mainly built in the main collector,
including three elements at least: bootstrap program, Linux
micro-kernel and initialization process. In addition, there are
several functions needed to be expanded, such as, the
achievement of the agreement to CAN master, the achievement
to jffs2 file system in the internal memory and external
memory card, the basic collection, processing, storage and
internet transmission of the data, the establishment of the Web
Figure.2 Main collector structure of automatic meteorological Data server and remote parameter settings, data monitoring, the
Acquisition System loading of data files and the main collector reset.
In addition, the main collector is in charge of collecting, Sub-collector software is needed to achieve the agreement
controlling, processing, storing, transmitting all kinds of to CAN slave, scans its articulated sensor according to the
meteorological factors’ data and fulfilling the function that predetermined sampling frequency and converts the electric
configures and manages the sub-collector. signal obtained into a readable microcontroller signal, gains
the sequence of measurements of meteorological variables,
The sub-collector is composed of hardware and embedded converts the measurements of meteorological variables ,
software. In order to simplify the design trouble of the system, changes the sensor output signal into meteorological units,
sub-collector microprocessor also adopts the same chip — gets the instantaneous sampling values, and sampling values
AT91SAM9263.It is mainly responsible for collecting will be sent to the CAN bus according to CAN agreement.
corresponding meteorological data.
At the same time, it is also responsible for scanning its 2) Reduction and Compilation of the Kernel
articulated sensor according to the predetermined sampling Micro-computer's storage space is small, while the standard
frequency in the working condition and sending the sampling Linux is a PC OS, which needs to reduce the Linux kernel. It
data to the main collector after receiving the synchronization can only retain some modules that the embedded system needs
signal which is sent by the main collector. Its structure is and must remove some useless modules when compiling the
shown in Fig.3, kernel. In order to satisfy a certain degree of real-time
requirements, it should shield the kernel’s virtual memory
management mechanisms. There are two ways to launching

990
Linux, one is that drivers were directly compiled into the For the Character and Block Devices, Linux kernel have
kernel; the other is that drivers were loaded at runtime (that is, been conducted an unified abstraction on their file
kernel module). The advantages of the former are that users operations, such as open, close, read, write, ioctl, poll,
can call them at any time without installing them, but it largely mmap and so on, which are embodied in the structure
costs storage space. The latter is that drivers were prepared in file_operations included in the fs.h document.
the form of module, and they will be loaded into kernel when
needed. Maybe it would increase the occupation of system struct file_operations{Struct module*owner;
resources and running time, but it is negligible compared to the // Module owner
huge consumption of kernel resources. Meanwhile, this way loff_t(*llseek) (struct file*,loff_t,int);
can provide many conveniences for the software development. // file-moved pointer, only be used for
When the users need to modify a hardware driver or correct random access devices
their errors, they can dynamically unload the old version and ssize_t(*write)(struct file*,const char*,size_t,loff_t*);
load the new version; but if the driver has been wrote into the //Write data to the characters device
kernel, the users must recompile the kernel and restart the ssize_t(*read)(struct file*,char*,size_t,loff_t*);
system when testing procedures after each revise. Therefore, //Read data from the device, similar to write
the system is chosen the second approach to start the kernel.
unsigned int(*poll)(struct file*,struct poll_table_struct*);
3) Device Drivers //Query the state of equipment
Operating system is responsible for managing software and int(*ioctl)(struct inode*,struct file*,unsigned int,unsigned
hardware of the system. Device drivers play the role as a bridge long);
between the hardware and user application program. They //control equipment, commands except
make the application program have nothing to do with the reading and writing
underlying hardware through interface function provided by int(*mmap)(struct file*,struct vm_area_struct*);
them. For the system, we need to prepare drives for I/O port, //Map the content of the equipment to
serial and CAN controller.
address space
There are three types of equipment in Linux system, int(*lock)(struct file*,int,struct file_lock*);
Character Devices, Block Devices and Network Equipment. //File locking for mutually exclusive
Character devices can only be read and write data
visit when file is sharing
sequentially, and provide byte-stream operation to the
external. Block devices can be read and write data randomly. Int(*open)(struct inode*,struct file*);
All these three types of equipments have a rough same // Open the device and perform I/O operation
structure of the drivers. int(*release)(struct inode*,struct file*);
a) The structure of device drivers //Shut down equipment and release the resources
};
In Linux system, the equipment is generally mapped to a
special device file. The user can freely perform any operation
on it like an ordinary file. Each device is treated as a file in Seen from the definition of the structure file_operations
Linux so that the application program can use system calls, above, all of its members are function pointers. So in essence,
such as read and write, to operate it as an ordinary file. The the core of function jump table visits the driver by this
structure of the Linux device drivers is shown in Fig.4. structure.
The structure used in the procedure is as follows:
static struct file_operations test_fops=
{
owner:THIS_MODULE,
write:test_write,
read:test_read,
ioctl:test_ioctl,
open:test_open,
release:test_release,
};
In the Linux kernel, it uses the macros module_init () and
module_exit to initialize the driver module and record the
name of function that had quitted, the template of driver is as
follows,

Figure.4 Structure of Linux Device Driver #include<linux/module.h>


#include<linux/config.h>
#include<linux/init.h>
b) The template of drivers Static int__init name_of_initialization_routine(void)

991
{ time of meteorological detection, high precision, high degree
/* Driver initialization and operational definition */ of automation, cost-effective, a long-time and continuous
observations, good reliability, high stability, anti-jamming,
} etc.
Static void__exit name_of_cleanup_routine(void)
{
/*The handling operations after the ending of the driver*/
}
module_init(name_of_initialization_routine);
module_exit(name_of_cleanup_routine);
The drivers of the meteorological data acquisition system
can be prepared according to the driver template supplied
above. Drivers that should mainly include CAN bus driver,
clock driver, serial driver and some hardware drivers. They
can be loaded when the system starts at boot time by the
kernel module after they were completed and compiled
successfully. Then, user application program can directly Figure.5 Implementation flow chart of system
manage and configure the software and hardware of the
Automatic Meteorological Data Acquisition System according ACKNOWLEDGMENT
to document.
The authors of the paper are grateful to Chengdu University
4)Application software of Information Technology.
Application software mainly includes system data quality
control software, data processing software and Web browser REFERENCES
interface. The data quality control software of the system
pretreats the data that collected, removes the unreasonable [1] Z.L.Ao, “The Design and Implementation of Automatic Meteorological
data. Then the data obtained is transmitted to data processing Data Acquisition System Based on CAN Bus.” Computer
Measurement and Control, pp.491-498,2006.
software for processing, forming the specified data format. A
[2] Z. K. Hu and J.Q. Li, “Design of Automatic Meteorological Data
data browse page for the users will be provided by Web Acquisition System Based on Embedded Linux”. Electronics Engineers,
browser. Users can modify, add and delete the data through Vol. 30, No. 2, pp. 69-71, 2004.
the browse page. At the same time, users can achieve the [3] Z. K. Hu and J.Q. Li, “Design of Automatic Meteorological Data
function of data query and data retrieval. The implementation Acquisition System Based on Embedded Linux”. Electronics Engineers,
of the system is shown right in Fig.5. Vol. 30, No. 2, pp. 69-71, 2004.
[4] Z. B. Shu, et al, “Field Bus Motion Control System”. Publishing House
of Electronics Industry, 2006.
III. CONCLUSION
[5] Z. J. Li, “Field Bus and its Applications Technology”. Machinery
The system, whose design is based on Embedded Linux and Industry Press, pp.495, 2005.
CAN bus architecture, has a building-block structure and [6] Zhou Yu, et al, “The Design and Implementation of driver of CAN bus
intelligent function modules. In terms of software design, it based on Embedded Linux”. Computers and automation technology,
supports any combination of system’s function modules. So, Vol. 34, No. 8, pp. 50-52, 2008.
there is no need to change the original hardware and software [7] Peng Yu, “Embedded Data Acquisition System Based Linux”,
Technology Center.
design, just to add new sub-collector and/or sensors to the
system and conduct simple software upgrade/configuration.
The advantages of such a design are as follows, a higher real-

992

S-ar putea să vă placă și