How embedded Linux accelerates IoT development

458 readers like this.
How Linux got to be Linux: Test driving 1993-2003 distros

Internet Archive Book Images. Modified by Opensource.com. CC BY-SA 4.0

You'll find that the quickest way to build components of an IoT ecosystem is to use embedded Linux, whether you're augmenting existing devices or designing a new device or system from the beginning. Embedded Linux shares the same source code base as desktop Linux, but it is coupled with different user interface tools and other high-level components. The base of the system is essentially the same.

Let's look at a few common cases.

Often, extremely low-power applications, such as sensors, run for months at a time on disposable cells or even on energy harvesting applications. Any usage of Linux may seem to be rather heavy. The low-power nature often precludes direct IP connectivity. This implies a gateway for Internet connectivity. A gateway would speak the low-power protocol to the sensors and would translate them to IP. Depending on the protocol, Linux may have existing protocol support or something similar enough to leverage.

Consider an outdoor thermometer with a wireless link running from a CR2032 coin cell or a "smart light bulb." A smart light bulb may not appear to be a low-power application, depending on its approach to handling things in the off state. A pure Linux approach where it sleeps when off could mean you'd have a boot time issue (most users would not be willing to wait 10 to 20 seconds for a light bulb to turn on for the first time).

If either of these were to run some flavor of IEEE 802.11 ("Wi-Fi") directly, battery life would be extremely limited. Similarly, bulb-off power usage would be considerably higher than a normal bulb. (A smart light bulb typically allows the user to switch it on via the Internet from the off state.) Instead, they can use a bulb designed for low-power protocol, such as a simple 2.4GHz signaling system or Bluetooth Low Energy to maintain the low-power aspect. An embedded Linux gateway translates the low-power wireless link to Wi-Fi or even Ethernet for Internet connectivity. A Linux-based gateway along with a low-power wireless protocol is exactly what you see on numerous devices on the market today.

Another common case is a fresh design. Embedded Linux is already found in many non-IoT devices today. A common dilemma for designers is choosing between a bare metal/RTOS (Real-Time Operating System) approach versus using a Linux on a SoC (System on a Chip), which is an integrated circuit that incorporates all of a computer's components. A bare metal option can appear at first to have a lower BOM (Bill of Materials) cost, but that ignores common issues, such as time to market, development costs, and support costs. Embedded Linux can be quicker to turn around and a larger user base can mean lower development costs in terms of available resources, including qualified engineers and development tools, such as those that allow you to simulate aspects of your projects. A large Linux user base can augment test coverage and simplify support issues.

A main requirement for an IoT device is connectivity, usually in the form of IP. Often this is via a web server. Bare metal/RTOS can offer IP connectivity, but unless you scrutinize it carefully you run the risk of buggy and potentially substandard IP implementations. For example, many RTOSs do not isolate the IP stack user from the IP stack itself. Internet connectivity can require potentially dealing with low speed or congested links. This can translate into obscure and hard-to-debug buffer handling issues when the stack is intermingled with other code. In contrast, an embedded Linux implementation leverages hardware separation and a widely utilized IP stack that probably has been exposed to corner cases. If you consider this and other risks associated with bare metal/RTOS implementation, you can quickly offset the minimal added BOM cost of Linux with a quicker time to market, lower support and development costs, and widely available development resources.

Another common case is augmenting an existing design for IoT capabilities. This includes both nearly complete but still in development projects and upgrades to an existing product. The key issue is adding the IoT features. For discussion's sake, this means adding a read device status, configuration and control, or all, to a device with a web browser (like on a phone). This means you need an IP stack, a web server, and software glue on the device.

For an existing device with a bare metal setup, the discussion above applies to retrofitting Internet connectivity. Refitting the device to use embedded Linux may be the easiest path. Let's look at an existing embedded Linux device. Adding IP connectivity to an existing device can be as simple as enabling the IP stack via kernel options. You'll need to add a few packages to configure the system along while pulling in one of the many web servers. At this point, you'll need to write the software glue to service the web requests. The software glue can be in the form of simple scripts written in shell, Python, JavaScript, etc. Time to market with added IoT features is often critical, so as such, you can do the last step concurrent with the other steps. Adding an engineer can really accelerate development.

Security is an essential concern of retrofitting IoT connectivity to an embedded Linux device. This is applicable to both retrofitting and fresh designs. IoT services are often exposed to the dangerous, unfiltered Internet. A system compromise on the Internet interface can have consequences beyond giving an intruder information on the device or control of the device. However, exploring security issues further would easily add up to another article. You can leverage several native, embedded Linux features—multiuser, SELinux, and containers—to contain and limit the damage. This is on top of potential fixes shared by other parts of the Linux community.

These cases show how embedded Linux accelerates IoT development. Linux can future proof, simplify augmentation, and provide IP gateway services to the IoT ecosystem. The vast library of drivers and features within the Linux ecosystem along with the power of open source is a natural reservoir to draw from when building IoT projects.

Hunyue Yau will be speaking at SCALE 15x, delivering the talk: The Many IoT Roles of embedded Linux.

User profile image.
Hunyue Yau from HY Research LLC (http://www.hy-research.com/) is an embedded Linux Consultant, software and hardware developer, and enthusiast with over 20 years of involvement in Linux. He has worked on numerous Linux architectures including x86 and ARM.

1 Comment

Something that is sorely needed in the development IoT development is a more open informational structure about how ones IoT devices are exposed to the outside world. Right now, there is the fog of inscrutability much like the legalese of EULAs. I think IoT devices should be user-fixable when bad things happen, and at the least the user should be able to easily shut off IoT connections that aren't needed. Using Linux doesn't by definition make something open to the user/owner of some device.

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.