The Need for Fresh Air in the Internet of Things

Giacomo Baldi, Gualtiero Fantoni, Daniele Mazzei and Gabriele Montelisciani
May 12, 2015


Arduino, Raspberry PI, UDOO, Spark Core or similar prototyping boards have revolutionized the way people prototype IOT devices and robots, and have changed the paradigm also in light home automation as well as some industrial applications. However, although such boards have a great impact in prototyping the electronics, a similar revolution has not happened at the code level. In fact C/C++ is mostly used for coding and often too much time is spent in reinventing the wheel or in merging code written in the past.

Of course people with different backgrounds experience different problems but all of them frequently face similar difficulties. Product designers want to create behaviours that can co-exist at the same time and are often frustrated by "anomalous" and unexpected results of their installations. Makers who have higher competences invest a lot of time in understanding how to code multithreaded behaviours, how to manage interrupts in C++, etc. and sometimes their code becomes really hard to maintain. Programmers are frustrated by executing "boring" tasks for their "customers", one example is related (again) to the lack of multithread, interrupts, callbacks, timers and exceptions that have for them become essential. Moreover, all of them have to recode when moving from one board to another.

The Raspberry Pi success demonstrates the need for an easy programmable and usable intelligent unit for the design of smart and interactive objects. Furthermore prototyping is no more a free-time activity for makers and geeks. However the use of a microprocessor based board is not the correct choice for the design of a lightweight, battery powered and miniaturized product.

On the other hand, microcontrollers have always been associated with applications related to low-level control and real-time requirements for industrial applications. This is why little effort has been invested in the usability and programmability of these extremely efficient control units.

In order to make a microcontroller usable by everyone it is necessary to add an abstraction layer on top of the hardware. This process has been done years ago in microprocessors with the design of various operating systems. Various programming facilities have been placed on top of these hardware managers. This created Virtual Machines in which inserting another abstraction layer gave programmers the possibility to design using very high level features, together with the guarantee of portability to various operating systems and, consequently, to various hardware.

Examples of operating systems for microcontrollers are ChibiOS, FreeRTOS and many others. Most of these systems are aimed at guaranteeing real-time features but a survey we recently did showed that real time is not really required when passing from low level to high level programming.

It is worth highlighting that real time does not mean fast. Real time systems are those that guarantee time constraints on execution: the constraint can be very tight like airbags, gearboxes, and injectors (order of microseconds). However in 99.99% of household appliances, 99% of designers’ applications, artistic installations, makers’ prototypes and at least 80% of industrial applications in production and manufacturing, you need constraints in the order of milliseconds (10-100ms).

ChibiOS, FreeRTOS and other systems allow different boards to be managed at an abstract level and also introduce the possibility of developing real-time applications but all of this is still in C. In the past some tentative moves towards an abstraction layer have been made by porting Javascript and Phyton (Espruino, Microphyton, etc.) on specific boards through the implementation of monolithic virtual machines with integrated hardware management layers.

Not reinventing the wheel

What we are talking about is not reinventing an architecture for the embedded world but rather mimicking what happened in the mobile domain with Android. Android is a Java Virtual Machine that runs on top of a Linux operating system. The operating system guarantees the hardware management and allows easy porting of the entire system to various hardware; thus guaranteeing future scalability and adaptability to the new generation of mobile chips and standards.

Figure 1


Below we study the abstraction problem and try to identify the technical and architectural requirements by exploiting the similarity with Android.

Technical and architectural details

The software suite for the design of interactive objects based on microcontrollers should include an Operating System (OS) and a Virtual Machine (VM) but also other enabling tools like a programming environment, a set of ready to use libraries and a connection with mobile devices and apps.

Having a Virtual Machine that runs on top of a multithreaded real-time operating system for embedded devices users can program in high level scripting languages (like Python, Javascript, etc.), letting the real-time operating system manage the real time aspects. The main issue for this design is the memory limitation of microcontrollers; therefore the dimensions of the OS+VM package have to be kept to a minimum. Thanks to an Abstraction layer boards are abstracted making the entire suite cross-platform. After installing the VM on a board the hardware is no longer a UDOO or an Arduino but a generic execution system able to run the user’s script. For this reason, the same bytecode can run on different boards eliminating the problem of recoding when new requirements demand a board change.

A browser-based integrated development environment (IDE) with "plug and play" board capabilities seems to be a good way of allowing different users to use the work station they prefer without being driven crazy by the installation of compilers, IDEs, and board-specific tools. Boards like ArduinoDUE, UDOO, Spark Core or Spark Photon, ST Nucleo, etc. have to be easily recognized by the IDE running on all the most used PC OS (Windows, Linux and Mac).

Connectivity. The software suite has to support connectivity: TCP and UDP connections, higher level protocols such as HTTP and, in cases where the board has enough resources also HTTPS. Currently many microcontrollers have insufficient memory to allow cryptography, but, to comply with such requirements new boards appearing in the market are more and more powerful. Therefore, the suite must easily communicate with cloud services like IFTTT, Paraimpu, Carriots, Spark Cloud, etc.

Mobile apps and integration with notification services. The ever increasing demand for remote controlled devices requires a system for easily connecting devices with mobile apps. What is needed is a generic mobile app that is able to discover all the devices available on the local network or to connect with a specific remote device. The app interfaces have to be located in the device and transferred to the mobile once requested by the app. This will allow the design of interfaces within the same code used for defining the device behaviour. Such an app could allow the control of the actuators and the monitoring of the sensors integrated in the device allowing also the extension of the device actuation and sensing to the mobile ones (i.e. reading the mobile GPS or alerting through the mobile notifications service).


A solution that has been tested to efficiently address many of these items following the previously described architecture has been developed and is called VIPER. "VIPER (Viper Is Python Embedded in Real time) is an open source development suite oriented to IOT and robotics and is composed of: a Virtual Machine, an IDE, a smart networking system and an app". The solution targets all IoT enthusiasts, software developers, and also application providers. More information is available at:, and Videos and case studies can be found at:



Giacomo BaldiGiacomo Baldi is a computer scientist and a medical doctor. He works as a software architect implementing algorithms, devices and Apps in his medical work. He has considerable experience in programming embedded devices and in developing software applications both for research and industry. His main research interests are in the development of interconnected and low cost medical devices for helping patients, medical doctors and hospital staff.


Gualtiero FantoniGualtiero Fantoni achieved his PhD in Automation, Robotic and Bioengineering at the University of Pisa in 2005 and is an Associate professor of "New product development" and "Manufacturing engineering" at the University of Pisa. His main research interests are in the field of robotics applied to manufacturing, production engineering and maintenance.



Daniele MazzeiDaniele Mazzei is a postdoctoral researcher at Research Center "E.Piaggio" of University of Pisa and a member of IEEE. He achieved the PhD in Automation, Robotic and Bioengineering at University of Pisa in 2010. Mazzei's actual research focuses on social robotics and human robot empathic interaction studies. He is the scientific coordinator of the FACETeam, a group of the Research Center "E.Piaggio" focused on the development of social and affective robotics. He also is the technical coordinator of the EASEL project aimed at developing a theoretical understanding of human-robot symbiotic interaction.


Gabriele MonteliscianiGabriele Montelisciani has a PhD in Economics and Management Engineering. He is a Research Associate at the University of Pisa focusing on: methods and tools for early stage innovation and collaborative design; sustainable innovation and development; new business development and entrepreneurship; value creation from ICT innovation. Montelisciani is the Project Manager for the project ENDuRE – European Network of Design for Resilient Entrepreneurship (EU Erasmus+ Knowledge Alliance).