Embedded email

November 17, 2015

Colin Walls-November 17, 2015

As with any technical endeavor, the selection/development of technology for communicating with an embedded system should be done with a view to standards compliance, to aid interoperability, and to avoiding “reinventing the wheel” - i.e. reuse a previous development or commercial intellectual property instead of starting from scratch - to reduce costs. In this article, some creative uses of well established email protocols are outlined. This approach enables some quite imaginative functionality to be added to devices with minimal effort and cost.

Repurposing technology
It is always satisfying to see simple solutions to apparently complex problems and the world of embedded software certainly lends itself to some creativity. The concept of "simple" can be quite broad, but essentially encompasses anything that is easy to understand and ideally avoids reinvention of any wheels.

A while ago, an article covered the incorporation of a Web server (HTTP server actually) into an embedded device so that information might be displayed on any connected Web browser. Along the same lines, this article looks at using email.

In talking about adding a Web server to an embedded device, it was not suggested that the device in question actually hosted a publicly accessible website. The idea was to simply leverage Web technology. Web pages - HTML etc. - are easy enough to use to create a user interface; the HTTP protocol is straightforward to handle; Web server software is readily available for most real time operating systems. The result is a powerful and readily maintainable UI solution with minimal coding.

Devices with Email
We can apply the same philosophy to the use of email. Again, of course, it is not suggested that a device have an email account so that it can keep in touch with its friends and relations. It is all about the leveraging of technology. Imagine a device that needs to periodically send (and/or perhaps receive) modest amounts of data to a remote location and it is connected (at least some of the time) to the Internet.

A possible example might be a WiFi enabled vital signs monitor worn at all times by a chronically ill patient; it might send a set or readings to the hospital periodically or when there is a significant change. Another possibility would be a smart meter measuring electricity or gas consumption in a home or other property.

The Internet of Things offers many other opportunities to take this approach. Another example may be found with home automation. A house may be equipped with WiFi enabled lighting – the user can access and control the lighting from an app on their smartphone. A straightforward way to achieve this might be to have the smartphone app simply send an email to the light in question. The use of an email protocol would be transparent (and of no interest) to the user. It would just be a way to simplify the implementation for the developer

Email Protocols
Although there are a number email protocols in use, Simple Mail Transfer Protocol (SMTP) is very common and widely understood, as it has been in use since the earliest days of the Internet. SMTP is normally only used for sending emails - the sender needs to have SMTP client software and the mailer server will have an SMTP server. Other email protocols in use include Post Office Protocol (POP3), which is complementary to SMTP and used to receive email, and the Internet Message Access Protocol (IMAP), which provides more sophisticated capabilities.

SMTP is a simple, text based protocol, which really only uses 3 types of message (MAIL, RCPT and DATA). It is, therefore, easy to apply and monitor/debug. An SMTP or POP3 client can be (and usually is) very light weight and readily available for many popular RTOSes. The simplicity is attractive because it minimizes development time. The small size is useful for many embedded devices where memory is at a premium, but is also a benefit for applications (like medical devices) where certification is required - less code results in cheaper and faster certification.

Conclusions
Embedded software development engineers are very pragmatic people, who take an “if it ain’t broke, don’t fix it” approach. This results in a ready acceptance of the reuse of well proven technology. The employment of email software and protocols for human to machine or machine to machine communications, instead of the more usual human to human channel, fit that philosophy perfectly.

Colin Walls has over thirty years experience in the electronics industry, largely dedicated to embedded software. A frequent presenter at conferences and seminars and author of numerous technical articles and two books on embedded software, Colin is an embedded software technologist with Mentor Embedded [the Mentor Graphics Embedded Software Division], and is based in the UK. His regular blog is located at: http://blogs.mentor.com/colinwalls. He may be reached by email at colin_walls@mentor.com

 

Loading comments...