How to build an alert system with Bosch XDK prototyping platform

0. Introduction

In this tutorial you will learn how to use the XDK and XDK Workbench, a programmable sensor and prototyping platform.

For a deeper explanation of what it is and what you can do with the XDK, please go to the official documentation,

  • Use the main features of XDK Workbench.
  • Send streams to Altair SmartCore using MQTT.
  • Use some sensors of the XDK.
  • Create and use Altair SmartCore Listeners.

TOP

1. Requirements

To follow this tutorial, you will need:

  • XDK
  • XDK Workbench installed in your computer.

You can download XDK Workbench here.

TOP

2. Project & Device Registration

Device:

If you are registered in Altair SmartCore, you have a default device already created for you. Check your control panel and see what it looks like. Basically you need the device id_developer that might be something like defaultDevice@myusername. But if you want, you can create a new device and use it for this tutorial.

Apikey:

Now, please go to “Settings” → “Apikeys” section of the Altair SmartCore control Panel and check your Apikey. Its a big alphanumeric token like: 98346673a6377ef1fde2357ebdcb0da582b150b00cabcd5a0d83045425407ab4. You will need this number to follow this tutorial.

3. Project Schema

In this project we will create an alert system. The XDK will send the value read by the thermometer to Altair SmartCore using MQTT every 10 seconds. In Altair SmartCore we will create a Listener that will send us an alert email every time the temperature is lower than 5ºC or higher than 35ºC.

4. Next steps in XDK Workbench

First of all, you have to create a project based on the example of SendDataOverMQTT. You can do it by clicking on the “SendDataOverMQTT” button of the Welcome page.

Now, in the file “SendDataOverMQTT.h” copy the next code and complete the missing data with your personal ones.

The next step is to copy this code and replace some data by yours in the “SendDataOverMQTT.c” file. We have deleted some of the default functions because we don’t use them.

Now, turn on the XDK, connect it to your computer and flash the project on it by clicking on the flash button.

5. Altair SmartCore Listener

Everything is done in the XDK side, now it's time to work with the data received. Let's create the listener in Altair SmartCore.

That's all, now it's your turn to play and try to build a more complex project!

If you need help use the developers forums. Enjoy Altair SmartCore and XDK!

TOP