Rapid prototyping of the Internet of Things devices
Designing distributed systems, which are solutions in the field of the Internet of things (IoT) - is a complex and painstaking process. If we talk about the social component of IoT, then it is necessary to take into account the peculiarities of the interaction processes at the device level, people, and also not to forget about the opportunities that can be not just added as an external process, but also be made part of a system that will already be based on the principles of social self-organization communities. Undoubtedly, this is very interesting and promising, both for an ambitious startup and simple enthusiasts, for example, those who are engaged in the improvement of the 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 the formation of the project idea, and completing the prototyping of social IoT, it would seem that there are many approaches and options for their solutions. At the same time, in fact, already today, a certain de-facto architecture was formed for building solutions in the field of the Internet of things and setting up ways of their interaction with social networks.
Undoubtedly, 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 board development, low-level programming, and then the solution will be implemented at the web service level, etc., or ready-made components and systems will be used instead, and the developer will act as an integrator. It is clear that now low-level programming is not an assembler, but C / C ++ for a microcontroller, but still this is not a way to use a script-oriented language or a graphical programming language, for example, how this can be done in the National Instruments LabView system of virtual instruments. ')
Everywhere there is a compromise. Practically any electronics manufacturer for its 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 PCB layout and main software solutions are already provided by the manufacturer, this approach allows the developer to speed up the process of mastering, for example, a new microcontroller, microprocessor, operational amplifier, etc.
For example, the AWS Zero Touch secure configuration platform based on Microchip's ECC508 chip enables you to develop secure solutions based on the AWS IoT cloud. In fact, it is a software and hardware solution for reliable and secure authentication of IoT devices in the Amazon cloud service. The chip maker launches the AT88CKECC-AWS-XSTK starter kit with secure configuration and demo functions to quickly begin developing and prototyping their devices.
The AWS Zero Touch Secure Development Platform.Photo: Microchip Technology.
Such boards and starter kits often provide either a single component for review, or have additional elements and blocks in their composition, for example, to study all the features of a particular product. Sometimes, familiarization boards do not even contain mounting holes, which largely negates the creation of a prototype based on them, i.e. In this case, do not do without the development of a printed circuit board.
Obviously, the emerging projects of Arduino , Raspberry Pi , etc., the so-called open or free electronic projects allow you to quickly and efficiently prototype IoT devices. These products bring a certain level of unification to the development, and their open nature allows to improve or modify the existing functionality to solve a specific problem. In fact, it all depends on the competence of the developer, as well as the timing and limitations of the project.
Since there are a lot of ready-made solutions at the level of sensors and executive systems for developing IoT devices, it is logical to consider a fairly typical development option at the prototyping level based on open electronic projects. Anyway, after the prototype, it is logical to wiring the board, order its production and take care of a convenient case for the product.
However, fascinated by reflections on the implementation, we forget about the basic foundation of design. Indeed, at the beginning of any project, it is necessary to decide how the project will proceed: “from bottom to top” or “from top to bottom”. Those. First, the developer goes deeper 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, the system framework or its concept is first developed in one form or another, and only then the developer works out 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 related to electronics or hardware, should come to our aid. It is a completely wrong opinion that these approaches are valid only for the development of software products.
IoT, being essentially a very complex distributed system, may well be described at the level of an object-oriented model, and as a result, it can also provide tools for designing, for example, the use of UML diagrams. Just to understand the asynchronous processes that are the basis of the interaction of the Internet of Things, you need diagrams of components, packages, activities, synchronization, etc. And as a result of using 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 manifesto 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 agreeing the terms of the contract; willingness to change is more important than following the original plan. "
Therefore, for the project of the social Internet of things, you should first think over and work out the vision of the platform from 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, the choice and configuration of services of well-known cloud solutions, for example, AWS IoT, Azure IoT Suite, Watson Internet of Things or others.
Now for a general presentation and independent research in the direction of IoT projects, the Node-RED product developed by IBM, and now available under an open-source license of JS Foundation projects, has confidently entered the first positions. Then everything is simple, the project will constantly undergo iterations of decision analysis and the addition of new functionality.
For a relatively small project, the configured process in the Node-RED will actually become, thereby, a minimally viable product ( MVP ) that users and, for example, the customer can immediately see and evaluate. Next, you can improve the logic of the system as a whole based on the online service and begin to plan the connection of IoT end devices. At the same time, we 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 viewed not only as a software and hardware solution that can be run locally on the Raspberry Pi and start collecting data from sensors, but also as a service that provides visual design of the interaction between 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 integrator of the smart home a handy 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 service from Sense Tecnic Systems. You can also run the system based on the prepared Boilerplate template for IBM Bluemix, AWS Elastic Beanstalk Service (EBS), or based on the Ubuntu Server virtual cloud, Amazon Web Services, Microsoft Azure, etc.
But if you 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 application of DevOps methodology becomes relevant. It is the interaction of development and operation teams 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 a product, but also during the operation of all its services and systems. And as you know, at the moment, container virtualization based on Docker has become the de facto standard for implementing DevOps techniques.
Therefore, there are big prerequisites and grounds, for example, to study the operation of complex web solutions, such as Node-RED, or simply configure them, to deploy such a system in the Docker container on the local computer. Then you can migrate development to the cloud or look towards alternative solutions and 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 confidently 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 installation in the desktop operating system environment, work with Docker is performed at the command line level. Now, however, you can already use the graphical shell Kitematic.
Dock 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 the container on its basis, only one line is required:
docker run -it -p 1880:1880--name mynodered nodered/node-red-docker
Next, in order not to stop the operation of the container and leave the Docker command line, you need to press the keys: "Ctrl-p", "Ctrl-q". To get the container command line, run the following command: docker exec -it mynodered /bin/bash to stop the container: docker stop mynodered and to restart: docker start mynodered . As it has already become clear, Node-RED will be available at the virtual address that Docker will create and 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 add-on component, the Node-RED-Dashboard visualization panel, on the command line of the mynodered container, execute the following commands:
$ cd /data $ npm install node-red-dashboard $ exit
It should be noted that it is quite possible to install the Node-RED extensions in the web interface of the system: “Menu-Manage Palette”, but still the command line is convenient and fast.
So, at the top level of our social IoT ecosystem there will be a cloud running a container-based Node-RED service on a dedicated virtual server or running on a cluster of containers, in fact, this is already a talk about project scaling. The main thing, due to container virtualization, we will be almost all the same where to debug a Node-RED application - locally or in the cloud.
Another question is, 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. It is interesting on this account the opinion of the 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 the IoT gateway and it is better to consider it in the context of the coordination of intelligent sensors and actuators with top-level systems. But the Flogo project of TIBCO Software deserves attention, because it is also positioned by developers as a faster solution, since unlike Node-RED, written in NodeJS, Flogo is developed in the Go language. But essentially Flogo is also a gateway, although there is another application for it as a microservice constructor for IoT. This is an interactive constructor in the context of event-oriented logic of microservice. You can imagine Flogo functionality with Docker: “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 functional, it becomes logical to move to the intermediate layer of the system under consideration - the interface of the sensors and IoT mechanisms interaction with the web service level. This is a place for single-board computers and the Raspberry Pi platform, as the most convenient solution for experiments. Here, also already exists, the de facto standard is the exchange of messages according to the “publisher / subscriber” model using the Message Queue Telemetry Transport (MQTT) protocol. Interestingly, MQTT was proposed 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 of Eclipse Mosquitto, HiveMQ, or others. In this case, everything 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 the 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 connection to the Internet, will allow for the autonomous operation of the system. Of course, this interaction should be based on the MQTT protocol.
On the basis of Raspberry Pi with solutions on Node-RED, Kura or others, it is possible to implement a system that allows combining sensors to work, for example, as suggested in the article “Interaction of machines and people in the social Internet of things”. In the comments to the article (@ Mobile1), the SensorTag solution from Texas Instruments was noted, although it looks very tempting, it is still a demonstration device designed to study the Texas Instruments CC13xx / CC26xx platform. As a conceptual solution for sensors and actuators for the implementation of IoT, the approach looks interesting: 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, solutions from Wemos were mentioned, which perfectly implement the concept of the Internet of things, but they clearly lack the functional building and at least the presence of mounting holes on the board, for example, as implemented in the Sonoff ITEAD Intelligent Systems series of devices (@ IvanT, cheshircat ). Thanks to a constructive dialogue, topics for new articles appear.
Unfortunately, in one article "it is impossible to grasp the immensity." In the continuation of the publication, as the reader has already guessed, we will consider some idealized implementation of social IoT based on the proposed three-tier architecture and modern design methodologies. By the way, about the methodology, of course, an individual developer, a geek, is unlikely to need to think at all about project management, but if a team is working on solving a problem, there is something to think about.