Building Embedded Solutions with Modern Software Tools - a case study by RND Group
A case study by RND Group, with contributions from Dr. Hal Holmes of Conservation X Labs in association with The NABIT product, a “low-cost, hand-held, field-ready automated tool to validate the identity of a wildlife or food product, anywhere in the world, without specialized training, equipment, reagents, or even continuous power.”
This particular project was made possible using docker containers running on the Toradex Torizon embedded Linux distribution.
Building Embedded Software one Container at a time
When project managers hear a project involves writing embedded software there is an expectation that a software developer with very specialized skills will be required to work on the project. Embedded software development historically requires a developer with both an electrical engineering and computer science background, writing software and firmware in a low-level language like C or C++, acquiring expensive software development tools, and typically the developed user interface will be rudimentary by modern GUI standards.
While many embedded software projects still share these characteristics, there have emerged new technologies that make it possible to perform embedded software development using modern software development tools and improve the productivity of embedded development exponentially. This case study describes RND Group’s experiences with writing software for embedded devices using open-source tools, high-level programming languages, modern UI tool kits, and containerization technology that facilitates developing and testing a high percentage of the software before hardware is available.
An embedded system shares many of the same architectural characteristics of a general-purpose system – there is an operating system, device interfaces/device drivers, business logic, and a user interface. The main difference between an embedded system is that it is designed and built for a specific purpose and many of the features found in a general-purpose system, like networking, security, configuration, and various applications are removed or scaled back. The paring down of the features in the embedded system allows the software to run on more constrained processors with less memory and reduced storage and power consumption requirements. Embedded systems are very common in smaller-sized devices, such as handheld or portable units and especially devices that must be capable of operating on battery power.
There are many operating systems that can be used for embedded systems development, but the leading choice today is Linux. Linux is an open-source operating system and there are various versions of Linux that have been customized to perform well as embedded operating systems, including Android, Maemo, BusyBox, Yocto / Open Embedded, Buildroot, and Mobilinux.
Docker is a software containerization technology that uses virtualization features built into operating systems such and Linux and Windows to support the creation of software packages. These software packages bundle a full stack of software – application, system services, file system, and device services – that runs in its own separate virtual environment. Docker containers offer numerous benefits, including being much lighter weight than traditional virtualization technologies, the ability to build and extend a Docker container from other pre-existing Docker containers, and a guarantee that the software package in the Docker container performs the same way regardless of what hardware it is deployed on.
Adoption and use of Docker has grown exponentially in the 8 years since its first release - including in the medical device software space. RND has been using Docker for several of its customer projects over the past 2-3 years.
In a natural evolution and convergence of technologies, there are now versions of embedded Linux that include Docker infrastructure support, including Linux microPlatform from Foundries.io, TorizonCore from Toradex, and balenaOS from balena. These products provide a Linux distribution and free embedded software developers from the need to build customized Linux images and, instead, focus on developing applications that run in containers. As illustrated below, multiple containers can be created, if desired, with containers communicating with other containers through well-known channels, such as file sharing, TCP, and HTTP.
RND has recently delivered two different medical device software systems using Docker containers running on TorizonCore embedded Linux distribution. These systems include a handheld PCR testing device and a desktop blood testing device. Both of these devices are portable and run 8+ hours on battery power.
The containers in this architecture include:
UI / Business Logic
Written in C# and .Net Core, this is a web server that includes features like run work flow management, results display, QC run management, user/account management, audit trail, and reporting. The UI is written in React, Angular, or Razor and is rendered by the Kiosk Browser container.
Written in C# or Python, this container isolates assay-specific results calculation logic and is called by the UI / Business Logic container.
Provided by Toradex, this container is a window manager that orchestrates startup of display windows, such as the one produced by the Kiosk Browser container.
Provided by Toradex, this container is an HTML web browser that connects to the webserver provided by the UI / Business Logic container.
Written in C# and .Net Core, this container provides hardware services and interacts with the Linux kernel and custom device drives for hardware control. The UI / Business Logic container has a command/response interface to communicate with this container.
There are a number of advantages of using a software architecture like the one described above, including:
- Use of low cost, open-source languages, frameworks, and operating systems allows development and deployment with no run-time royalty costs.
- Use of a high-level, commonly known language like C# allows developers to concentrate on writing application logic and allows organizations to have access to a larger pool of development talent who know C#.
- Modular breakdown of the software in to separate containers allows developing different parts of the application independently and allows for each component/container to focus on a well-defined set of responsibilities.
- Simulation support is facilitated inherently by the well-defined interfaces between containers. For example, the Hardware Controller container can be replaced to simulate the hardware behavior and development of the other containers can proceed in parallel to hardware development.
- Cross-platform support is facilitated in two ways. The use of .Net Core allows code to be written and tested on Linux or Windows outside of a Docker container. And, when deployed inside a Docker container, which are operating system-specific, the Docker containers can be hosted and tested on a variety of operating systems, including Linux and Windows.
"The software architecture RND created for our handheld medical device provided us great flexibility in development. We were able to quickly deploy a demanding user interface, and the architecture allowed us to rapidly iterate and modify our UI, key functionality, and implement new features throughout our development and user testing. This software format also allowed us to first test updates on the desktop and with carrier boards while we were still working out our hardware and complete instruments were scarce or unavailable. Complimenting this architecture with RND’s adept and agile project management enabled us to move our embedded software from requirements to reality more efficiently than I thought possible."
Chief Engineer, Conservation X Labs,
RND has been pleased with the stability and maturity of using Docker and the TorizonCore Linux distribution. Toradex provides a larger number of pre-built containers and pre-built Linux kernel images.These tools and building blocks have significantly reduced the amount of time that is typically required to build customized Linux distributions using Yocto or similar tools for embedded projects. RND has a number of developers experienced in C# and in developing web user interfaces, so the ability to use these tools when creating software for an embedded Linux system allows RND to readily staff these projects.
Brad Graves, Principal Project Manager, RND Group, Inc.
Dr. Hal Holmes, Chief Engineer, Conservation X Labs, Thylacine BioSciences