Machines that blog

Aug. 24, 2006
Believe it or not, industrial equipment can take on the role of a blogger to help track assets and minimize downtime.

Eric Davis
Senior Principal
Engineer

Matthew McFadden
Software Engineer
Lantronix Inc.
Irvine, Calif.

Edited by Leland Teschler

Embedded Web servers such as the XPort AR have facilities built-in that can generate RSS feeds and XML code, giving machine status or other information about operating conditions.


More and more people have come to know that a "blog" is a shortened term for a Web log. It is today typically seen as the journal-style Web site. Blogs have become quite valuable on the Internet as a means of sharing opinions and ideas. But blogging is not just for wannabe pundits. The same concept can generate, aggregate, and distribute important information that can be used for device or machine configuration and control.

It is easy to make a machine into a blogger with the right protocols and technologies. These principally include XML and RSS. They give developers the power to build custom Web content, access all types of data, and aggregate it as readily available information.

Specifically, XML and RSS protocols are becoming more widely accepted as standards for configuration, control, and information transport. So embedded applications are now starting to exploit the capabilities of these protocols at the device level. Networked devices can communicate with these business and Internet protocols to more quickly get device information to mainstream enterprise IT applications. The result: Manufacturing and logistics gear can now deliver real-time information to various groups or individuals within the organization.

The original mission of RSS was to send out newsletters and data streams or updates. But it has gone far beyond that now. Today RSS can function as an integration tool, so enterprises can easily transmit data feeds that can be integrated into portals and other applications and used as an alternative to e-mail, Instant Messaging, or other tools.

Embeddedsystem designers should fully understand the capabilities of XML and RSS, how these protocols differ and how they work together.

THE BASICS OF XML AND RSS
Extensible Markup Language is more commonly referred to as XML. It is a format that lets different devices communicate with each other, particularly those connected to the Internet. XML resembles HTML in that it is text based. All information in XML exits as text interspersed with markup, information about the text structure, presentation, and attributes of information expressed by the text.

XML was designed as a means of creating common formats for information by which both the format and the data can be shared. In that regard, XML can potentially alleviate many of the interoperability problems associated with the sharing of data from a variety of devices.

XML lets information be encoded with meaningful structure and semantics that both computers and humans can understand. So it is a good format for information exchange and can easily be extended to include content that users specify or that is industry specific. Small wonder, then, that more and more devices now use XML.

RSS is generally the abbreviation for Really Simple Syndication. But it can also stand for Rich Site Summary or RDF Site Summary, which are closely related ideas. RSS is an XML-based family of formats for, among other things, distributing content from Web sites and blogs. RSS feeds typically consist of summaries of Web content along with links to the full versions of the content, and other metadata. The RSS feed is actually an XML file. Special programs called aggregators can retrieve Web content supplied in the form of RSS feeds. An aggregator can subscribe to a feed, check for new content periodically, and retrieve anything that's new.

A point to note is that because it is in an XML format, RSS is easily consumed by many other programs, not just by Web browsers or aggregators. And it needn't be limited to news items. It can serve as a simple way to link content for controlling and managing automation devices or machines. A device server that can function as a Web server is therefore able to create an RSS feed to deliver information about machine status.

Just as it is used to aggregate news articles, a device "blog" or a device serverbased Web log can provide a feed of its content by producing an RSS document available via a well-known URL. The result is much more powerful than simple e-mail alerts, and in this way, adds intelligence to the networked device.

INTEGRATING RSS
The possibilities for using RSS abound, and companies increasingly incorporate it into software and embedded systems. For instance, Microsoft's Internet Explorer version 7.0 includes a built-in RSS reader. Other browsers such as Mozilla Firefox and Opera already offer RSS as a standard feature. Many powerful and easy-to-use stand-alone RSS readers are also available.

XML/RSS together provide a useful way to transfer information for machine-to-machine communication. In a factory, for example, an RSS aggregator can collect readings from various machines and push them to a supervisory program for monitoring and control. In an office security system, XML data sent to an application can be a handy way of giving it enough information to decide whether to call the police or fire department.

Similarly, office managers can use an aggregator to collect RSS feeds from remote locations to check for open or closed doors or for other kinds of status information. Mailing services such as UPS can use XML to tell corporate data systems about the status of a package. And RSS can send this information to the end customer.

The way a machine typically becomes a "blogger" is through use of embedded firmware. This firmware can dynamically generate data that is wrapped on the fly into the RSS format (or into a custom XML format). This data then goes out over an appropriate transport mechanism. It is also possible to create static data as a file on an embedded file system for use as an RSS transmission. It gets wrapped into RSS format in the same way as the dynamic data described previously.

Currently, there are integrated solutions being developed that let designers quickly and easily add these functions to applications. All major programming languages have comprehensive XML libraries that help manipulate and parse any kind of XML-formatted data. So there are a lot of possibilities for embedding functions within XML and manipulating the data.

All in all, XML and RSS are both powerful tools. They can add substantial value in applications that include factory automation, health care and a growing machine-to-machine (M2M) segment. This M2M integration can improve workflow and customer service. As more and more users need to access data at an enterprise level from industrial devices, XML and RSS will increasingly become a part of business IT structures.

Example: RSS and XML for machines

An example illustrates how RSS and XML might help in a security application. Suppose a panel device unlocks a door for people who wave the right key card. Further assume that the embedded computer running the panel device incorporates a simple Web server as part of its control functions. The device keeps a log of events that might contain the following information:

struct LogEvent 

{

string time; /* timestamp when this event occurred */ string who; /* who tried to open the door */string status; /* "granted" or "denied" access */

}

These logged events could either sit in a file on the device's file system or be kept as a list in main memory. Either way, the firmware has a mechanism for iterating through the entire list of logged events.

To generate the RSS feed of the log events, developers will set up a CGI-based Web application. This application runs within the HTTP Web server that is part of the panel device. Users elsewhere will be able to access this application via a URL associated with the device. The URL will typically have the well-known format of http://device_ip_address/ index.rss. The RSS generator on the device can dynamically create the RSS page and send it back to the client (i.e. RSS aggregator) through code something like:

void HttpRssCallback(httpSocket){ 

GenerateAndSendRssHeader(httpSocket);

foreach log event i{

GenerateAndSendRssItemData(httpSocket, i)

}

}

The "generate" APIs above simply create the necessary RSS format of the given data. Here is an example of an event log and the resulting RSS data:

Logs:

  1. "Wed Jun 14 16:32:32 PDT 2006" "Matt McFadden" "granted"
  2. "Wed Jun 15 04:14:10 PDT 2006" "Eric Davis" "denied"

RSS Feed:

Security Door http://device_ip_address Security Door Event Logs en-us Access Granted http://device_ip_address Granted access for Matt McFadden Wed Jun 14 16:32:32 PDT 2006 Access Deniedhttp://device_ip_address Denied access for Eric DavisWed Jun 15 04:14:10 PDT 2006

An RSS aggregator is configured to get the RSS feed from the device and then parse the data in a format the user can easily read. In most cases, RSS aggregators present feeds like email clients present mailboxes.

Likewise, applications could use custom XML instead of an RSS feed to expose the event log. The XML data could be pushed or pulled from the device using FTP, TFTP, HTTP, Telnet, Email, or similar protocols. The same logs above encoded as custom XML might look like:

 Matt McFaddengranted  Eric Davis denied  

It's customary when using custom XML to implement a back-end program or script to parse the data, interpret it, and do something useful. In the above case, an example might be to send the office manager an email noting that access was denied to Eric Davis.

MAKE CONTACT
Lantronix Inc.,
lantronix.com

Sponsored Recommendations

Altech's Liquid Tight Strain Relifs Catalog

March 13, 2024
With experienced Product Engineers and Customer Service personnel, Altech provides solutions to your most pressing application challenges. All with one thought in mind - to ensure...

Industrial Straight-Through Cable Gland

March 13, 2024
Learn more about Altech's cable glands and all they have to offer for your needs!

All-In-One DC-UPS Power Solutions

March 13, 2024
Introducing the All-In-One DC-UPS, a versatile solution combining multiple functionalities in a single device. Serving as a power supply, battery charger, battery care module,...

Smooth Sorting with SEW-EURODRIVE!

Feb. 22, 2024
Sorting systems are essential when it comes to warehouse automation, material handling, and distribution. SEW-EURODRIVE’s automated sorting solutions increase capacity, reliability...

Voice your opinion!

To join the conversation, and become an exclusive member of Machine Design, create an account today!