News Archive (1999-2012) | 2013-current at LinuxGizmos | Current Tech News Portal |    About   

Article: Tux gets his feathers dirty in the “real world”

Aug 14, 2001 — by Rick Lehrbaum — from the LinuxDevices Archive — views

Embedded Linux in the Physical World

The use of embedded Linux is growing in the industrial automation industry, making the control and monitoring of machinery no longer the exclusive domain of proprietary systems. Also driving this growth is the need to gather information, often on the fly, from an ever increasing number of Ethernet- and Internet-aware devices.

Like the proprietary systems traditionally used for industrial automation, Linux-based systems can monitor and control any activity that they can sense and respond to. The programming logic behind an application that monitors power usage and turns off unneeded loads is obvious, but the methods of sensing the current flow and throwing the cut-off switch are not.

The industrial automation industry developed the “I/O unit” to provide a method through which computers may acquire or issue electrical commands. These electrical responses may emanate from sensors (electronic devices that measure the physical world) and be driven to effectors (devices that drive changes in our physical world). In short, the I/O unit's role provides a conversion between the computer and the physical world.

Ethernet I/O Unit

The figure below shows the components of Opto 22's Ethernet I/O Unit. The brain is the electronic kiosk of the unit. The unit accomodates multiple “I/O modules,” which are replaceable and interchangeable interface blocks that connect to the real world devices via analog, digital, or serial signals. The rack is the connection bus between the brain and the I/O modules, and is available in versions that support up to 16 I/O modules (4, 8, and 12 module versions are available). A single 5V DC power supply powers the entire I/O unit.


An Ethernet I/O Unit

The brain uses TCP/IP over 10/100 Mbps Ethernet to communicate with the client. TCP/IP is a de-facto communication standard in Linux. Ethernet is widely accepted in industry. Together, they're an excellent pair. Additionally, the IP routing capability permits the I/O unit to be located within a single network segment or across the globe. There is also a wireless LAN (802.11) version of the brain.

I/O Modules

I/O modules are grouped into several categories: digital input, digital output, analog input, analog output, and special function. An analog input I/O module is shown at the left.

Digital (or discrete) modules connect to on/off (switched) devices such as pressure-sensitive switches, lighting, and automotive “idiot” lights. Analog modules connect to devices that measure or control temperature, pressure, voltage, or current. Special function devices include RS-232/RS-485 serial ports for bar code readers, badge scanners, and keypads.

The rack permits all types of modules to coexist on the I/O unit (the exception being digital-only racks used for special applications).

All of the I/O modules provide electronic isolation between the field devices and the brain. Ethernet provides additional isolation as each end of the copper termination has isolation transformers. If needed, a copper-to-fiber transceiver or wireless unit provides even more isolation.

In short, a broad selection of I/O modules allows interfacing with virtually any physical device. There are the more traditional “voltage in/out” and current “in/out” modules. Additionally, there are special function modules that support RS-485 and RS-232 connections.

Controlling stuff

When data acquisition and control I/O system manufacturers adopted Ethernet, they brought the physical world to Linux. The result has been numerous new — and often innovative — implementations. For example . . .

  • Caring parents may operate a pan-and-tilt web camera and watch their child at play in their day care center.

  • A wine maker uses a cell phone to access an Internet-connected I/O unit to inspect cellar and fermentation tank temperatures.

  • A news studio relies on a PPP connection to an I/O unit to display a specific location's weather conditions while on the air.

  • System administrators use their wireless PDAs to inspect the server cluster power controls (the I/O unit serves as a last chance power/reset control).

  • A homeowner ensures the lights are off by inspecting the house's lighting status on a Web browser at work.

  • A security company is alerted of a break-in via a DSL-enabled alarm system.

  • Recent worries about electric power shortages and blackouts also open numerous opportunities for embedded Linux. With soaring energy prices, embedded Linux combined with extremely efficient processor architectures promotes energy management, energy reduction, and energy prediction by controlling and monitoring loads. There may also be applications that isolate loads, warn of black-outs, and disable unnecessary loads during peak demands.
All these applications need I/O units to provide the control and monitoring capability.

With dramatic cost reductions in high-speed Internet access, improvements in computer hardware, and the growth of royalty-free software, the home is becoming a target of this movement. The home thermostat will eventually grow to control the entire operations of a house.

But why wait for this when the capability is already here? A PDA is the right size, has a color LCD display, and contains a very respectable level of performance. Such a device with the appropriate I/O units could easily control lights, the audio system, the kitchen, the security sensors, the sprinklers, . . . , or the electronic pet.

Speaking the language of 1394

Opto 22's Ethernet I/O Unit uses an IEEE-1394 based protocol data model. It supports a TCP or UDP connection through port 2001.

The protocol relies on command functions based on a memory reference. This memory architecture allows variable data sizes to be read or written. This protocol promotes a very simple software implementation, sockets through Linux, and several binary data message routines.

The protocol relies on two standard data formats. The floating point format is 32-bit IEEE-754. The integers are standard two's complement types. The byte ordering is big endian. Most values are aligned at the 4-byte boundary due to the 32-bit data size.

The 1394 based data communication model has two basic access functions, a read and a write access to a memory map. 1394 has two types of reads and writes, a quadlet and a block function. The quadlet allows the read or write of a single 32-bit binary value. The block read and block write functions permit a variable number of bytes to be read or written. The quadlet functions are equivalent to the block functions (that read or write 4 byte quantities).

The read and write request message is a binary data packet. The header of the 1394 based protocol always includes a packet type code, a transaction label (a type of sequence ID), and the memory address to read from or write to. The read header includes the amount of data to return. The write header includes the amount of data. The data is appended immediately after the header.

The formats of the 1394 read/write request/response blocks are shown in the following illustrations (click each to view) . . .

Each read and write request has a response, which serves several purposes. The response ensures that the device received the packet and has processed the data. The response may also return an error indicating an out of range value or a functional alert. In a read response, the packet includes the binary data in big endian alignment.

Memory Map Regions

Here's a short list of Ethernet I/O's memory map regions. The other regions and details may be found in the references listed at the end of this article.

  • Configuring Points
  • Configuring Events
  • Defining Analog Scaling Values
  • Writing Output Points
  • Reading Input Points
If talking 1394 sounds difficult, it's not. To assist and accelerate application development, source code is available for use and customization. If there's a need to use a different development environment or architecture, I/O communication requires TCP/IP, Ethernet, 32-bit IEEE-754 floating-point numeric format, and 2's complement 32-bit integer support. Some binary formatting for endian would be convenient in case the platform is little endian.

For further details visit Opto 22's website.



Author's bio: Bryce Nakatani is a systems engineer at Opto 22, an automation component manufacturer. He has an extensive Unix and POSIX background. Linux is his continuing favorite OS. If you have questions or comments, Bryce may be contacted at [email protected].

 
This article was originally published on LinuxDevices.com and has been donated to the open source community by QuinStreet Inc. Please visit LinuxToday.com for up-to-date news and articles about Linux and open source.



Comments are closed.