This offer is only addressed to commercial customers including freelancers and entrepreneurs. All prices are exclusive of value added tax (VAT).
  • Share via email
  • Subscribe to blog alert

Connect a demo device to the Bosch IoT Suite

What you will learn

 

This tutorial will help you connect a virtual demo device to the Bosch IoT Suite.

 

The VirtualDemoDevice device comes with several features:

  • a compass and a switch which help you understand how we ingest data from a device;
    optionally you can also use the geolocation coordinates,
  • an LED and a display which help you understand how you can communicate to the device,
  • and software update simulation.

 

virtual-demo-device
virtual-demo-device

Once your device is registered with our cloud service, you can access its values at the Bosch IoT Suite Console as well as via API.

Duration of the tutorial

Depending on how familiar you are with our concepts and how many of the steps you like to proceed, the tutorial would take you between 30 minutes and half a day (smile).

  • If you have only 30 minutes left, you should be able to register the device and connect it to the Bosch IoT Suite services.
  • The software update scenario might take you another 30 minutes up to one hour, depending on how familiar you are with the Bosch IoT Rollouts user interface.
  • In case you want to see your data visualized on a custom dashboard, try out the extension with Bosch IoT Insight, which will keep you busy for another 30 minutes.

What you need to prepare

Hardware:

  • This tutorial was explicitly designed in a way that it does not need a physical device.
  • However, if you have a smartphone you can run the virtual demo device in a browser on the smart phone

Software:

  • We recommend using the Mozilla Firefox browser for this tutorial.
  • All services will run in the Bosch IoT Suite cloud environment. Thus, at this point we assume you have already a valid subscription.
    Otherwise please proceed at How to subscribe to a Bosch IoT Suite service, and come back here to meet the demo device later.
  • In case you try out the software update scenario, you will be asked to prepare a software distribution on your local machine. However this does not need to be an executable file. An empty text file in zip archive would suffice for the demo.

In this example, you will use the Bosch IoT Suite infrastructure and learn how to register a device, and access its values over the API.

Wiring:
Demo device > HTTP > Bosch IoT Hub > AMQP > Bosch IoT Things > HTTP > Bosch IoT Suite Console

For software updates, the data flow is directed to the device:
Demo device < HTTP < Bosch IoT Hub < AMQP < Bosch IoT Things  < Bosch IoT Manager < Bosch IoT Rollouts

Tasks to complete

Register your demo device with the cloud service

Use the developer console to provision the device.

  1. Click Provisioning in the left sidebar.The Settings view will guide you with the required input for provisioning:
  2. From the first drop-down, choose Use Vorto information model.
  3. In the new view you will see all Vorto models available.
    Select the row of the model VirtualDemoDevice (version 2.0.0).
  4. In the new view you will see details for the demo device.
    Click Select to confirm this is the model for your demo device.
  5. Set thing/device ID: First, select a namespace.
    In case you have not set up a namespace yet, see Register a namespace.
  6. Enter a unique name.
    The full identifier that our Hub and Things service will register is “your.namespace:your-device-name”.
  7. Provide credentials for your device authentication.
    Username and password are pre-selected.
  8. Enter a password in plain text.
  9. Confirm with Next.images/confluence/download/attachments/1634787919/demo-provisioning.png

    As you might need other options when you will later provision a different type of device, keep in mind that each info (i) icon on the user interface will provide further help instructions to guide you into the right direction.

  10. The preview will indicate green markers if all entry values are valid.
    • In case something went wrong, you can inspect the Request body.
    • Proceed with Send request.
  11. The Connect device view will indicate your successful request:
    • Further it presents useful links for setting up the device;
    • Remember the password or store it safely, as you will never see it again in plain text in the console;
    • The Go to thing button will open the thing details in the Things section.

Icon illustrating the generation of firmware.

Connect the demo device

Open the demo device in a new browser or on your cell phone.

The demo device is pre-configured with all the information a real device would need to present, in order to successfully connect to the Bosch IoT Suite.

The sensor values are reported to your cloud infrastructure in intervals of 5 seconds. In case you want to change the configuration feel free to do so.

Enter the password and click connect.

images/confluence/download/attachments/1634787930/connect-geo.png

The geolocation feature is not active by default, as the idea is that you mobile send us its real location which will be stored in our service.

To increase awareness, as an “owner” of the device you need

  • to actively express your consent – check the respective checkbox before connecting
  • and also to “Allow Location Access” for the browser used.

In case you want to simulate more devices, don’t try to connect the same device via multiple browser windows simultaneously, but provision as many devices as needed instead.

Icon-modify code

Let the demo device send telemetry data

Compass

Rotate your cell phone (or use the slider in the browser version) and check whether the changed feature was updated in its thing view.

demo-device-compass Source: demo-device-compass

Tip

As the demo device is implemented with two function blocks which can process a “setColor()” function, you could also send the message to the LED function block instead.

In fact the “correct” way would be to send the message to the LED feature.

But to showcase that also the entire thing can receive and process messages, the virtual demo device supports both ways.

Switch

Toggle the switch and check whether the changed feature was processed in its thing view.

demo-switch Source: demo-switch

Tip

As the demo device is implemented with two function blocks which can process a “setColor()” function, you could also send the message to the LED function block instead.

In fact the “correct” way would be to send the message to the LED feature.

But to showcase that also the entire thing can receive and process messages, the virtual demo device supports both ways.

Icon-modify the firmware to send real data

Remote control the demo device

The actors on the demo device are able to consume messages sent remotely.

LED

Use the Bosch IoT Suite Console to send a message to the LED of the demo device and check the changed color.

E.g. setColor to red:

{"r":255}
demo-device-LED Source: demo-device-LED

Tip

As the demo device is implemented with two function blocks which can process a “setColor()” function, you could also send the message to the LED function block instead.

In fact the “correct” way would be to send the message to the LED feature.

But to showcase that also the entire thing can receive and process messages, the virtual demo device supports both ways.

Display

Use the Bosch IoT Suite Console to send a message to the Display of the demo device and check the displayed text.

E.g. setText to:

TEST the demo

Details: the subject is setText , message type is Text (select it from the drop-down), the Message payload is TEST the demo, and the feature capable to process such a message is the display.

demo-device-display Source: demo-device-display

Further reading

A closer look on the Vorto model > function block would reveal the magic behind.

  • setColor() operation on thing or LED feature is handled by
    • https://github.com/eclipse/vorto/tree/development/models/#/details/com.bosch.iot.suite.example.octopussuiteedition:LED:1.0.0
    • https://github.com/eclipse/vorto/tree/development/models/#/details/com.bosch.iot.suite.example:LedLamp:1.0.0
  • setText() operation is handled by
    • https://github.com/eclipse/vorto/tree/development/models/#/details/com.bosch.iot.suite.example:Display:1.0.0

Messages section on device

The messages section shows the latest messages for the device-to-Hub communication, which is best suited for debugging this specific part of the connection.

Once the changes are reported back to the thing, a log can be activated in the Connections UI for further tracing, e.g. info if it could be consumed and forwarded to other applications listening for changes.

Tip

The notation for these messages conforms to the Eclipse Ditto protocol. This is necessary because the Hub-to-Things communication uses AMQP.

Find details and further examples at https://www.eclipse.org/ditto/protocol-specification.html.

Icon-illustrating the adaption of firmware.

Software update

Troubleshooting

In case of irregularities during the process check this section for help.

Troubleshooting – demo device