Rapid prototyping of IoT devices
Designing distributed systems, which are Internet of Things (IoT) solutions, is a complex and painstaking process. If we talk about the social component of IoT, then you need to take into account the features of the processes of interaction at the level of devices, people, and also do not forget about the possibilities that can not only be added as an external process, but made part of a system that will already be based on the principles of self-organization of social communities. Undoubtedly, it is very interesting and promising, both for an ambitious startup, and for simple enthusiasts, for example, involved in improving smart home systems, designing solutions for the agricultural sector, etc. However, the success of any project depends not only on the “right idea”, but also on its timely implementation.

Congatec introduces highly flexible IoT gateway. Press Releases. Image: congatec AG.
Everything is complicated by the fact that, starting from the level of formation of the project idea, and ending with the prototyping of social IoT, it would seem that there are many approaches and options for their solutions. At the same time, in fact, today, a certain de facto architecture has been formed to build solutions in the field of the Internet of things and to establish ways of their interaction with social networks.
Undoubtedly, the success in the development of many software and hardware solutions depends on the level of detail of the project. First you need to decide whether the project will be created from the development of the board, low-level programming, and then the solution will be implemented at the level of web service, etc., or instead, ready-made components and systems will be used, and the developer will act as an integrator. It is clear that now low-level programming is not assembler, but C / C ++ for the microcontroller, but still this is not the way to use a script-oriented language or a graphical programming language, for example, how this can be done in the National Instruments LabView virtual instrument system.
Everywhere there is a compromise. Almost any electronics manufacturer for their boards produces the so-called “reference” (Reference) or, more correctly, an exemplary version of product integration in the form of Start KIT, Development KIT, etc. Since the board layout and basic software solutions are already provided by the manufacturer, this approach allows the developer to speed up the development process, for example, of a new microcontroller, microprocessor, operational amplifier, etc.
For example, the AWS Zero Touch secure configuration platform based on Microchip's ECC508 chip allows you to develop secure AWS IoT cloud solutions. In fact, this is a software and hardware solution for reliable and secure authentication of IoT devices in the Amazon cloud service. The chip maker is launching the AT88CKECC-AWS-XSTK starter kit with secure configuration and demonstration features to quickly start developing and prototyping its devices.

The AWS Zero Touch Secure Development Platform. Photo: Microchip Technology.
Such boards and starter kits often provide for familiarization either one component, or have additional elements and blocks in their composition, for example, to study all the features of a particular product. Sometimes evaluation boards do not even contain mounting holes, which largely negates the creation of a prototype based on them, i.e. in this case, you can not do without the independent development of the printed circuit board.
Obviously, the emerging projects of Arduino , Raspberry Pietc., the so-called open or free electronic projects allow you to quickly and efficiently prototype IoT devices. These products introduce a certain level of unification in the development, and their open nature allows us to improve or refine the existing functionality to solve a specific problem. In fact, everything depends on the competence of the developer, as well as the timing and limitations of the project.
Since there are many ready-made solutions for developing IoT devices at the level of sensors and executive systems, it is logical to consider a fairly typical development option at the level of prototyping based on open electronic projects. One way or another, after the prototype it is logical to carry out the wiring of the board, order its manufacture and take care of a convenient housing for the product.
However, carried away by reflections on the implementation, we forget about the basic foundation of design. Indeed, at the beginning of any project, it should be decided, and how the project will go: “from bottom to top” or “top to bottom”. Those. First, the developer delves into the implementation of details, for example, the creation of sensors and actuators, and then performs the adjustment of communications between IoT, social networks, etc. Or vice versa, at first the framework of the system or its concept in one form or another is developed, and only then the developer studies the details of the implementation of the final components of the project.

Scrum is a framework for managing software development. Picture: Wikipedia.
Here, an object-oriented approach to design and flexible (Agile) project management methodologies, which are often forgotten by developers associated with electronics or hardware, should come to our aid. It is not a true opinion that these approaches are valid only for the development of software products.
IoT, being essentially a very complex distributed system, can well be described at the level of an object-oriented model, and as a result, give design tools, for example, the use of UML diagrams. Just to understand asynchronous processes, which are the basis for the interaction of the Internet of things, you will need diagrams of components, packages, activities, synchronization, etc. And as a result of applying the object-oriented approach, the choice in favor of top-down design is immediately decided.
In turn, flexible methodologies, and even more so, the Agile manifest itself, states that: “People and interaction are more important than processes and tools; a working product is more important than comprehensive documentation; cooperation with the customer is more important than the agreement of the contract; readiness for change is more important than following the original plan. ”
Therefore, for the project of the social Internet of things, you should first think through and work out a vision of the platform with which the end user will work. For a large-scale project, this will be the development of its own customized platform, and for a less ambitious solution, it will be the choice and configuration of services of well-known cloud solutions, for example, AWS IoT, Azure IoT Suite, Watson Internet of Things, etc.
Now for a general presentation and independent research in the direction IoT projects Node-RED product confidently stepped into first position, developed by IBM, and now available under an open source license from the JS Foundation . Further, everything is simple, the project will constantly go through iterations of analysis of solutions and adding new functionality.
For a relatively small project, the configured process in Node-RED will actually become the very minimum viable product ( MVP ) that users and, for example, the customer can immediately see and evaluate. Further, you can improve the logic of the system as a whole based on an online service and begin to plan the connection of IoT end devices. At the same time, one should not forget about the possibility of creating a panel with data visualization, for example, using third-party services or the Node-RED dashboard module .
In this context, Node-RED should be considered not only as a software and hardware solution that can be launched locally on the Raspberry Pi and begin to collect data from sensors, but as a service that provides visual construction of the interaction of IoT devices and social media. This will give the end user the ability to customize their preferences in the world of the social Internet of things or the smart home integrator is a convenient tool that replaces traditional programming.

Node-RED. A visual tool for wiring the Internet of Things. Image: JS Foundation.
To get started with Node-RED, you can use the FRED serviceSense Tecnic Systems. You can also start the system based on the prepared Boilerplate template for IBM Bluemix, AWS Elastic Beanstalk Service (EBS), or based on the Ubuntu Server cloud virtual machine, Amazon Web Services, Microsoft Azure, etc.
But if we continue to think about the concept of the project itself, then for the development and implementation of IoT solutions, in addition to a flexible approach to project management, the use of the DevOps methodology becomes relevant. It is the interaction of the development and operation groups that underlies the competent approach to the formation of the project of the social Internet of things. Such a project will rapidly develop not only at the stage of designing and launching the product, but also during the operation of all its services and systems. And as you know, at the moment, Docker-based container virtualization has become the de facto standard for implementing DevOps techniques.
Therefore, there are great prerequisites and reasons, for example, to study the operation of complex web solutions, such as Node-RED, or to simply configure them, to deploy such a system in the Docker container on the local computer. Then it will be possible to migrate the development to the cloud or look in the direction of alternative solutions and also experiment with them on the basis of container virtualization.
Docker is a cross-platform solution for managing a container-based virtualization environment. In general, Docker steadily penetrated the clouds and became one of the main DevOps tools. The platform is positioned by developers in the direction of building and using containerization as a service - Containers as a Service (CaaS). After installing in a desktop operating system environment, work with Docker is performed at the command line level. Now, however, you can already use the Kitematic graphical shell.

Kitematic is a simple application for managing Docker containers on Mac, Linux and Windows. Image: Kitematic.
But still, Docker is a command line. After all, to download the official Node-RED image from DockerHub and launch a container based on it, you need only one line:
Further, in order not to stop the container and leave the Docker command line, you need to press the keys: “Ctrl-p”, “Ctrl-q”. To get the command line of the container should run the command:
It should be noted that it is quite possible to install Node-RED extensions in the system’s web interface: “Menu-Manage palette”, but the command line is convenient and fast.

So, at the top level of our social IoT ecosystem there will be a cloud with the Node-RED service running on the basis of a container on a dedicated virtual server or working on a container cluster, in fact - this is already a conversation about scaling the project. The main thing, due to container virtualization, it will be almost all the same to us where to debug Node-RED applications - locally or in the cloud.
Another question, is there an alternative to Node-RED? If you do not use this shell, you will have to develop a web application or work with cloud services at the level of script-oriented programming languages. Interesting in this regard is the opinion of readers of our blog.
In fact, Node-RED is often compared to the Eclipse Kura and Project Flogo projects. For our example, Kura is not quite suitable, because its main purpose is an IoT gateway and it is better to consider it in the context of matching smart sensors and actuators with top-level systems. But the TIBCO Software Flogo project deserves attention, as it is also positioned by developers as a faster solution, because Unlike Node-RED written in NodeJS, Flogo is developed in Go. But essentially, Flogo is also a gateway, although there is another use for it as a microservice designer for IoT. This is an interactive constructor in the context of the event-oriented logic of the microservice. You can imagine Flogo functionality with Docker, of course: “docker run -it -p 3303: 3303 flogo / flogo-docker eula-accept”.

Pi 3 makes 'ultimate education list' for engineers. Image: MagPi.
After mastering the Node-RED functionality, it becomes logical to switch to the intermediate layer of the system under consideration - the interface between the interaction of sensors and IoT mechanisms with the level of web service. This is the place of single-board computers and the Raspberry Pi platform, as the most convenient solution for experiments. Here, also already exists, the de facto standard is messaging according to the publisher / subscriber model using the MQTT (Message Queue Telemetry Transport) protocol. Interestingly, MQTT was offered by the same IBM together with the Italian computer equipment manufacturer Eurotech, and is now transferred to the non-profit organization Eclipse Foundation. As an implementation of an MQTT broker, it is logical to choose either a fairly easy solution from Eclipse Mosquitto, HiveMQ, etc. In this case, it all depends on the requirements for scaling the system.
In our case, at the intermediate level of the proposed IoT system, we will launch the Mosquitto broker, and for its hardware implementation we will choose the Raspberry Pi platform. Conceptually, this will bring sensors and actuators closer to each other. And in case of failure of the Internet channel, the broker will be able to support the interaction of IoT devices locally.
The bottom, or base, layer in the proposed implementation will be a network of intelligent sensors and actuators, as well as devices that, if there is no Internet connection, will allow for the autonomous functioning of the system. Of course, this interaction should be organized based on the MQTT protocol.
Based on the Raspberry Pi with solutions on Node-RED, Kura or others, it is quite possible to implement a system that will work with combined sensors, for example, as suggested in the article “Interaction of machines and people in the environment of the social Internet of things”. In the comments to the article (@ Mobile1), the SensorTag solution from Texas Instruments was noted, which, although it looks very tempting, is still a demonstration device that is designed to study the Texas Instruments CC13xx / CC26xx platform. The approach looks interesting as a conceptual solution for sensors and actuators for implementing IoT: one sensor - one device or one actuator - one device.

D1 mini. D1 mini Shields. Image: WEMOS Electronics.
I would like to thank our readers for very informative comments. As an example, in the context of comments, Wemos solutions were mentioned that perfectly implement the concept of the Internet of things, but they obviously lack a functional case and at least the presence of mounting holes on the board, for example, as implemented in the ITEAD Intelligent Systems (@ Sonoff series of devices IvanT, cheshircat ). Thanks to a constructive dialogue, topics for new articles appear.
Unfortunately, in one article “the immensity cannot be grasped”. In the continuation of the publication, as the reader already guessed, we will consider some idealized implementation of social IoT based on the proposed three-level architecture and modern design methodologies. By the way, it is unlikely that an individual developer, geek, will need to think about the methodology at all about project management, but if a team is working on a solution to the problem, there is something to reflect on.

Congatec introduces highly flexible IoT gateway. Press Releases. Image: congatec AG.
Everything is complicated by the fact that, starting from the level of formation of the project idea, and ending with the prototyping of social IoT, it would seem that there are many approaches and options for their solutions. At the same time, in fact, today, a certain de facto architecture has been formed to build solutions in the field of the Internet of things and to establish ways of their interaction with social networks.
Undoubtedly, the success in the development of many software and hardware solutions depends on the level of detail of the project. First you need to decide whether the project will be created from the development of the board, low-level programming, and then the solution will be implemented at the level of web service, etc., or instead, ready-made components and systems will be used, and the developer will act as an integrator. It is clear that now low-level programming is not assembler, but C / C ++ for the microcontroller, but still this is not the way to use a script-oriented language or a graphical programming language, for example, how this can be done in the National Instruments LabView virtual instrument system.
Everywhere there is a compromise. Almost any electronics manufacturer for their boards produces the so-called “reference” (Reference) or, more correctly, an exemplary version of product integration in the form of Start KIT, Development KIT, etc. Since the board layout and basic software solutions are already provided by the manufacturer, this approach allows the developer to speed up the development process, for example, of a new microcontroller, microprocessor, operational amplifier, etc.
For example, the AWS Zero Touch secure configuration platform based on Microchip's ECC508 chip allows you to develop secure AWS IoT cloud solutions. In fact, this is a software and hardware solution for reliable and secure authentication of IoT devices in the Amazon cloud service. The chip maker is launching the AT88CKECC-AWS-XSTK starter kit with secure configuration and demonstration features to quickly start developing and prototyping its devices.

The AWS Zero Touch Secure Development Platform. Photo: Microchip Technology.
Such boards and starter kits often provide for familiarization either one component, or have additional elements and blocks in their composition, for example, to study all the features of a particular product. Sometimes evaluation boards do not even contain mounting holes, which largely negates the creation of a prototype based on them, i.e. in this case, you can not do without the independent development of the printed circuit board.
Obviously, the emerging projects of Arduino , Raspberry Pietc., the so-called open or free electronic projects allow you to quickly and efficiently prototype IoT devices. These products introduce a certain level of unification in the development, and their open nature allows us to improve or refine the existing functionality to solve a specific problem. In fact, everything depends on the competence of the developer, as well as the timing and limitations of the project.
Since there are many ready-made solutions for developing IoT devices at the level of sensors and executive systems, it is logical to consider a fairly typical development option at the level of prototyping based on open electronic projects. One way or another, after the prototype it is logical to carry out the wiring of the board, order its manufacture and take care of a convenient housing for the product.
However, carried away by reflections on the implementation, we forget about the basic foundation of design. Indeed, at the beginning of any project, it should be decided, and how the project will go: “from bottom to top” or “top to bottom”. Those. First, the developer delves into the implementation of details, for example, the creation of sensors and actuators, and then performs the adjustment of communications between IoT, social networks, etc. Or vice versa, at first the framework of the system or its concept in one form or another is developed, and only then the developer studies the details of the implementation of the final components of the project.

Scrum is a framework for managing software development. Picture: Wikipedia.
Here, an object-oriented approach to design and flexible (Agile) project management methodologies, which are often forgotten by developers associated with electronics or hardware, should come to our aid. It is not a true opinion that these approaches are valid only for the development of software products.
IoT, being essentially a very complex distributed system, can well be described at the level of an object-oriented model, and as a result, give design tools, for example, the use of UML diagrams. Just to understand asynchronous processes, which are the basis for the interaction of the Internet of things, you will need diagrams of components, packages, activities, synchronization, etc. And as a result of applying the object-oriented approach, the choice in favor of top-down design is immediately decided.
In turn, flexible methodologies, and even more so, the Agile manifest itself, states that: “People and interaction are more important than processes and tools; a working product is more important than comprehensive documentation; cooperation with the customer is more important than the agreement of the contract; readiness for change is more important than following the original plan. ”
Therefore, for the project of the social Internet of things, you should first think through and work out a vision of the platform with which the end user will work. For a large-scale project, this will be the development of its own customized platform, and for a less ambitious solution, it will be the choice and configuration of services of well-known cloud solutions, for example, AWS IoT, Azure IoT Suite, Watson Internet of Things, etc.
Now for a general presentation and independent research in the direction IoT projects Node-RED product confidently stepped into first position, developed by IBM, and now available under an open source license from the JS Foundation . Further, everything is simple, the project will constantly go through iterations of analysis of solutions and adding new functionality.
For a relatively small project, the configured process in Node-RED will actually become the very minimum viable product ( MVP ) that users and, for example, the customer can immediately see and evaluate. Further, you can improve the logic of the system as a whole based on an online service and begin to plan the connection of IoT end devices. At the same time, one should not forget about the possibility of creating a panel with data visualization, for example, using third-party services or the Node-RED dashboard module .
In this context, Node-RED should be considered not only as a software and hardware solution that can be launched locally on the Raspberry Pi and begin to collect data from sensors, but as a service that provides visual construction of the interaction of IoT devices and social media. This will give the end user the ability to customize their preferences in the world of the social Internet of things or the smart home integrator is a convenient tool that replaces traditional programming.

Node-RED. A visual tool for wiring the Internet of Things. Image: JS Foundation.
To get started with Node-RED, you can use the FRED serviceSense Tecnic Systems. You can also start the system based on the prepared Boilerplate template for IBM Bluemix, AWS Elastic Beanstalk Service (EBS), or based on the Ubuntu Server cloud virtual machine, Amazon Web Services, Microsoft Azure, etc.
But if we continue to think about the concept of the project itself, then for the development and implementation of IoT solutions, in addition to a flexible approach to project management, the use of the DevOps methodology becomes relevant. It is the interaction of the development and operation groups that underlies the competent approach to the formation of the project of the social Internet of things. Such a project will rapidly develop not only at the stage of designing and launching the product, but also during the operation of all its services and systems. And as you know, at the moment, Docker-based container virtualization has become the de facto standard for implementing DevOps techniques.
Therefore, there are great prerequisites and reasons, for example, to study the operation of complex web solutions, such as Node-RED, or to simply configure them, to deploy such a system in the Docker container on the local computer. Then it will be possible to migrate the development to the cloud or look in the direction of alternative solutions and also experiment with them on the basis of container virtualization.
Docker is a cross-platform solution for managing a container-based virtualization environment. In general, Docker steadily penetrated the clouds and became one of the main DevOps tools. The platform is positioned by developers in the direction of building and using containerization as a service - Containers as a Service (CaaS). After installing in a desktop operating system environment, work with Docker is performed at the command line level. Now, however, you can already use the Kitematic graphical shell.

Kitematic is a simple application for managing Docker containers on Mac, Linux and Windows. Image: Kitematic.
But still, Docker is a command line. After all, to download the official Node-RED image from DockerHub and launch a container based on it, you need only one line:
docker run -it -p 1880:1880--name mynodered nodered/node-red-docker
Further, in order not to stop the container and leave the Docker command line, you need to press the keys: “Ctrl-p”, “Ctrl-q”. To get the command line of the container should run the command:
docker exec -it mynodered /bin/bash
to stop the container: docker stop mynodered
and in order to run: docker start mynodered
. As it has already become clear, Node-RED will be available at the virtual address that Docker will create on the port: 1880. When working with the command line, it should be noted that the container is configured to store user data in the “/ data” directory. For example, to install the Node-RED additional component, the Node-RED-Dashboard visualization panel, at the command line of the mynodered container, run the following commands:$ cd /data
$ npm install node-red-dashboard
$ exit
It should be noted that it is quite possible to install Node-RED extensions in the system’s web interface: “Menu-Manage palette”, but the command line is convenient and fast.

So, at the top level of our social IoT ecosystem there will be a cloud with the Node-RED service running on the basis of a container on a dedicated virtual server or working on a container cluster, in fact - this is already a conversation about scaling the project. The main thing, due to container virtualization, it will be almost all the same to us where to debug Node-RED applications - locally or in the cloud.
Another question, is there an alternative to Node-RED? If you do not use this shell, you will have to develop a web application or work with cloud services at the level of script-oriented programming languages. Interesting in this regard is the opinion of readers of our blog.
In fact, Node-RED is often compared to the Eclipse Kura and Project Flogo projects. For our example, Kura is not quite suitable, because its main purpose is an IoT gateway and it is better to consider it in the context of matching smart sensors and actuators with top-level systems. But the TIBCO Software Flogo project deserves attention, as it is also positioned by developers as a faster solution, because Unlike Node-RED written in NodeJS, Flogo is developed in Go. But essentially, Flogo is also a gateway, although there is another use for it as a microservice designer for IoT. This is an interactive constructor in the context of the event-oriented logic of the microservice. You can imagine Flogo functionality with Docker, of course: “docker run -it -p 3303: 3303 flogo / flogo-docker eula-accept”.

Pi 3 makes 'ultimate education list' for engineers. Image: MagPi.
After mastering the Node-RED functionality, it becomes logical to switch to the intermediate layer of the system under consideration - the interface between the interaction of sensors and IoT mechanisms with the level of web service. This is the place of single-board computers and the Raspberry Pi platform, as the most convenient solution for experiments. Here, also already exists, the de facto standard is messaging according to the publisher / subscriber model using the MQTT (Message Queue Telemetry Transport) protocol. Interestingly, MQTT was offered by the same IBM together with the Italian computer equipment manufacturer Eurotech, and is now transferred to the non-profit organization Eclipse Foundation. As an implementation of an MQTT broker, it is logical to choose either a fairly easy solution from Eclipse Mosquitto, HiveMQ, etc. In this case, it all depends on the requirements for scaling the system.
In our case, at the intermediate level of the proposed IoT system, we will launch the Mosquitto broker, and for its hardware implementation we will choose the Raspberry Pi platform. Conceptually, this will bring sensors and actuators closer to each other. And in case of failure of the Internet channel, the broker will be able to support the interaction of IoT devices locally.
The bottom, or base, layer in the proposed implementation will be a network of intelligent sensors and actuators, as well as devices that, if there is no Internet connection, will allow for the autonomous functioning of the system. Of course, this interaction should be organized based on the MQTT protocol.
Based on the Raspberry Pi with solutions on Node-RED, Kura or others, it is quite possible to implement a system that will work with combined sensors, for example, as suggested in the article “Interaction of machines and people in the environment of the social Internet of things”. In the comments to the article (@ Mobile1), the SensorTag solution from Texas Instruments was noted, which, although it looks very tempting, is still a demonstration device that is designed to study the Texas Instruments CC13xx / CC26xx platform. The approach looks interesting as a conceptual solution for sensors and actuators for implementing IoT: one sensor - one device or one actuator - one device.

D1 mini. D1 mini Shields. Image: WEMOS Electronics.
I would like to thank our readers for very informative comments. As an example, in the context of comments, Wemos solutions were mentioned that perfectly implement the concept of the Internet of things, but they obviously lack a functional case and at least the presence of mounting holes on the board, for example, as implemented in the ITEAD Intelligent Systems (@ Sonoff series of devices IvanT, cheshircat ). Thanks to a constructive dialogue, topics for new articles appear.
Unfortunately, in one article “the immensity cannot be grasped”. In the continuation of the publication, as the reader already guessed, we will consider some idealized implementation of social IoT based on the proposed three-level architecture and modern design methodologies. By the way, it is unlikely that an individual developer, geek, will need to think about the methodology at all about project management, but if a team is working on a solution to the problem, there is something to reflect on.
Interesting resources and links:
- AWS Zero Touch Secure Configuration Platform - Atmel Corporation
- Recipe for Innovation: Agile Model - Harvard Business Review Russia
- Top 7 project management methods: Agile, Scrum, Kanban, PRINCE2 and others - Project Services
- Visualization of integration applications - IT daily blog, news, magazine, technologies
- DevOps to help you - Computer Review
- Containers and virtualization: faster, more efficient, more reliable - IT daily blog, news, magazine, technologies
- Complete Docker Practical Guide: From Zero to an AWS Cluster - IT daily blog, news, magazine, technologies
- A Brief, but Practical Introduction to the MQTT Protocol and its Application to IoT - Zoetrope labs
- MQTT protocol. Features, applications, basic procedures MQTT Protocol - Technologies and means of communication
- SensorTag CC2650 sending data throw Raspberry Pi 3 to IBM Watson IoT Platform using Node-RED
- Miniature CC2650STK opens the door to the Internet of Things - COMPEL
- ESP8266 With DHT11 to AlexaPI to Dashboards - Instructables