This offer is only addressed to commercial customers including freelancers and entrepreneurs.

Developer Portal

XDK - The Sensor X-perience

Programmable sensor device and IoT prototyping platform with an open SDK for any use case.

Application Templates

The XDK Workbench Examples Overview provides a description of each example that can be found in the Welcome Screen of the XDK-Workbench. To import one of the examples simply click on one of them in the Welcome Screen.

  1. AwsSendDataOverMQTT
  2. BoschXDKCloudConnectivity
  3. LedsAndButtons
  4. Lwm2mExampleClient
  5. PpmpUnide
  6. SdCardExample
  7. SendAccelDataOverUdpAndBle
  8. SendAccelerometerDataOverBle
  9. SendDataOverMQTT
  10. SendDataOverUdp
  11. SendVirtualSensorDataOverUsb
  12. StreamSensorDataOverUsb
  13. VirtualXdkDemo
  14. WlanNetworkManagement
  15. XdkApplicationTemplate
  16. XdkExtensionPort

AwsSendDataOverMQTT

Before you start

The XDK AwsSendDataOverMQTT application shows how to use the MQTT protocol to transfer the sensor data to an AWS server using Amazon FreeRTOS. In advance install the XDK Workbench, at least version 3.6.0

Structure of the Quick Start Guide

  • First steps
  • Steps to generate the certificate
  • Steps to create an AWS IoT policy
  • Steps to attach an AWS IoT Policy to a Device Certificate
  • Steps to flash the application and see the data sent over MQTT

A. First steps

1. Find the files placed under AwsSendDataOverMQTT/source/config (4 files)

2. Modify the config.txt with ssid, password, serverurl, brokerurl and broker port as shown below in config.txt. picture.
Note brokerurl: see point 3

3. Go to “IoT Core” available under “Services”, after logging into http://console.aws.amazon.com/. If you don’t have an existing account you have to create a new AWS account. Afterwards The Home page will open as shown below

The brokerurl for the config.txt can be found under “Settings” under the “Endpoint” field.

B. Steps to generate the certificate

1. To create the certificate follow the steps below. Go again to the IoT core page, available under Internet of Things

1.1 Go to “Manage”, then click on “Things”

1.2 Create a device under Things, by clicking “Create”

1.3 Click on “Create a single thing” and then name your device under “Name” and klick next

1.4 Afterwards click on “Create certificate”, then you have two possibilities to create one

  • First is for a newly created device. Download the certificate as shown on “1” and ”2” and then click on ”3” -> “Activate”. If it’s not activated then the device will not subscribe. So every time the device should be activated when you flash the code<…>

  • Second is if your device is already created. Go to the created device for example “XDK-Custom”, click on “Security” and then you press “Create certificate”

You can download the root CA certificate here: sf-class2-root.cer
More information about Amazon Trust Services CAs can be found here: how-to-prepare-for-aws-move-to-its-own-certificate-authority

The root CA is already in the correct format and only needs to be renamed to "rootCA.der". The endings of the 2 other files ".pem.crt.txt" and ".pem.key" can easily be renamed to ".pem". Afterwards these 2 files should be converted to ".der". To do this, go to the location where the files are stored, open the git bash and use the commands below:

$ openssl x509 -outform der -in Downloaded-certificate.pem -out xdk-cert.der
$ openssl rsa -outform der -in Downloaded-private.pem -out xdk-priv.der

Note: "Downloaded-certificate.pem" and Downloaded-private.pem" are the downloaded file names. "xdk-cert.der" and "xdk-priv.der", which can be named anything, are the files that will be created. If you use the file names given here you don't need to change anything in the source code. If you want to give your own file names, you should modify the defines as described in E. Steps.

C. Steps to create an AWS IoT policy

X.509 certificates are used to authenticate your device with AWS IoT. AWS IoT policies are used to authorize your device to perform AWS IoT operations, such as subscribing or publishing to MQTT topics. Your device presents its certificate when sending messages to AWS IoT. To allow your device to perform AWS IoT operations, you must create an AWS IoT policy and attach it to your device certificate.

1. In the left navigation pane, choose “Secure”, and then choose “Policies”. On the “You don't have a policy yet page”, choose “Create a policy”.

2. On the “Create a policy page”, in the Name field, enter a name for the policy (for example, “MyIotPolicy”). In the Action field, enter “iot:Connect”. In the Resource ARN field, enter “*”. Then select the Allow check box. This allows all clients to connect to AWS IoT.
Note: We do not recommend using personally identifiable information in your policy names.

Note: You can restrict which clients/devices can connect by specifying a client ARN as the resource. The client ARNs follow the format:
arn:aws:iot:your-region:your-aws-account:client/<my-client-id>
Choose the “Add Statement” button to add another policy statement. In the Action field, enter “iot:Publish”. In the Resource ARN field, enter the ARN of the topic to which your device will publish.
Note: The topic ARN follows this format:
arn:aws:iot:your-region:your-aws-account:topic/<your/topic> For example: arn:aws:iot:us-east-1:123456789012:topic/my/topic
Finally, select the “Allow check box”. This allows your device to publish messages to the specified topic.

3. After you have entered the information for your policy, choose “Create”, as shown in the picture above.

D. Steps to attach an AWS IoT Policy to a Device Certificate

Now that you have created a policy, you must attach it to your device certificate. Attaching an AWS IoT policy to a certificate gives the device the permissions specified in the policy.

1. In the left navigation pane, choose Secure, and then choose Certificates.

2. In the box for the certificate you created, choose ... to open a drop-down menu, and then choose Attach policy.

3. In Attach policies to certificate(s), select the check box next to the policy you created in the previous step, and then choose Attach.

E. Steps to flash the application and see the data sent over MQTT

1. Modify the AppController.c file in the Workbench, with the above modified certificate name

APP_ROOT_CA_FILE_NAME  --->  root CA certificate file name

APP_PRIVATE_KEY_FILE_NAME  --->  created by "A private Key" file name

APP_CLIENT_CERT_KEY_FILE_NAME  ---> created by "A certificate for this thing" file name

2. Place the generated certificates, after converting to .der format along with config.txt file, in the SD Card. Then, after modified compile and flash the application, after the SNTP is success and the data can be seen in TeraTerm or in any console window

3. Next click on “Test” and specify the topic e.g. : “BCDS/XDK110/example/out” as mentioned in application and “subscribe to topic”

4. After subscribing you can see the data streaming, as shown in the picture below

5. Once the application runs, the files in the SD card are being converted to .bkp. The files can be modified again by placing the .der in the SD Card whichever file is required

BoschXDKCloudConnectivity

This example demonstrates how to register with a LWM2M server, including the standard LWM2M and IPSO Alliance sensor objects with very little necessary editing. The implementation supports both insecure and secure connections, which can be chosen accordingly. The example will connect insecure to the eclipse Leshan server, which can be accessed on a PC at http://leshan.eclipse.org/#/clients.

Once the XDK is connected to the network and the Leshan server, the orange LED will turn on. On the website, you can now choose the desired client (your client's name will default to your device's WLAN MAC address) and read the standard LWM2M and IPSO Alliance sensor objects.

Otherwise, it is also possible to connect with the example over a secure connection to the Bosch IoT cloud. For a detailed explanation about how to perform that, please take a look at the description here.

fig13

fig14

 

Output fig15

This example will print out the sensor data from the XDK over the USB port to the PC to be read in the XDK-Workbench's console. The data from each sensor is printed out at the same time.

HttpExampleClient

This example shows how to use the network stack to perform an HTTP client request. The example connects to the server www.postman-echo.com. It establishes a connection to the server and alternating sends a GET and POST request to the configured server every 10 seconds. Additionally, it is also possible to use HTTPS instead of HTTP to send the requests.

 

Output

When running the program keep the USB plugged in to the PC. The USB will output a string of data you can read to indicate correct functionality.

fig1

LedsAndButtons

This example contains a showcase for the use of LEDs and buttons. The LedsAndButtons example requires no extra programming, it is ready to run immediately. Once the application is running, you can press the 2 push buttons and will see the LEDs in 4 states.

 

Output

When running the program keep the USB plugged in to the PC. The USB will output a string of data you can read to verify correct functionality.

fig2

Lwm2mExampleClient

This example demonstrates how to register with a LWM2M server including the standard LWM2M objects. Insecure and encrypted communication is both supported. The example will connect to the Leshan Lwm2m server from Eclipse which can be accessed on a PC at http://leshan.eclipse.org/#/clients.

Once the XDK is connected to the network and also to the Leshan server, the orange LED will turn on. On the website you can now click on the desired client and read the objects.

fig2.1

fig3

 

Programming

fig4

fig5

Output

When running the program keep the USB plugged to the PC. The USB will output a string of data you can read to indicate correct functionality. This string is mainly used for debug purposes. If the output differs from the following picture, then there is an error in the network setup or LWM2M setup.

fig6

PpmpUnide

This example demonstrates the XDKs capabilities to use the production performance management protocol to serialize the XDKs sensor data and to send the sensor data over HTTP/S to an HTTP server which post-processes this data.

 

SdCardExample

This example contains the showcase for the use of the SD card file system. The example will read the presence of an SD card in the SD card slot and also turn on the red LED if one is present. The device will then create and write to the text file TEST_XDK.txt the text This content is created by SD card Read/Write functionality using FAT32 file system. The code out of the box will continue to write the SD card again and again, making it difficult to stop the program at an appropriate spot where the SD card is not corrupted. To circumvent this, you have to add a stop timer command after the write. The SD card can be removed from the XDK after the write process has been completed (as indicated by the output) and read on a computer.

 

Output

When running the program keep the USB plugged in to the PC. The USB will output a string of data you can read to indicate correct functionality. Read the output and do not turn off the XDK or take out the SD card until the console indicates that the write process has been completed.

fig8

SendAccelDataOverUdpAndBle

This example demonstrates how to read sensor values from the BMA280 acceleration sensor and send the data over WLAN (UDP broadcast) and Bluetooth Low Energy (BLE). Either use your Android or iOS mobile phone, for example, with the BLE scanner application (see Android or iOS App Store) to connect to the XDK and to receive the data. Send start as message to the XDK via BLE to start the data stream.

 

SendAccelerometerDataOverBle

This example streams the raw accelerometer data from the BMA280 acceleration sensor via BLE. A companion app such as the BLE scanner for iOS/Android is required. Open the BLE scanner application, search for near Bluetooth device, and select the XDK_BLE_APP device. Once the device connects, select the write button. Then send start as a message to the XDK, so that the streaming of data begins and send end to the XDK when you want to end the streaming of data.

fig9

 

Output

When running the program keep the USB plugged to the PC. The USB will output a string of data, which you can read to indicate correct functionality.

fig10

SendDataOverMQTT

This example demonstrates how to read environmental sensor values from the BME280 environmental sensor and how to publish this data over the MQTT protocol to a destination broker. Also, the example contains the subscription from the MQTT broker and prints them to the console of the XDK-Workbench.

 

Output

When running the program, the published data should be received from the MQTT broker using the same time intervals like that used one at publishing.

fig19

SendDataOverUdp

This example demonstrates how to send arbitrary data over WLAN as a UDP message to a specified UDP server.

 

Output

When running the program, arbitrary data will periodically be sent to the specified UDP server.

fig11

SendVirtualSensorDataOverUsb

The example can print out raw or calibrated data from an array of virtual sensors. The default example will capture the XDK's calibrated acceleration data and print it into the console of the XDK-Workbench. The example can be configured to display the sensor values of different virtual sensors. For example, the step counter will count the number of 'steps' taken by the device, and the magnetic finger print allows the user to mount the device on an object, like a window, and program three unique magnetic finger prints based on the position of the XDK and the object. The following virtual sensors can be configured in the example.

 

Programming

Please note that only one sensor at a time can be used.

fig12

Output

When running the program keep the USB plugged to the PC. The USB will output a string of data, which you can read to indicate correct functionality.

StreamSensorDataOverUsb

The example prints out all data provided by the sensors of the XDK into the console of the XDK-Workbench.

 

Output

When running the program keep the XDK plugged to the PC. The XDK will output a string of data which you can read to indicate correct functionality.

VirtualXdkDemo

This example demonstrates the XDK's sensors, using an Android/iOS app, to which the XDK sends its data using BLE. The app visualizes the data in real time, allowing for a great presentation of the XDK's features.

 

Output

Once the application is running on the XDK, it can be unplugged from the PC. It will be listed in the app's device scan, if the mobile device supports BLE and has Bluetooth activated. Once the XDK and mobile device established the connection, the XDK will start streaming data to the mobile device. Correct functionality is most easily determined through affecting the orientation sensor by rotating the XDK.

fig16

WlanNetworkManagement

This example demonstrates how to use the XDK WLAN abstraction to scan for networks, join networks, set a static IP address or dynamically obtain an IP address via DHCP. The example sets up a task that repeatedly scans for networks and connects/disconnects from a network.

 

Programming

fig17

Output

When running the program keep the USB plugged to the PC. The USB will output a string of data which you can read to indicate correct functionality.

fig18

XdkApplicationTemplate

This is an empty template serving as a starting point for new projects.

XdkExtensionPort

This example demonstrates the capabilities when using the extension bus of the XDK. It provides the possibility to communicate with external attached devices over UART, SPI, I2C or simply over GPIO. Furthermore, the example is configurable to use only one of the previously mentioned communication modules or all at once.

 

Programming

  1. Find the files placed under AwsSendDataOverMQTT (4 files)
    1. Modify the config.txt with ssid, password, serverurl, brokerurl and broker port as shown below in config.txt. picture.
    1. Go to “IoT Core” available under “Services”, after logging into http://console.aws.amazon.com/.  If you don’t have an existing account you have to create a new AWS account. Afterwards The Home page will open as shown below
    • XDK
    • USB cable (USB A to USB micro)
    • Windows 7 or greater/Linux/MAC PC with XDK-Workbench version 3.4.0 or later installed
    • Available wireless network
    1. Connect the XDK to the PC via USB cable
    2. Open the XDK-Workbench
    3. From the Welcome Screen, open the BoschXDKCloudConnectivity example
    1. From the Project Explorer, expand the project and then open the AppController.h file
    2. Edit the WLAN_SSID_DEFAULT field to match the available networks name
    3. Edit the WLAN_PASSWORD_DEFAULT field to match the available networks password
    4. Clean and Build the project
    5. Flash the project to your XDK
    • XDK
    • USB cable (USB A to USB micro)
    • Windows 7 or greater/Linux/MAC PC with XDK-Workbench version 3.4.0 or later installed
    • Available wireless network
    1. Connect the XDK to the PC via USB cable
    2. Open the XDK-Workbench
    3. From the Welcome Screen, open the HttpExampleClient example
    1. From the Project Explorer, expand the project, open the source folder and then open the AppController.h file.
    2. Edit the WLAN_SSID field to match the available networks name
    3. Edit the WLAN_PSK field to match the available networks password
    4. Save the file
    5. Clean and build the project
    6. Flash the project to the XDK
    • Push Button 1 Pressed
      • Red LED State - ON
      • Orange LED State - OFF
      • Yellow LED State - ON
    • Push Button 1 Released
      • Red LED State - OFF
      • Orange LED State - ON
      • Yellow LED State - OFF
    • Push Button 2 Pressed
      • Red LED State - ON
      • Orange LED State - ON
      • Yellow LED State - OFF
    • Push Button 2 Released
      • Red LED State - OFF
      • Orange LED State - OFF
      • Yellow LED State - ON
    • XDK
    • USB cable (USB A to USB micro)
    • Windows 7 or greater/Linux/MAC PC with XDK-Workbench version 3.4.0 or later installed
    1. Connect the XDK to the PC via USB cable
    2. Open XDK-Workbench
    3. From the Welcome Screen, open the LedsAndButtons example
    1. Clean and build the project
    2. Flash the project to the XDK
    • XDK
    • USB cable (USB A to USB micro)
    • Windows 7 or greater/Linux/MAC PC with XDK-Workbench version 3.4.0 and later installed
    • Available wireless network
    1. Connect the XDK to the PC via USB cable
    2. Open the XDK-Workbench
    3. From the Welcome Screen, open the Lwm2mExampleClient example
    1. From the Project Explorer, expand the project, open the source folder and then open the AppController.h file
    2. Edit the WLAN_SSID field to match the available networks name
    3. Edit the WLAN_PSK field to match the available networks password
    1. Clean and build the project
    2. Flash the project to the XDK
    • XDK
    • USB cable (USB A to USB micro)
    • Windows 7 or greater/Linux/MAC PC with XDK-Workbench version 3.4.0 or later installed
    • Available wireless network
    1. Connect the XDK to the PC via a USB cable
    2. Open the XDK-Workbench
    3. From the Welcome Screen, open the PpmpUnide example
    1. From the Project Explorer, expand the project, open the source folder and then open the AppController.h file
    2. Edit the WLAN_SSID field to match the available networks name
    3. Edit the WLAN_PSK field to match the available networks password
    4. Edit the SNTP_SERVER_URL field to match the available SNTP server address
    5. Edit the PPMP_SERVER_URL field to match the available PPMP server address
    6. Edit the PPMP_POST_URL_MESSAGE field to match the URI where the message payload should be sent to
    7. Edit the PPMP_POST_URL_MEASUREMENT field to match the URI where the measurement payload should be sent to
    8. Edit the APP_PPMP_DEVICE_ID field to set the unique XDK PPMP node
    9. Save the file
    10. Clean and build the project
    11. Flash the project to the XDK
    • XDK
    • USB cable (USB A to USB micro)
    • Windows 7 or greater/Linux/MAC PC with XDK-Workbench version 3.4.0 or later installed
    • Micro SD card (formatted to FAT/FAT32 with a data size of 32 GB or less)
    1. Insert the Micro SD card into the XDK
    2. Connect the XDK to the PC via USB cable
    3. Open the XDK-Workbench
    4. From the Welcome Screen, open the SdCardExample example
    1. Insert the stop timer with the following line as shown in the screenshot below

      xTimerStop(sdCardWriteReadHandle, WRITEREAD_BLOCK_TIME);
      

      fig7

    2. Clean and build the project

    3. Flash the project to the XDK
    • XDK
    • USB cable (USB A to USB micro)
    • Windows 7 or greater/Linux/MAC PC with XDK-Workbench version 3.4.0 or later installed
    • Mobile Android/iOS device with Bluetooth Low Energy (BLE) and the BLE scanner application
    1. Connect the XDK to the PC via USB cable
    2. Open the XDK-Workbench
    3. From the Welcome Screen, open the SendAccelerometerDataOverUdpAndBle example
    1. Clean and build the project
    2. Flash the project to the XDK
    • XDK
    • USB cable (USB A to USB micro)
    • Windows 7 or greater/Linux/MAC PC with XDK-Workbench version 3.4.0 or later installed
    • Mobile Android/iOS device with Bluetooth Low Energy (BLE) and the BLE scanner application
    1. Connect the XDK to the PC via USB cable
    2. Open the XDK-Workbench
    3. From the Welcome Screen, open the SendAccelerometerDataOverBle example
    1. Clean and build the project
    2. Flash the project to the XDK
    • XDK
    • USB cable (USB A to USB micro)
    • Windows 7 or greater/Linux/MAC PC with XDK-Workbench version 3.4.0 or later installed
    • Available wireless network and an own UDP server
    1. Connect the XDK to the PC via USB cable
    2. Open the XDK-Workbench
    3. From the Welcome Screen, open the SendDataOverMQTT example
    1. From the Project Explorer, expand the project, click at the source folder and open the AppController.h file
    2. Edit the WLAN_SSID field to match the available networks name
    3. Edit the WLAN_PSK field to match the available networks password
    4. Edit the SNTP_SERVER_URL field to match the URL the XDK will get its SNTP timestamp
    5. Edit the APP_MQTT_BROKER_HOST_URL field to match the URL of the destination MQTT broker
    6. Edit the APP_MQTT_BROKER_HOST_PORT field to match the MQTT broker port number on which the destination MQTT broker will listen
    7. Edit the APP_MQTT_CLIENT_ID field to match your client ID, which will be used to identify the XDK as publishing and subscribing MQTT client
    8. Edit the APP_MQTT_TOPIC field to match the topic, the XDK will publish data to and subscribe from
    9. Clean and Build the project
    10. Flash the project to your XDK
    • XDK
    • USB cable (USB A to USB micro)
    • Windows 7 or greater/Linux/MAC PC with XDK-Workbench version 3.4.0 or later installed
    • Available wireless network and an own UDP server
    1. Connect the XDK to the PC via USB cable
    2. Open the XDK-Workbench
    3. From the Welcome Screen, open the SendDataOverUdp example
    1. From the Project Explorer, expand the project, open the source folder and then open the AppController.h file
    2. Edit the WLAN_SSID field to match the available networks name
    3. Edit the WLAN_PSK field to match the available networks password
    4. Edit the DEST_SERVER_IP field to match the IP address of the destination server
    5. Edit the DEST_SERVER_PORT field to match the server port number on which the destination server will listen
    6. Clean and Build the project
    7. Flash the project to your XDK
    • Rotation
    • Compass
    • Absolute Humidity
    • Calibrated Accelerometer
    • Calibrated Gyroscope
    • Calibrated Magnetometer
    • Gravity
    • StepCounter
    • Fingerprint
    • Linear Acceleration
    • Gestures
    • XDK
    • USB cable (USB A to USB micro)
    • Windows 7 or greater/Linux/MAC PC with XDK-Workbench version 3.4.0 or later installed
    1. Connect the XDK to the PC via USB cable
    2. Open the XDK-Workbench
    3. From the Welcome Screen, open the SendVirtualSensorDataOverUsb example
    1. Open the project in the Project Explorer and navigate to the file AppController.c
    2. Enable the sensor you want to use in the struct VirtualSensors.
    1. Clean and build the project
    2. Flash the project to the XDK
    • XDK
    • USB cable (USB A to USB micro)
    • Windows 7 or greater/Linux/MAC PC with XDK-Workbench version 3.4.0 or later installed
    1. Connect the XDK to the PC via USB cable
    2. Open the XDK-Workbench
    3. From the Welcome Screen, open the StreamSensorDataOverUsb example
    1. Clean and build the project
    2. Flash the project to the XDK
    • XDK
    • USB cable (USB A to USB micro)
    • Windows 7 or greater/Linux/MAC PC with XDK-Workbench version 3.4.0 or later installed
    • Mobile Android/iOS device with Bluetooth Low Energy (BLE)
    1. Connect the XDK to the PC via USB cable
    2. Open the XDK-Workbench
    3. From the Welcome Screen, open the VirtualXdkDemo example
    4. Install the Virtual XDK app on the mobile device (from the iTunes Store on iOS or the Play Store on Android)
    5. Open the app on the mobile device
    6. Turn the mobile device's Bluetooth on
    1. Clean and build the project
    2. Flash the project to the XDK
    • XDK
    • USB cable (USB A to USB micro)
    • Windows 7 or greater/Linux/MAC PC with XDK-Workbench version 3.4.0 or later installed
    • Available wireless network
    1. Connect the XDK to the PC via USB cable
    2. Open the XDK-Workbench
    3. From the Welcome Screen, open the WlanNetworkManagement example
    1. Open the project and navigate to the file WlanNetworkManagment.h file
    2. Configure the network and DHCP setting as desired
    1. Clean and build the project
    2. Flash the project to the XDK
    • XDK
    • USB cable (USB A to USB micro)
    • Windows 7 or greater/Linux/MAC PC with XDK-Workbench version 3.4.0 or later installed
    • External attachable device, which communicates over UART, SPI, I2C or GPIO
    1. Connect the XDK to the PC via USB cable
    2. Open the XDK-Workbench
    3. From the Welcome Screen, open the XdkExtensionPort example
    1. From the Project Explorer, expand the project, open the source folder and then open the AppController.h file.
    2. Edit the EXTENSION_PORT_UART_FEATURE field to enable or disable communication over UART
    3. Edit the EXTENSION_PORT_I2C_FEATURE field to enable of disable communication over I2C
    4. Edit the EXTENSION_PORT_SPI_FEATURE field to enable of disable communication over SPI
    5. Edit the EXTENSION_PORT_GPIO_FEATURE field to enable of disable communication over GPIO
    6. Save the file
    7. Clean and build the project
    8. Connect an external device which communicates over UART, SPI, I2C or GPIO over the extension bus to the XDK
    9. Flash the project to the XDK

Let’s stay connected

Subscribe to our newsletter to receive updates on new services, features and developer events.

Please log in to your account in order to subscribe.