The Data Acquisition
project was an attempt to build a "smart sensor" that could be controlled
from a PC to measure, store and transmit analogue measurements captured
over a period of time. As well as being a useful unit by itself, it was
intended to form a pilot for investigating standard ways of communication of control and data.
At the time the project was developed there didn't appear to be
anything suitable for a small scale project, so a customised
communications protocol was developed as an interim. The situation
wasn't that bad however, just that suitable protocol standards weren't
as visible as they are today.
The requirements of a useful standard protocol are considered as follows:
Able to be used over a number of physical layer bases adapted to small microcontroller systems.
Having a reliable datalink protocol.
Providing a standard means of communicating calibration and control information, and retrieving results.
Optionally having a real-time, or bounded delay, aspect.
Acquisition project provides a frame based communication (datalink
layer) over a point-to-point serial link with a set of commands for
control and calibration that is specific to the application. Thus it
provides practically no satisfaction of the above requirements, apart
from actually working.
Smart Sensor Standards
There are in
fact a large number of protocols available, the great majority of which
either specify a restricted physical layer, or are oriented to very
specific application areas. Two standards have been found that could be
suitable. These address application layer issues and leave the datalink
and physical layer to be open for the most part.
This standard defines a smart transducer protocol in terms of message
formats, functions, and data structures. Like many IEEE standards it is
not particularly open, although the standards documents are available
at a reasonable fee. It is aimed mainly at larger systems and defines a
hierarchy of transducer controllers and network controllers. It's not
clear how well it could be applied to a smaller system, although that
is quite possible in a cut-down form. There is no information about how
widely this protocol is being used. There is an opensource project open1451 which has not been maintained for some years and appears to be web-based client side only.
This standard again defines a smart transducer protocol, but appears to
be well suited to small systems. It is reported to be widely used in
Europe, being perhaps the most widely used. The standards are freely
available and there are at least two opensource projects active,
CANFestival and CANopenNode, with code ported to a number of OS's and
microcontrollers. As the name suggests it is intended to be used with
CAN networks but in fact can be used over a variety of small networks
such as serial and encapsulated over TCP.
- MODBUS is a very old standard which defines message formats and data structures, but its origin in PLC applications leaves it very limited, particularly for large data structures. There is at least one opensource project active, FreeMODBUS, with code ported to a number of OS's and microcontrollers.
Thus it seems that CANopen would be an eminently suitable protocol suite.
Physical and Datalink Layer Protocols
Physical and datalink layer systems that are widely used in modern microcontroller systems are:
- RS232 point-to-point.
- USB point-to-point.
- RS485 multidrop
- CAN shared contention bus
- Ethernet shared contention bus (a bounded delay version is called "Powerlink").
- I2C short distance shared contention bus
Point-to-point systems can be used with CANopen in a polled arrangement as a variation.