Publish Data from BOSCH XDK to Qubitro IoT Platform

  1. Qubitro account, create here for free: click here
  2. BOSCH XDK110 device, specification: click here
  3. XDK Workbench, download for free: click here

Step 1. Create Qubitro Project

Create a project on Qubitro
Create a device on Qubitro
Qubitro MQTT credentials

Step 2. Code the BOSCH XDK

Connect XDK110 to XDK Workbench
```javascript
package main;
import platforms.xdk110;
// resource for accelerometer
setup accelerometer {
bandwidth = BW_500Hz;
range = Range_8G;
}
// resource for gyroscope
setup Gyroscope_BMI160 {
bandwidth = BW_10_7Hz;
range = Range_250s;
}
// resource for light sensor
setup light {
manual_mode = false;
}
// resource for environment sensor
setup environment {
power_mode = Normal;
standby_time = 1000;
temperature_oversampling = OVERSAMPLE_1X;
}
// resource for WiFi connectivity
setup wifi : WLAN {
ssid = 'YOUR_WIFI_NAME';
authentication = Personal(psk = 'YOUR_WIFI_PASSWORD');
}
// resource for Qubitro MQTT Broker
setup qubitroBroker : MQTT {
transport = wifi;
cleanSession = true;
url = 'mqtt://broker.qubitro.com:1883';
clientId = 'YOUR_QUBITRO_DEVICE_ID';
authentication = Login('YOUR_QUBITRO_DEVICE_ID', 'YOUR_QUBITRO_DEVICE_TOKEN');
var qubitroTopik = topic('YOUR_QUBITRO_DEVICE_ID', 0);
}
// create event: every 5 sec read sensors & send to Qubitro
every 5 seconds {
// read sensors
var accx = accelerometer.x_axis.read();
var accy = accelerometer.y_axis.read();
var accz = accelerometer.z_axis.read();
var gyx = gyroscope.x_axis.read();
var gyy = gyroscope.y_axis.read();
var gyz = gyroscope.z_axis.read();
var light = light.intensity.read() / 1000.0;
var temperature = environment.temperature.read() / 1000.0;
temperature = temperature - 6.5975;
var humidity = environment.humidity.read() / 1000.0;
var pressure = environment.pressure.read() / 1000.0;

// create JSON string
var json = `{
"accx": ${accx}, "accy": ${accy}, "accz": ${accz},
"gyx": ${gyx}, "gyy": ${gyy}, "gyz": ${gyz},
"light": ${light}, "temperature": ${temperature},
"humidity": ${humidity}, "pressure": ${pressure}
}`;
// publish data to qubitro
qubitroBroker.qubitroTopik.write(json);
println(json);
}
```

Step 3. Create a dashboard on Qubitro

Datastream
Data analytics
Dashboard

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Qubitro

Qubitro

Infrastructure for the Internet of Things solutions. Build connected solutions faster than ever.