Node-RED IOT Applications for Smart City

Smart Cities are becoming every day more focussed on basing their activities on IOT and IOE (Internet of Things/Internet of Everything). This has provoked a change of technology and approach in collecting data from the field. In the past, most of the data coming from sensors have been collected from vertical applications, sending data to dedicated concentrators. For example, the collection of data from lights, traffic flow sensors, parking, etc. All of them were using their own solutions for collecting data via radio, or other means. The new push of IOT is stimulating the cities in adopting the same gateways for collecting data of multiple services. This means that the structure of the sensor network has to be well designed and planned by the city. LoraWan can be an option, while in many cities the 5G solutions are coming and would replace former technologies at least in the large cities in short time.

    On the other hand, the arrival of IOT streams is not a problem for smart city data aggregators that serve the Smart City Control Room. They collect data from several sources, and risk may consist in having less data concentrators to be aggregated. On the other hand, the IOT/IOE is also strongly impacting on the infrastructure management since with the systematic adoption of IOT also arrived: the adoption of PUSH approach (event driven protocols), the possibility of acting on actuators and not only sensing the city, and the possibility of creating Event Driven Applications. They are also called IOT Applications that have to be capable to process messages and produce reactions in real time.

     In the state of the art, most of the IOT platforms adopt a code-based development for the IOT App. Some of them provide development tools as: Eclipse, or JavaScript. Others provide simple tools as IFTTT (https://ifttt.com/). Others platform adopt solutions similar to ETL processes capable to work for even driven or just surrogating with a high rate polling. One of the most promising tools for creating IOT App is Node-RED, which has been proposed by JS Foundation and it is based on Node.JS, as 100% open source. The Node-RED approach is a mix of visual composition of nodes/blocks to compose the so-called flows that are concurrently executed by an engine Node.JS. It is quite diffuse being also directly provided into official releases of IOT devices as Raspberry Pi family. It is provided with a minimum set of functionalities (the building blocks/nodes) while other blocks can be easily added loading them from a large library made available by the JS Foundation.

    For the usage in the context of Smart City it was not powerful enough to cope with the basic requirements of the domain even though its use in the field is widespread. The classical nodes provided in the standard version can be classified as: input, output, function, social, storage, analysis, advanced, and dashboard, and not sufficient for creating Smart City IOT Applications.

To solve this problem, in Snap4City, a collection of more than 150 MicroServices have been developed covering the following requirements. In particular, in the context of smart cities, the IOT Applications should be capable to create flow exploiting the following features which are covered only by Snap4City if not described elsewhere.

Smart City Entities Search: search and access to city entities and their relationships in the city. The data access should not be based on a simple database query since it would constrain the IOT App Developer to know all the tiny details of the many large storages adopted. To this end, a view based in terms of entities and MicroServices is needed to search and access in terms of city entities, such as: get data about bus, parking, light, POI, events, etc. The search should return information close to a point, along a path, in an area, etc. The resulting data may be one or more services, or paths, etc.

Historical Data: search and access to data collected over time into the smart city data aggregator independently on the source type. They could be the IOT data shadow, data collected in traditional PULL based ETL processes, databases of the public administration, etc. In this case, one may request the data on the basis of the identified services from the previous point.

Geo Information. This means that the developers may need to solve the so-called geo referencing. For example, passing from GPS coordinate to the Civic Number, from GPS to the close sensor, or from the certain sensor to its GPS coordinates.

Data Analytic. For this purpose, the classic Node-RED provides access to Watson IBM or to simple processing. The real need in the context of smart City is to have the possibility for a data-analysts of creating some data analytic processes (may be in R, Python, Java, etc.) and use it into the flow as MicroService without the intervention of a programmer nor administrator. This creates a strong flexibility to the IOT Applications.

IOT Device Connection. This means that the developers expect to have the possibility of using nodes for connecting to a large set of IOT devices using different protocols, and thus connecting to different kind of IOT brokers [7]. This feature is quite mature on Node-RED since in the library one can find a large collection of nodes covering tens of protocols. In some cases, the limitations are on security and authentication since in most cases, the username and password, or keys have to be included into the flow in clear.

Save and Get Personal Data: that could be time series tracking, click on mobiles Applications, POI, shapes, KPI, etc. For many smart city applications, the possibility of saving and retrieval of personal data enables a large variety of smart scenarios for the final users and operators.

Advanced Dashboards. This means to have the possibility of developing a real user interface of the IOT App (to render and produce data for the IOT network) and the possibility of adding to the user interface several kinds of graphic widgets even accessing directly to the smart city data or IOT devices without disturbing the IOT App such as: External Services, Micro Applications, Tracking, Origin destination tools, traffic flows, maps of any kind, etc. This also means that an IOT App may have connected multiple Dashboards, and a Dashboard may be connected with multiple IOT devices and IOT Apps [3]. This feature is also implemented in the Node-RED core with strong limitations

IOT Directory. It should be a single point service for searching, managing and discovering all the IOT Devices which can be connected to the infrastructure by means of a large set of heterogenous IOT Brokers [7]. Some of them can be internally managed while others can be managed by third party. The IOT Directory would provide a set of nodes into the flow for abstracting the connection of devices with respect to protocols and brokers. It includes the IOT Discovery that should be am integrated service for searching, managing and discovering all the IOT sensor/actuator independently from IOT Devices and Brokers they are connected to [1]. For example, to provide answer at queries such as: give me all temperature sensors close to my house (independently of the data provides, protocol, source, etc.).

Other services: such as advanced social media, logging events, connecting SMS, sending email, etc.

The Snap4City solution has formalized and implemented the above classed of MicroServices, and also created the infrastructure to manage in scalable manner the IOT Applications in containers [4], and mechanisms to guaranteeing end-to-end security [5]. In most cases, the simple Snap4City MicroServices abstract away low-level details from the consumers using the visual programming, hiding very complex and sophisticate tools and algorithms. For example, for providing: routing, spatio-temporal search and discovery, for data analytic, dashboarding, networking among IOT devices, IOT data abstraction, etc. They are distributed as two official libraries of Node-RED nodes (Snap4City Basic and Advanced) by the JS Foundation portal. And thus, they can be directly installed in any Node-RED tool of any operating system.

https://flows.nodered.org/?term=snap4city&num_pages=1

In addition, we have also developed an Android App executing Node.JS/Node-RED and our libraries to use it IOT Edge also exploiting mobile device sensors. Similarly it may work ono Linux, Raspberry pi, Windows, etc. In [2], we have demonstrated how work our solution in which:

IOT Applications = Node-RED + Snap4City Platform

In that case, to realize safety critical network of IOT Devices and IOT Edge, IOT App and Dashboards for managing mobility and transport applications.

References

  • [1]    C. Badii, P. Bellini, D. Cenni, A. Difino, P. Nesi, M. Paolucci, Analysis and Assessment of a Knowledge Based Smart City Architecture Providing Service APIs, Future Generation Computer Systems, Elsevier, 2017, http://dx.doi.org/10.1016/j.future.2017.05.001.
    [2]    C. Badii, P. Bellini, A. Difino, P. Nesi, "Sii-Mobility: an IOT/IOE architecture to enhance smart city services of mobility and transportation", Sensors, MDPI  https://doi.org/10.3390/s19010001  https://www.mdpi.com/1424-8220/19/1/1/pdf , 2019
    [3]    P. Bellini, D. Cenni, M. Marazzini, N. Mitolo, P. Nesi, M. Paolucci, "Smart City Control Room Dashboards: Big Data Infrastructure, from data to decision support", Journal of Visual Languages and Computing, 10.18293/VLSS2018-030
    [4]    P. Bellini, F. Bugli, P. Nesi, G. Pantaleo, M. Paolucci, I. Zaza, "Data Flow Management and Visual Analytic for Big Data Smart City/IOT", accepted to be presented at 19th IEEE Int. Conf. on Scalable Computing and Communication, SCALCOM 2019, Leicester, UK
    [5]    C. Badii, P. Bellini, A. Difino, P. Nesi, "Privacy and security aspects on a Smart City IoT Platform", accepted to be presented at 16th IEEE Int. Conf. on Advanced and Trusted Computing, ATC 2019, Leicester, UK.
    [6]    C. Badii, E. G. Belay, P. Bellini, D. Cenni, M. Marazzini, M. Mesiti, P. Nesi, G. Pantaleo, M. Paolucci, S. Valtolina, M. Soderi, I. Zaza, "Snap4City: A Scalable IOT/IOE Platform for Developing Smart City Applications", Int. Conf. IEEE Smart City Innovation, Cina 2018, IEEE Press.
    [7]    Valtolina, S., Hachem, F., Barricelli, B. R., Belay, E. G., Bonfitto, S., & Mesiti, M. (2019, July). Facilitating the Development of IoT Applications in Smart City Platforms. In International Symposium on End User Development (pp. 83-99). Springer, Cham.

paper submitted to iCities of CINI, smart city conference 2019