IoT Smart Factory Hackathon: CodeStarter @ Red Hat Summit
IoT Smart Factory Hackathon: CodeStarter @ Red Hat Summit
Among the many IoT events at the May 2017 Red Hat Summit, this crowdsourced end-to-end smart factory solution, using simple components and open source tools, stood out.
Join the DZone community and get the full member experience.Join For Free
At the Red Hat Summit in Boston last month, one IoT event stood out from the rest – a CodeStarter hackathon that brought together 80+ IoT enthusiasts to learn, tinker, and build an end-to-end IoT solution. The result was a complete IoT application that seamlessly integrates across IT and OT (Operations Technologies).
The CodeStarter was based on the Industry 4.0 use case of a smart factory: The physical systems are abstracted in a digital form and interoperate with other systems through open APIs. In addition, the decision-making is decentralized, i.e. moves closer to the edge and is automated through pre-defined rules. The ability to make decisions at the edge allows urgent problems to be solved in near real time, resulting in factory equipment and personnel safety and improved efficiency.
The CodeStarter setup included the following components:
- Raspberry Pi connected to sensors/actuators to emulate the factory environment.
- IoT Gateway (Eurotech ReliaGATE 20-26) to provide intelligence on the edge.
- IoT Cloud Integration Platform (Eclipse Kapua) to manage gateways, devices, and their data.
- OpenShift Container Platform as the foundation where IoT services and business applications run.
The Raspberry Pi was connected to sensors and actuators, acting as an emulator of a real factory Programmable Logic Controller (PLC).
For the CodeStarter, the Raspberry Pi was connected to:
- A water sensor
- A fan
- A temperature sensor
- A LED
- A buzzer
- A light sensor
The intelligence on the edge was provided by the Eurotech ReliaGATE 20-26, a powerful IoT gateway that was running the recently announced Eclipse Kura 3.0, the edge computing platform for IoT, that introduces many new features for the edge computing, like Eclipse Kura Wires, an implementation of visual programming that can be used to simplify the development of solutions on the edge.
Furthermore, Kura 3.0 introduces a set of changes to simplify the management and the connection to multiple cloud services, including the open source IoT cloud platform Eclipse Kapua.
Finally, the latest version of Kura introduces a completely new set of APIs to ease the interaction with sensors, actuators and PLCs over fieldbus protocols (e.g. OPC-UA).
After an initial introduction of the new features and a description of the scenario, the CodeStarter participants were invited to:
- Experiment with the complete solution using real IoT hardware.
- Try to replicate the completed solution in a virtual environment.
- Combine modern app development with IoT.
Getting to Know Eclipse Kura Wires
Eclipse Kura Wires is a visual programming tool for creating data flow built on top of the usual Kura Java/OSGi stack. It eases application development by allowing the developer to express the application logic as a directed graph, without the need to interact with the underlying Java code and device complexities. In this way, the developer, interacting with simple nodes and connections, can easily prototype a solution working at a high level of abstraction and without sacrificing flexibility.
The following components of Kura Wires were used for the CodeStarter:
Timer: Starts the flow by generating a message that triggers the downstream components.
Publisher: Receives a message and publishes its content to the cloud platform.
DB Store: Stores the received data in a DB table. Has rules for data cleanup and retention.
DB Filter: Uses a SQL query to filter DB stored messages.
Logger: Logs the received data in the Eclipse Kura log. Used for debugging purposes.
In addition, Kura Wires used the following components of Kura:
- Drivers: Low-level components responsible for the communication with the sensors and actuators.
- Assets: Allows interaction with the devices through channels. A channel is a logical entity to specify what should be transferred to/from the driver. It makes the device available for on-demand read/writes via Java APIs or via the cloud through REST calls and MQTT.
For more information about Kura Wires, you can visit Kura Wires: introduction and references.
Demo With IoT Hardware
During the first phase, the participants could experiment with real IoT hardware and see how a Kura Wires graph could control, via OPC-UA, the sensors, and actuators connected to the Raspberry Pi that was acting as an industrial PLC.
The Kura Wires graph could trigger the fan, light or buzzer per the following conditions:
- Turn on Fan if temperature >25 C and no water leak detected.
- Turn on Buzzer in the case of a water leak detection.
- Turn on LED if light < 200 lux.
Hackers at Work on a Virtual Environment
A Virtual Box-based VM image provided all the components needed to build the data flow. To configure and test the setup in the virtual environment, the participants had to:
- Start the Eclipse IDE and run the Kura Emulator. A proper Kura application was deployed and started to simulate the sensor data and act as an OPC-UA endpoint.
- Configure the Kura cloud service to connect to the Kapua broker.
- Configure the Kura driver and Asset to point to the simulated OPC-UA device.
- Use Kura Wires to control the actuators and publish the fetched data to the Kapua cloud service.
The participants implemented the same rules they experienced with real IoT hardware. They had, also, the possibility to earn bonus points by modifying their graphs and adding the following:
- Store data and publish 1-minute averages.
- Stop Fan if the light is low.
- Turn on Buzzer and LED if a water leak is detected.
Combining Modern App Dev With IoT
Developers configured, built, and deployed the sample app on OpenShift through the step by step exercise:
- Login to OpenShift CLI.
- Download sample app code.
- Configure the app.
- Build and run the app locally.
- Deploy the app to OpenShift.
- Access the app in the browser.
- Edit the app.
- Display data visually.
Developing containerized applications allows developers to write an IoT application once that could be deployed anywhere: from cloud to edge. As containers consist of infrastructure and application components, it allows multiple teams to collaborate on container creation. These containerized applications can be continually integrated and deployed, bringing the benefits of modern app dev practices to IoT.
Taking the CodeStarter Hackathon Home
As with any good open source project, all the code and documentation is available on GitHub for anyone to recreate the CodeStarter experience. In order to run the CodeStarter, all you’ll need to do is provision an instance of Kapua cloud service. Setting up Kapua on the OpenShift container platform is fairly straightforward (thanks to Henryk’s instructions).
Also, at the CodeStarter event, the commercially supported IoT Gateway (Eurotech ReliaGATE 20-26) was used to connect with edge devices but is not a mandatory requirement for the tutorial. Eurotech offers a family of IoT gateways for your IoT projects.
For businesses looking for commercially supported offerings of the community projects being used at the CodeStarter here is the project-to-product mapping:
At the CodeStarter event at Red Hat Summit, participants built an end-to-end IoT solution leveraging the latest IT and OT (Operations Technologies). Based on the Industry 4.0 use case of a smart factory, the CodeStarter setup included Eurotech ReliaGATE 20-26, a powerful IoT gateway running the Eclipse Kura 3.0, the edge computing platform for IoT. Kura provided interaction with sensors, actuators and PLCs over fieldbus protocols (e.g. OPC-UA).
The participants were able to experiment with the complete solution using real IoT hardware, replicate the completed solution in a virtual environment and finally, use modern app development practices using OpenShift Container Platform.
For those interested in recreating the CodeStarter experience, all the code and documentation is available on GitHub.
Though many people were involved, special thanks go to Benjamin Cabé (Eclipse Foundation) and David Woodard, Matteo Maiero, Marco Carrer (Eurotech) and James Falkner, Chris Custine, David Bericat (Red Hat) for conceptualizing and putting together the event.
I’d like to thank Matteo Maiero, Software Engineer, Eurotech who helped me with this post.
Published at DZone with permission of Ishu Verma , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.