Creating IoT products can be difficult because it brings together two different aspects of software development: Frontend developers, who are experts in embedded devices and communication protocols, are mostly concerned with hardware and operational aspects. Backend developers, on the other hand, focus on web, mobile, and business applications, and deal with the integration and analysis of data that provides insights.
How do you bridge this gap and bring these two fields of expertise closer together? The digital twin analogy can be helpful since it provides a holistic view of most of the capabilities of an IoT asset. This makes it Using the Eclipse Ditto project as an example, we can show you what digital twins in the IoT are all about.
Source: Eclipse Ditto
Eclipse Ditto doesn’t directly integrate devices. Its focus lies on providing APIs for web applications, mobile applications or other backend services.
What are digital twins in the context of Eclipse Ditto? For us, digital twins are mainly a mechanism for simplifying IoT solution development. A digital twin mirrors physical devices in the cloud. On the one hand, it allows access to specific aspects of a device, enabling you, for example, to evaluate device data. On the other hand, digital twins offer the opportunity to provide additional services around the device, such as enhancing the virtual representation of a device with weather data, or by adding information about its spare parts.
The digital twins concept often also includes the simulation of devices. You can create a digital twin of a device before it’s even manufactured or deployed. You can then simulate the device in use before it is deployed in the real world and use the APIs before the device begins sending data.
Source: Eclipse Ditto
The Eclipse Ditto microservice architecture showing microservice interaction, external dependencies and exposed & consumed interfaces.
The Ditto model
Eclipse Ditto provides a framework that enables you to work with, and manage, the state of digital twins. It builds the bridge between real-world IoT devices and their digital twins.
Putting this into context: Eclipse Ditto doesn’t aim to directly integrate the devices. Other options are better suited for this purpose, such as Eclipse Hono. Eclipse Ditto focuses instead on providing APIs for web applications, mobile applications, or other backend services, that use a WebSocket API, an AMQP 1.0 endpoint, an AMQP 0.9.1 Broker or an HTTP API. Connectivity via an MQTT 3.1.1 Broker was also added recently.
Eclipse Ditto follows a modular structure. You only need the things service and the gateway service, as well as MongoDB, to have a minimal Eclipse Ditto runtime. If needed, the connectivity service (which can connect to AMQP 1.0, AMQP 0.9.1 or MQTT), a detailed policies service, or a search feature, can be added to Eclipse Ditto.
Two points of view: twin vs. live
At its heart, the digital representation of a physical device exists to give indications of the state of that device. Eclipse Ditto approaches this by way of two communication channels: the twin and the live channel.
Source: Eclipse Ditto
The twin perspective of Eclipse Ditto describes a persistent data structure that is linked to devices and stores their last reported state.
The twin perspective of Eclipse Ditto is akin to a database but it goes beyond that: It’s a persistent data structure where devices connect to and store their last reported state. Applications can read out this last reported state and be notified about changes. This can be done through the respective protocol endpoint. Devices also use these endpoints to update their state in the database or get notified if an application wants to modify something in the device. Ditto enforces access control with every API call. In conclusion, this means that Ditto processes commands and emits events in twin view.
Then there is the live view. In this case, Ditto functions as a router. Ditto does the relaying/routing and enforces access control. An application might want to access the temperature of a sensor. But it wants to receive the live value, not the persistent one. Ditto then routes this message to the device. In this case, Ditto doesn’t process the commands and emit the events. This is done by the applications and the devices. Ditto just relays the information.
Source: Eclipse Ditto
In the live view, Ditto functions as a router.
A framework for digital twins
Eclipse Ditto is part of Bosch IoT Things
Bosch IoT Things is a fully managed cloud service with the open source core of the Eclipse Ditto project. The Things service is part of the Bosch IoT Suite portfolio and helps applications manage the digital twins of IoT devices.
Try Bosch IoT Things now
The overall goal of Eclipse Ditto is to establish a framework for digital twins. The focus lies on the orchestration between real-world devices and their virtual representations. For example, you can enhance a twin that is location-aware with weather data. Take a car as an example: it provides Ditto with location information in form of longitude and latitude every five minutes. This car travels from one location to another. Meanwhile, you can ask a weather service to provide weather data at the current location of the car. This data is fed back to Ditto. Thus, the twin is always aware of the weather conditions around the car’s current location.
You can also enhance the twin with an API for the spare parts that are available. Imagine you have a lawn mower. You can then send a query via the API to get a list of all the existing spare parts. This message is routed through Ditto to a Java backend, running in a corporate network, for example. The backend can call up a database for all the spare parts of the lawn mower. This information is then reported back to the digital twin.
Virtual IoT meetup on Eclipse Ditto
Aspects Eclipse Ditto covers
- In IoT development, there are many needs and requirements, not just on the device itself, but also in the backend. Ditto helps turn physical devices into services; it lets you treat them like services.
- Thanks to Ditto, you can directly communicate with your devices over the APIs. If the devices are currently not online – or only send data from time to time – you can access the last known data they have sent.
- Ditto allows you to enhance the APIs of the devices with further functionality that the devices themselves are not able to provide. A device might just provide sensor data. You can enhance this with additional data that is computed elsewhere or is pulled from the cloud.
The post Eclipse Ditto: How digital twins boost development in the IoT appeared first on Bosch ConnectedWorld Blog.
Original article: Eclipse Ditto: How digital twins boost development in the IoT
Author: Thomas Jäckle