Microcontroller-Based Data Acquisition Device For Process Control and Monitoring Applications
Microcontroller-Based Data Acquisition Device For Process Control and Monitoring Applications
net/publication/221909504
CITATIONS READS
2 5,628
3 authors:
Jan Dolinay
Tomas Bata University in Zlín
43 PUBLICATIONS 133 CITATIONS
SEE PROFILE
All content following this page was uploaded by Jan Dolinay on 25 June 2014.
1. Introduction
Process measurement is one of the most important tasks in the whole control system. It is
determined by the fact that control accuracy is fully dependent on how preciously
measuring chain works. Present-day there is available number of devices performing data
acquisition tasks – standard cards for PCI or ISA bus which are suitable for standard
personal computers and its industrial versions and modules for industrial automation
usually equipped with RS485, CAN and other interfaces. Independent category is formed by
smart sensors incorporating sensor, converter to unified signal and data acquisition device
in one embedded system with very compact dimensions and low power consumption. They
have number of advantageous features such as automatic diagnostic and calibration, high
accuracy and immunity against electromagnetic interference due to short signal paths. On
the other hand lower operating temperature range reduces their usage to laboratory
applications, automotive and aircraft industry where compact dimensions and low weight
are crucial. Quite often occurred situations when it is necessary to measure data in terrain
where it is not possible to use standard computer equipped with DAQ card. In these cases
laptop computer equipped with portable data acquisition device may be very advantageous.
On the market are available devices equipped with USB 2.0 connectivity which can fully
functionally substitute PCI cards. But they are not able to work without connected computer
which must continually control all DAQ operations. Therefore it is not possible to use them
in applications where is required long-term monitoring and archiving process quantities in
distant areas without access to mains power.
This contribution proposes design of multi-channel portable data acquisition device based
on low cost general-purpose 8-bit microcontroller Freescale 68HC908GP32, which was
developed in our department mainly for control and monitoring educational laboratory
models. First part deals with hardware design of the DAQ device with focus on description
of operation of individual functional blocks. After that follows description of internal
software (firmware) based on real-time operating system RTMON for HC08, which was
developed on our department especially for microcontroller-based embedded systems with
CPU08 main processor core. Next chapters discuss DAQ device software support in form of
program libraries for MS Visual C++, Control Web and Matlab/Simulink development
environments, which can significantly improve development time of new process control or
128 Data Acquisition
monitoring applications. And finally last part deals with verification of the developed DAQ
device with control of selected laboratory model.
8x digital
I/O
driver 8x digital inputs
Analog multiplexer + A/D
.
.
.
MCU D/A +
16x analog 1x analog output
circuits amplifier
inputs
.
.
. Serial RS232 RX
communications
RS232 TX
interface
9V DC input
Power supply circuits
manufacturer’s recommended wiring enabling correct operation with input voltage down to
5.5 V. Input of the supply is protected against overloading or polarity reversing by fast
acting fuse. Analog-to-digital converter is supplied from high-precision voltage reference
LM336-Z5.0 which is connected to adjustable current source LM334. Output voltage can be
adjusted to the exact 5 V value by variable resistor R18 (Fig.6). Analog output amplifier is
supplied by DC-DC converter ICL7662 providing positive and negative voltages for analog
output operational amplifier from single supply.
RTMON
Process 1 SCI
System initialization
Read received
Process 2 character from SCI
Command processing and write it to buffer.
Process 3
PWM modulation Return
Process 4
Communication
- stop process
- delay process
- continue process execution
- abort (delete) process
For queues there are the following functions:
- create queue (specify size)
- write to a queue with/without waiting
- read from a queue with/without waiting
There are also two functions for controlling the RTMON core:
- initialize RTMON
- end RTMON operation
The RTMON system is used as a precompiled library accompanied by a header file. This
simplifies the organization of the project and the build process. User enables RTMON usage
in his program by including the header file (rtmon.h) in his source and adding the library to
his project.
After it is the first command parameter with length of one character (channel index) next
character is space followed by second parameter (value). Command must be terminated by
CRLF sequence.
Command: ~ A O 0 _ 4 . 2 5 CR LF
Response: ~ A O 0 = 4 . 2 5 CR LF
4. Software support
Although communication protocol is very simple and easy to understand it is more
comfortable in a control application to call functions which can automatically generate
commands for the data acquisition device and consequently process its response.
Application developer then does not need to know exact communication protocol and do
not need to program it. This simplification results in faster program development and
reduction of debugging time. For the portable data acquisition device there were created
supporting program libraries for Visual C++, Control Web 5 and Matlab 6.5 (and higher
versions with serial port object support) software environments.
Function Description
next sub trees. Another type of the object in Control Web is data element. Each data element
represents location in system memory, which can save value of the measured quantity, for
example (Moravian Instruments, 2005).
Control Web is in standard installation equipped with several drivers which can be divided
to two main categories – for demonstration and testing purposes (Virtual Driver, Model
driver, Simulation Driver, Simulating Driver) and general drivers for use in real applications
(DDE Client Driver, ASCDRV5 driver, TCP/IP driver). Device driver is independent
component in a form of dynamically linked library with standardized interface. During
development of the Control Web system gradually originated three versions of the interface.
Basic interface was defined for Control Web version 3 and must be implemented in every
driver. Newer interface version 4 was created with Control Web 2000 and finally newest
version 5 was defined for Control Web 5. Backward compatibility is guaranteed by
implementation of the basic interface in all higher versions of the interface.
Control Web communicates with driver using channels, which must be defined in the driver
map file (file with extension dmf). Each channel is defined by number, direction (input,
output) and data type (real, boolean, string, and others). Driver configuration is stored in the
parametric text file (extension par) containing specific information for correct driver
initialization. All parameters can be easily viewed and modified using “Driver inspector”.
On the basis of requirements of the driver interface version 3 a device driver for portable
data acquisition device was created. It supports all available hardware functions – there are
16 input real channels, 8 boolean input and output channels and one real output channel.
For verification of the correct function of the driver and DAQ device test application was
created. It enables to manually set output channels and in 500 ms period reads all input
channels. Main window of the test application is in Fig.13.
T2
3
T3
2
T1
5 4
Fig. 16. Heating plant model control application for Control Web 5
After the program is executed by writing command “hmodel” in the command window of
the Matlab 6.5 environment the main window depicted in the Fig.17 will appear. The
window is divided into two parts – upper part is dedicated to displaying all measured
system variables in the form of auto-scale graph.
Fig. 17. Heating plant model control application for Matlab 6.5
Microcontroller-based Data Acquisition Device for Process Control and Monitoring Applications 143
Below the graph is situated block of buttons for selecting desired program action. These are
divided into three categories depending on their function. Buttons with blue labels are used
to startup program module which is performing each measurement – for example button
“STEP” will initiate measurement of the step response. Green labeled buttons are intended
to setup each program module. Button “STOP” interrupts current measurement with saving
all measured data to file and workspace as well. Reaction to the stop command is not
instantaneous – it can take up to one sampling period of the current measurement. When
ALT+F4 key combination or close button is pressed during measurement, all actuating
signals are immediately reset and application is closed without data saving.
Pressing “EXIT” button will close the program with resetting all actuating signals to zero
values. During measurement all buttons except “STOP” button are disabled in order to
prevent unwanted interference to the running experiment.
All measurements during program verification were passed in the following conditions:
distilled water as heat transfer medium, pump speed at minimum (maximum time delay),
fan 1 on, fan 2 at minimum speed and channel index was set to 2 (temperature before heat
exchanger). Step response of the time delay model is depicted in Fig.18. It was measured
with actuating signal change from 10 % to 60 % of the maximum value.
60
55
50
y [°C], u [%]
45
40
35
30
y2
25
u
20
0 500 1000 1500 2000 2500 3000
t [s]
was chosen for 5% relative overshoot of the controlled variable. Final PS controller
parameters for sampling period of 10 s are: q0 = 1.15, q1 = -1.11.
35
30
25
20
y [°C]
y_nam
15 y_aprox
10
0
0 500 1000 1500 2000 2500 3000
t [s]
Fig. 19. Step response approximation with first order transfer function with time-delay
90
80
70
y [°C], w [°C], u [%], v[%]
60
y2
50 u
40 w
v
30
20
10
0
0 2000 4000 6000 8000 10000 12000
t [s]
k 0.646
G (s) = ⋅ e −TD s = ⋅ e −200 s (1)
Ts + 1 290s + 1
Resulting control process achieved with PS controller with set point values set to 50 ºC at
time 0 s and 70 ºC at time 4000 s is in Fig.20.
6. Conclusion
The contribution deals with portable data acquisition unit which was developed at our
department for control and monitoring related tasks. The device is designed with respect to
possible battery operation enabling measurement in areas where power source is not
available. It provides sixteen analog inputs with 12-bit A/D conversion resolution with
input voltage range 0 – 10 V, eight TTL compatible digital inputs and outputs protected
against electrostatic discharge and overloading and one analog output channel equipped
with 12-bit D/A converter with output amplifier providing standard voltage output 0 – 10V.
Communication with supervision system is realized via standard RS232 asynchronous serial
interface which makes DAQ device fully platform independent. It uses universal ASCII-
based communication protocol which can be easily successfully implemented in many
control and monitoring software environments.
In order to improve development of new software applications with this device a support
program libraries for Matlab/Simulink, Visual C++ and Control Web 5 were created. For
research and educational purposes control software with graphical user interface running in
Matlab 6.5 environment was developed. It supports step response measurement of the
system, control of the selected controlled variable using PS, PSD and general linear
controller with disturbance introduction possibility.
7. Acknowledgments
The work was performed with financial support of research project MSM7088352102. This
support is very gratefully acknowledged.
8. References
Burr-Brown. (1998). DAC7611: 12-Bit Serial Input Digital-to-Analog Converter [online]. 1st
edition. Tucson : Burr-Brown, [cit. 2010-01-10]. Available from WWW: <http://
www.burr-brown.com/>.
Freescale. (2008). M68HC08 Microcontrollers: MC68HC908GP32 Data Sheet [online]. 1st
edition. Chandler : Freescale Semiconductor, [cit. 2010-01-22]. Available from
WWW: < http://www.freescale.com/>.
Freescale. (2006). M68HC08 Microcontrollers: CPU08 Central Processor Unit Reference Manual
[online]. 1st edition. Chandler: Freescale Semiconductor, [cit. 2010-01-20]. Available
from WWW: < http://www.freescale.com/>.
Linear Technology. (1994). LTC1286/LTC1298 Micropower Sampling 12-Bit A/D Converters
[online]. 1st edition. Milpitas: Linear Technology Corporation, [cit. 2010-01-10].
Available from WWW: < http://www.linear.com/>.
146 Data Acquisition
Moravian Instruments. (2005). Control Web 5 software documentation [online]. 1st edition. Zlín:
Moravian Instruments, [cit. 2010-01-15]. Available from WWW: < http://
www.mii.cz/>.
Vítečková M. (2000). Controller tunning by method of inverse dynamics. Ostrava: VŠB –
Technical University of Ostrava, 56p. ISBN 80-7078-628-0.