XDK API  3.6.0
Documentation
XDK AwsSendDataOverMQTT Application User Guide

XDK AwsSendDataOverMQTT application shows how to use the MQTT protocol to transfer the sensor data to an AWS server using Amazon FreeRTOS.

XDK AwsSendDataOverMQTT Application User Guide


  1. Find the files placed under AwsSendDataOverMQTT(4 files)
    config.txt – Configuration file
    rootCA.der – Root Certificate
    xdk-cert.der - A certificate for this thing
    xdk-priv.der – Private Certificate
  2. Modify the config.txt with ssid, password , serverurl, serverport , brokerurl and broker port as shown below in config.txt.
    Note
    brokerurl - Go to IoT core available under Internet of Things of Home page after logging into http://console.aws.amazon.com/ brokerurl you can get from Settings under Endpoint
    {
    "wlan":
    {
    "isenterprise" : 0,
    "ishostpgmenabled" : 0,
    "ssid" : "xxxxx",
    "username" : "xxxxx",
    "password" : "xxxxx",
    "isstatic" : 0,
    "ipaddr" : "0.0.0.0",
    "gwaddr" : "0.0.0.0",
    "dnsaddr" : "0.0.0.0",
    "mask" : "0.0.0.0"
    },
    "sntp":
    {
    "serverurl": "0.de.pool.ntp.org",
    "serverport": 123
    },
    "mqtt":
    {
    "clientid": "xyz",
    "brokerurl": "xyz.iot.eu-central-1.amazonaws.com",
    "brokerport": 8883
    }
    }
  3. Go to IoT core after looging into http://console.aws.amazon.com/ The Home page will open as shown below
AwsSendDataOverMqtt-1.png
Home Page for Aws

brokerurl can be get from Settings under Endpoint field

AwsSendDataOverMqtt-2.png
Brokerurl for the config.txt

Steps to Generate certificate

  1. To create the certificate follow the below steps Go to IoT core page available under Internet of Things
    • Go to Manage ->Things

      AwsSendDataOverMqtt-3.png

    • Create a Device under Things

      AwsSendDataOverMqtt-4.png

    • Click on "Create a single thing"

      AwsSendDataOverMqtt-5.png

    • Name your device under “Name” and click next

      AwsSendDataOverMqtt-6.png

    • Creating certificate have two possibilities

      • For the newly created device
        AwsSendDataOverMqtt-7.png
      • If your device is already created then go to the created device for example XDK-Custom -> Go to Security -> create certificate
        AwsSendDataOverMqtt-8.png
        <>
      • Download the certificate and key 1,2 and 3 as per the image given below and afterwards click on Activate. If not activated then the device will not subscribe. So everytime the device should be activated when you flash the code<
        • >
          AwsSendDataOverMqtt-9.png
      • Downloaded certificates will be in .pem format which should be converted to .der format After downloading the certificate -> go to the place where it is saved -> open git bash and use the command given below

        $ openssl x509 -outform der -in downloaded_cert.pem -out output.der -> for certificate (.cert.pem / root CA )
        $ openssl rsa -outform der -in key.pem -out private.der -> for converting the private key
        Note
        Downloaded_cert .pem is the downloaded file name and output .der which can be named anything.
        Save as a .pem in local system (Kindly remove space while saving the certificate)

Steps to flash the application and see the data sent over Mqtt

  1. Modified the AppController.c file with the above modified certificate name
    APP_ROOT_CA_FILE_NAME- created by RSA 2048 bit key: VeriSign Class 3 Public Primary G5 root CA certificate file name
    APP_PRIVATE_KEY_FILE_NAME – created by Private Key file name
    APP_CLIENT_CERT_KEY_FILE_NAME –created by - A certificate for this thing (.pem.cert) file name
  2. Place the generated certificates after converting to der format along with config.txt file in the SD Card and after modified as per point 4 compile and flash the Application, after the SNTP is success and the data can be seen in TeraTerm or in any console window
    AwsSendDataOverMqtt-10.png
  3. Go to Test -> and specify the topic for eg : “BCDS/XDK110/example/out” as mention in application and subscribe to the topic
    AwsSendDataOverMqtt-11.png
  4. After subscribing you can see the data streaming as per the below picture
    AwsSendDataOverMqtt-12.png
  5. Once the Application run the files in the SD card is converted to .bkp . The files can be modified again by placing the .der in the SD Card whichever file is required
    AwsSendDataOverMqtt-13.png

All rights reserved. The use is subject to the XDK SDK EULA by Bosch Connected Devices and Solutions GmbH.
This documentation file has been automatically generated on Thu Mar 14 2019 19:12:49 by doxygen 1.8.8