AWS IoT SDK with QCS610 SoC

The main goal of this project is to integrate the C++/Python AWS IoT SDK source into the QCS610 SoC target platform and build an application to post the status of camera recordings to the AWS IoT core console.

The main objective of this project is to get familiar with the QCS610 development kit and the AWS IoT SDK. It is designed to integrate the AWS IoT SDK and send the status of camera recordings to the AWS IoT core console.

EquipmentDescription
Thundercomm TurboX C610 development boardLink to purchase the development kit:
https://www.thundercomm.com/app_en/product/1593776185472315?index=1&categoryId=categorynull
USB CablesFor serial console interface, ADB and fastboot commands. USB3.0 Type C port for connecting to the board and flashing images.
Resource TitleLink or File Name (and provide file)
Thundercomm TurboX C610 Platform Linux User GuidePlease refer to technical documents section on the product page:
https://www.thundercomm.com/app_en/product/1593776185472315?index=1&categoryId=categorynull

This project is designed to integrate the AWS IoT SDK into the QCS610 platform and create a small application to notify the current status of the camera to the AWS IoT core console. The source tree of the project starts with the application directory (/home/user/aws-iot)

aws-iot/
- video_record.c
- video_record.h
- basic_pub_sub/
- cJSON.c , cJSON.h , main.cpp, CMakeLists.txt
- publish.py
- certificates/
- xxxx-certificate.pem.crt, xxxx-private.pem.key, root-CA.crt
- publish
- videoaws


  1. Ubuntu System 18.04 or above
  2. Install Adb tool (Android debugging bridge) on host system
  3. Setup the QCS610 Yocto build environment
  4. Valid Amazon AWS user account
  5. Install python3.5 or above on the host system

Note: For python implementation, building on the yocto environment is not required (but would be necessary for c++ implementation).

  1. Setting up the Application SDK on the host system.
  2. Camera environment configuration setup on the target device.
  3. Setting up aws-iot device on aws console.
  4. Compiled the aws-iot-c++ SDK on yocto environment.


  1. Setting up the Application SDK on the host system.

Now the environment setup is complete.

Further reference refers the below document https://www.thundercomm.com/app_en/product/1593776185472315

  1. Camera Environment configuration setup on the target device
  2. To setup the camera environment configuration follow the below document ‘Turbox-C610_Open_Kit_Software_User_Manual_LE1.0_v2.0.pdf’ From url below
    https://www.thundercomm.com/app_en/product/1593776185472315 and Refer section 2.10.1

  3. Setting up AWS IoT connect

    Please refer to the link below to connect with AWS IoT services. Inside the IoT quick start document in step 2, while creating the think object, select device as python instead of node-js.

    https://docs.aws.amazon.com/iot/latest/developerguide/iot-quick-start.html

    Save the credentials to the certificates folder in the application directory.

  4. Compiling the aws-iot-c++ sdk on yocto environment
  5. Step-1 : clone the meta-aws repository to your host system

    $ git clone https://github.com/aws/meta-aws.git

    Step-2 : copy the aws-iot-device-sdk-cpp-v2 to yocto project environment

    $ cp meta-aws-master/recipes-sdk/ <working directory>/poky/meta-aws /recipes-sdk/ $ cd <working directory>

    Step-3 : Initialize the build environment

    $ export SHELL=/bin/bash
    $ source poky/qti-conf/set_bb_env.sh

    Select “qcs610-odk meta-qti-bsp” from the available machine’s menu. On selecting the machine, the ncurses menu starts. Select “qti-distro-fullstack-perf meta-qti-bsp” from Available Distributions menu.

    The shell prompt will now move to the following build directory

    <working directory>/build-qti-distro-fullstack-perf $

    Step-4 : Add the aws-meta path in bblayers.conf file in ‘<working directory>/build-qti-distro-fullstack-perf/conf/bblayers.conf ’ folder.

    Step-5 : run the bitbake command

    $ bitbake aws-iot-device-sdk-cpp-v2

    After successfully running this command, you can find the required compiled library as well as include folders generated in the path “<build_directory>/tmp-gibc/sysroots-components/armv7ahf-neon/aws-iot-device-sdk-cpp-v2/usr/”, copy the lib/ folders to the application directory.

    $ cp <build_directory>/tmp-gibc/sysroots-components/armv7ahf-neon
    /aws-iot-device-sdk-cpp-v2/usr/lib /home/user/iot_aws/.

    Step-6 : To compile the application, use the bitbake command below

    $ bitbake -c compile -f aws-iot-device-sdk-cpp-v2

    Step-7 : After successfully running the bitbake command you can find the git version of code available in “<build_directory>/tmp-gibc/work/armv7ahf-neon- oe-linux-gnueabi/aws-iot-device-sdk-cpp-v2/1.6.0-r0/” folder. Replace the current basic_pub_sub folder in path “git/samples/mqtt/basic_pub_sub” with ‘basic_pub_sub’ folder given in our repository. Execute the bitbake command given in step-6. After the successful execution, the target binary will be generated in the “build/samples/mqtt/basic_pub_sub/basic_pub_sub” folder

    Step-8 : Rename the binary ‘basic_pub_sub’ to ‘publish’ and copy it to the application directory. Also copy the libcJSON.so file to lib/ folder in the application directory.

    $ cp <build_directory>/tmp-gibc/work/armv7ahf-neon-oe-linux-gnueabi/
    aws-iot-device-sdk-cpp-v2/1.6.0-r0/build/samples/mqtt/basic_pub_sub/publish
    /home/user/iot_aws/.
    $ cp <build_directory>/tmp-gibc/work/armv7ahf-neon-oe-linux-gnueabi/
    aws-iot-device-sdk-cpp-v2/1.6.0-r0/build/samples/mqtt/basic_pub_sub/libcJSON.so
    /home/user/iot_aws/lib/.
  1. Building the camera application:
  2. Step-1 : Enter command below to set up the cross compilation environment on the host system.

    $ git clone <source repository>

    Copy the source repository to the application directory (aws-iot)

    $ cp <source repository> /home/user/aws-iot/
    $ cd aws-iot
    $ source /usr/local/oecore-x86_64/environment-setup-armv7ahf-neon-oe
    -linux-gnueabi

    Step-2 : Build the camera application binary using command below.

    $ $CC video_record.c video_record.h -o videoaws `pkg-config --cflags --libs
    gstreamer-1.0`

    Step-3 : Push the camera application binary to the target board with adb command.

    $ adb root
    $ adb remount
    $ adb shell mount -o remount,rw /
    $ adb forward tcp:8900 tcp:8900
    $ adb push videoaws /data/aws-iot/
  3. Step for including aws cert-key files
  4. $ adb push certificates /data/aws-iot/

    Edit the publish.py and basic_pub_sub/main.cpp files to update the certificate details present in /home/user/aws-iot/certificates.

  5. Step for AWS Python IOT sdk Integration
  6. Step-1 : push the aws-iot-python-sdk, and python source code to the target board

    $ git clone https://github.com/aws/aws-iot-device-sdk-python.git
    $ cd aws-iot-device-sdk-python
    $ adb push AWSIoTPythonSDK/ /data/aws-iot/
    $ cd ..
    $ adb publish.py /data/aws-iot/

    Step-2 : push the json library folder to the python 3.5 library folder on the target board

    $ adb push json/ /usr/lib/python3.5/
    $ adb shell
    /# chmod +x /data/aws-iot/videoaws
  7. Step for AWS IoT c++ SDK Integration to the target board
  8. Note: Ensure that you have already downloaded the meta-aws repository source code from github and compile the aws-iot-c++ sdk on the yocto environment (steps are given in prerequisites section of this project)

    Step-1 : push the aws-iot-c++ SDK compiled library to the target board.

    $ adb push lib/ /data/aws-iot/

    Step-2 : push the c++ target executable to the target board

    $ adb push publish /data/aws-iot/
  9. Execute the binary file in the target environment.
  10. To start the application, run the below commands on the Qualcomm QCS610 development board. Select the command line option as given in the table for different video formats. To stop capturing press “Ctrl + C” on the terminal of the target board. Video will be stored or streamed as per the given command line option.

    /# cd data/aws_iot/

    To enable Wi-Fi

    /# wpa_supplicant -Dnl80211 -iwlan0 -c /etc/misc/wifi/Wpa_Supplicant.conf -ddddt &
    /# dhcpcd wlan0
    / # export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/aws_iot/lib/
    /# ./videoaws {video_format} {output_path/ip} {c++/python}
Video formatcmdline-1cmdline-2cmdline-3
4K Video4k/data/4k.mp4c++/python
HD video1080p/data/1080p.mp4c++/python
Tcp Streamingtcp127.0.0.1c++/python

Example: for playing 4k video

/# ./videoaws 4k /data/video/4k.mp4 c++

Whenever the camera application starts and stops capturing, the application is designed to establish connection to the aws-iot-core and publish the current status of the camera details in json format to the particular topic. The details include recording format, device details and current action of the camera. The subscriber of this topic can receive the camera details.

To Download video:

Using the adb pull command we can download the video to the host system.

$ adb pull /data/4k.mp4

To see the live streaming, open the new terminal in the host system and enter below command. Also make sure you have installed the ‘vlc player’ on the host system in order to view video playback.

$ adb forward tcp:8900 tcp:8900
$ vlc -vvv tcp://127.0.0.1:8900


Qualcomm QCS610 is a product of Qualcomm Technologies, Inc., and/or its subsidiaries.
NameTitle Company
Rakesh Sankar
[email protected]
Sr, System Architect
Global Edge Software Ltd
Ashish Tiwari
[email protected]
Architect
Global Edge Software Ltd
Ramsingh G
[email protected]
Senior Software Engineer
Global Edge Software Ltd
Priyanka K S
[email protected]
Software Engineer
Global Edge Software Ltd