XDK110

Overview: The XDK110

The Bosch Cross Domain Development Kit (XDK) is a programmable sensor device for building IoT applications. It contains a wide range of sensors and means of connectivity and is extensible using its extension bus. Due to its versatility it also serves as reference platform for Mita.

To learn more about the XDK head over to http://xdk.io.

Implemented System Resources

Currently implemented sensors, connectivities and buses in the XDK110 platform:

Sensors Connectivities Buses
Accelerometer LED GPIO
Gyroscope BLE I2C
Humidity WLAN
Light
Pressure MQTT
Temperature REST over HTTP
Two buttons

For the gyroscope you can choose from three different variants:

  1. Pre-calibrated, more robust through sensor fusion
  2. Direct access to BMI160
  3. Direct access to BMG160

Configuration

Binary Name

To customize the produced binary name configure XDK110.applicationName : string. The default name is MitaApplication:

setup XDK110 {
  applicationName = "ShockDetector";
}

Sensors

Any sensor can be used without configuring it. It will be initialized with sensible defaults. If you want to change a sensor’s default hardware parameters just set it up, e.g. the accelerometer:

setup accelerometer {
  // change the bandwidth of the low-pass filter
  bandwidth = BW_1000Hz;
}

Content assist (CTRL+Space) will provide you with all available configuration items and their valid values.

Temperature, pressure and humidity are available from a single resource: environment.

Connectivities

Hardware

Hardware connectivities are available as named singletons: this means that you can configure each connectivity only once and need to give it a name. These connectivities however offer multiple instantiation of their signals. This means that for example the LED resource can provide up to three different signals for the yellow, orange and red LED.

Software

Software connectivities can have as many instances as you want. Both HTTP REST and MQTT require you to specify a WLAN instance as a transport layer.

Buses

GPIO

GPIO is a named singleton: you can instantiate it once and need to give it a name. Each of the 21 available GPIO pins can be configured as either input or output. Input pins can be operated in different modes:

  • pull up/pull down: the pin is connected to high or low via a resistor, so that if the pin is not driven from the outside it returns to a set state.
  • pull up with glitch filter: like pull up except for small glitches being filtered out.
  • no pull: the pin floats freely, i.e. if it is not driven it keeps its current state except for environmental influences and self-drain.

I2C

I2C can be instantiated multiple times so you can model different devices on the same bus. You can exchange either single words from one to four byte or complete messages as arrays of integer words. For multi-byte words, both little and big endianess are supported with the default being the XDK’s endianess, little endian.

Events

Some sensors provide events you can react to. These events are things like “device moved” (accelerometer.any_motion) or “button was pressed” (button_one/button_two.pressed).

The platform itself provides a special startup event which is triggered after the device has fully started up. This means that all resources are initialized, for example WLAN is connected, sensors collect data, and all events are enabled.

Specification

Sensors

Accelerometer (BMA280)

The BMA280 is a tri axial, low-g acceleration sensor with digital output for consumer applications. It allows measurements of acceleration in three perpendicular axes.

Configuration

Name Description
range : BMA280_Range The range of acceleration we want to measure. Default: 2G
bandwidth : BMA280_Bandwidth The low-pass filter bandwidth used by the BMA. Default: 500Hz
any_motion_threshold : uint32 The threshold of acceleration that has to be crossed before an any motion event is triggered. Default: 20
no_motion_threshold : uint32 The threshold of acceleration that must not be exceeded for a no motion event to be triggered. Default: 20

Modalities

Name Description
x_axis : int32 The X axis of the BMA280.
y_axis : int32 The Y axis of the BMA280.
z_axis : int32 The Z axis of the BMA280.
magnitude : int32 The L2 norm of the acceleration vector: sqrt(x^2 + y^2 + z^2)

Events

Name Description
any_motion The any motion event (also called activity) uses the change between two successive acceleration measurements to detect changes in motion. An event is generated when this change exceeds the any_motion_threshold.
no_motion The no motion event (also called any inactivity) uses the change between two successive acceleration measurements to detect changes in motion. An event is generated when this change consecutively stays below the no_motion_threshold.
low_g The low g event is based on comparing acceleration to a threshold which is most useful for free-fall detection.
high_g The high g event is based on comparing acceleration to a threshold to detect shocks or other high acceleration events.
single_tap A single tap is an event triggered by high activity followed shortly by no activity.
double_tap A double tap consists of two single tap events right after one another.
flat The flat event is triggered when the device is flat on the ground.
orientation
fifo_full
fifo_wml
new_data This event serves the asynchronous reading of data. It is generated after storing a new value of z-axis acceleration data in the data register.

Gyroscope (Calibrated, Sensor Fusion)

This sensor is a front end for a software library that improves on accuracy and physical limititations of the built-in sensors using sensor fusion.

Alternatively you can access two hardware sensors directly: BMI160 and BMG160

This virtual sensor only offers modalities.

Modalities
Name Description
x_axis : int32 The X axis of the gyroscope
y_axis : int32 The Y axis of the gyroscope
z_axis : int32 The Z axis of the gyroscope

Gyroscope (BMI160)

The BMI160 is a small, low power, low noise 16-bit inertial measurement unit designed for use in mobile applications like augmented reality or indoor navigation which require highly accurate, real-time sensor data.

Configuration

Name Description
bandwidth : BMI160_Bandwidth The low-pass filter bandwidth used by the BMI160. Default: 39.9Hz.
range : BMI160_Range The range the BMI160 should measure in. Default: 2000 deg/s.

Modalities

Name Description
x_axis : int32 The X axis of the BMI160
y_axis : int32 The Y axis of the BMI160
z_axis : int32 The Z axis of the BMI160

Gyroscope (BMG160)

The BMG160 is an ultra-small, digital 3-axis angular rate sensor with a measurement range up to 2000°/s and a digital resolution of 16 bit for consumer electronics applications.

Configuration

Name Description
bandwidth : BMI160_Bandwidth The low-pass filter bandwidth used by the BMG160. Default: 523Hz.
range : BMI160_Range The measurement range of the BMG160. Default: 2000 deg/s.

Modalities

Name Description
x_axis : int32 The X axis of the BMG160
y_axis : int32 The Y axis of the BMG160
z_axis : int32 The Z axis of the BMG160

Environment (BME280)

The BME280 is a combined digital humidity, pressure and temperature sensor based on proven sensing principles.

Configuration

Name Description
power_mode : BME280_PowerMode The BME280 power mode. Default: Normal.
standby_time : uint32 The standby time used in normal mode in milliseconds. Beware that the value supplied here will be clipped to the nearest valid value.
temperature_oversampling : BME280_Oversampling Reduces noise in the temperature measurement by over sampling. Higher oversampling settings reduce noise but increase measurement time and power consumption.
pressure_oversampling : BME280_Oversampling Reduces noise in the pressure measurement by over sampling. Higher oversampling settings reduce noise but increase measurement time and power consumption.
humidity_oversampling : BME280_Oversampling Reduces noise in the humidity measurement by over sampling. Higher oversampling settings reduce noise but increase measurement time and power consumption.

Modalities

Name Description
temperature : int32 The temperature reported by the BME280.
pressure : uint32 The pressure reported by the BME280.
humidity : float The humidity reported by the BME280.
humidity_fixed_point : uint32 The humidity reported by the BME280 in fixed-point representation: divide by 1024 to get the percentage.

Light(MAX44009)

The XDK light sensor.

Configuration

Name Description
manual_mode : bool Enables the manual configuration of integration time and high brightness mode. If set to false (default) the chip automatically selects those values. Default: false.
integration_time : MAX44009_IntegrationTime The integration time is the time the sensor collects light for. In automatic mode (manual mode set to false) the chip automatically selects the integration time. Default: 800ms.
high_brightness : bool Set to true so that only 18 of the photo diode current goes to the ADC. This mode is used in high-brightness situations to avoid saturation/clipping effects of the ADC. Default: false.
continuous_mode : bool In default mode (false) the IC measures lux intensity only once every 800ms regardless of integration time. This mode allows the part to operate at its lowest possible supply current.

In continuous mode (true) the IC continuously measures lux intensity. That is, as soon as one reading is finished, a new one begins. If integration time is 6.25ms, readings are taken every 6.25ms. If integration time is 800ms, readings are taken every 800ms. In this mode, the part consumes slightly higher power than in the default mode. Default: false.

Modalities

Name Description
intensity : uint32 The light intensity of the MAX44009.

Buttons

The XDK features two buttons. Pressed and released are encoded by true and false in Mita. Button presses can be detected using event handlers, i.e. every button_one.pressed.

Modalities

Name Description
is_pressed : bool True if the button is pressed in this very right moment. False otherwise.

Events

Name Description
pressed Fires after the button was pressed.
released Fires after the button was released.

Connectivities

LED

The XDK features three custom usable LEDs in red, orange and yellow. On and off are encoded using true and false in Mita.

Modalities

Name Description Parameters
light_up : bool Represents one of the three LEDs. color : LedColor One of Yellow, Orange or Red.

BLE

BLE (Bluetooth Low Energy) allows the XDK to communicate over short range, up to 50m, with various devices like smartphones. In BLE a server continuously advertises all characteristics and clients can connect without requiring further interaction or authentification.

Configuration

Name Description
deviceName : string The name of the device as advertised via GAP.
macAddress : string MAC address of the device. Must start with FC-D6-BD. You may use either colon : or dash - as byte separators.
serviceUID : uint32 The last four bytes of the UUID of the GATT service we’ll create.
advertisingInterval : int16 The GAP advertisement interval. Default: 1000.

Signals

Name Description Parameters
bool_characteristic() : bool A boolean GATT characteristic. UUID : uint32 The last four bytes of the characteristic UUID. Defaults to the hash code of the VCI name.
uint32_characteristic() : uint32 An unsigned integer GATT characteristic. UUID : uint32 The last four bytes of the characteristic UUID. Defaults to the hash code of the VCI name.
int32_characteristic() : int32 A signed integer GATT characteristic. UUID : uint32 The last four bytes of the characteristic UUID. Defaults to the hash code of the VCI name.

WLAN

WLAN is one of the hardware connectivities available on the XDK. Configuration is done using sum types. Even though the concept of sum types may be daunting they are actually very easy to use. Say you want to configure authentification. Content assist (CTRL+Space) offers you three different choices: None, Enterprise and Personal. Each accepts a different number of parameters. For example to configure a WLAN with WPA2 Personal you would write this:

setup WLAN {
  authentification = Personal(psk = "mySecretKey");
  /* ... */
}

Configuring IP address works the same: you can choose from either Dhcp or Static.

Content assist will help you fill in all parameters.

Configuration

Name Description
Required authentification : Authentification How to authenticate to the WLAN network.
Required ssid : string The SSID of the WLAN network we want to connect to.
isHostPgmEnabled : bool If true, server certificate will be uploaded to the WLAN chip CC3100. Make sure to update service pack of the WLAN and then upload the certificate. Certificate must placed under XDK110/common/certs/XDKDummy. Default: false.
ipConfiguration : IpConfiguration How to configure IP address. Default: Dhcp().

MQTT

MQTT is a messaging protocol for low bandwidth networks. Current implementation is based on the serval stack.

Configuration

Name Description
Required transport : WLAN The transport layer used for communication.
Required url : string The URL pointing to the MQTT broker, for example: mqtt://does-not.exist:1883.
Required clientId : string A unique name the broker can use to identify devices. No two clients may have the same name per broker.
cleanSession : bool The clean session flag indicates to the broker whether the client wants to establish a clean session or a persistent session where all subscriptions and messages (QoS 1 & 2) are stored for the client. Default: false.
keepAliveInterval : uint32 The keep alive interval (in seconds) is the time the client commits to for when sending regular pings to the broker. The broker responds to the pings enabling both sides to determine if the other one is still alive and reachable. Default: 60.

Signals

Name Description Parameters
topic : string Publishes a message to a particular topic. name : string The topic’s name.
qos : uint32 Default: 0

REST over HTTP

Using REST you can easily talk to servers over HTTP. REST defines a stateless interface with a simple URL scheme. Normally a REST server consists of a versioned endpoint like http://api.github.com/v3 which then provides different resources, for example api.github.com/v3/repos/eclipse/mita/branches and /repos/eclipse/mita/issues.

Currently only writing is supported.

Configuration

Name Description
Required transport : WLAN The transport layer used for communication.
Required endpointBase : string The server URL base to which REST requests are made.
headerContent : string A custom header which is added to each HTTP request. Example: "X-Auth: MySecretToken\nX-Version: 1.0".

Signal

Name Description Parameters
resource : string A REST resource on the server. endpoint : string The REST path to the resource.
writeMethod : HttpMethod Which method to use when writing. Default: POST
readMethod : HttpMethod Which method to use when reading. Default: GET

Buses

GPIO

GPIO provides bit-wise communication with the environment. Low (0V) and high (3.3V) are represented by false and true.

Signals

Name Description Parameters
digitalIn : bool A GPIO-pin configured in input mode. pin : GPIOPin which pin to configure.
mode : GPIOMode whether this pin is pull up, pull down or floating.
digitalOut : bool A GPIO-pin configured in output mode. pin : GPIOPin which pin to configure.
initialValue : bool The pin’s initial value after startup. Default is low (false).

I2C

The I2C bus provides access to interfaced devices via I2C.

Configuration

Name Description
Required deviceAddress: uint8 The slave address identifying the interfaced device on the I2C bus.
byteOrder : ByteOrder Byte ordering for multi-byte words. Default is little endian, the XDK’s internal order.

Signals

Name Description Parameters
register_intType:intType A device register of size and sign specified by intType. address : uint8 the register’s address.
I2CMode : I2CMode whether this register is read, write, both or none. This only has an effect on validation, not on initialization.
array_register_ intType : array<intType> A device register consisting of multiple words of size and sign specified by intType. address : uint8 the register’s starting address.
I2CMode : I2CMode whether this register is read, write, both or none. This only has an effect on validation, not on initialization.
length : uint8 how many words this register consists of.