Azure IoT SDK with QCS610 SoC

The main goal of this project is to integrate the Azure C IoT SDK source into the QCS610 SoC development kit, and build an application to turn on/off the camera and also post the status of camera recording to the Azure IoT-hub.

The main objective of this application is to get familiar with the QCS610 SoC and the Azure IoT SDK. It is designed to integrate the Azure IoT SDK with the development kit, control the camera recording, and send the status of camera recording to Azure IoT-hub.

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

The source tree of the project starts with the application directory (/home/user/azure)

azure/
- video_record.c
- video_record.h
- main.c
- lib
- contain shared libraries of azure iot c sdk
- azureiot/
- contain the azure iot sdk header files

  1. Ubuntu System 18.04 or above
  2. Install ADB tool (Android debugging bridge) on host system
  3. Valid Microsoft Azure user account
  4. Install python3.5 or above on the host system
  1. Setting up the camera application SDK on the host system.
  2. Camera environment configuration setup on the target device.
  3. Setting up resource group and device creation on Azure IoT-hub
  1. Setting up the Application SDK on the host system.
  1. Camera Environment configuration setup on the target device.
  2. To setup the camera environment configuration, follow steps in the document below.
    ‘Turbox-C610_Open_Kit_Software_User_Manual_LE1.0_v2.0.pdf’ from https://www.thundercomm.com/app_en/product/1593776185472315 Refer to section 2.10.1

  3. Set up resource group and register the device on Azure IoT-hub
  4. To setup the resource group and register the new device on the IoT hub please follow the below link:
    https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-create-through-portal

Note: once the setup is done, note the primary connection string of both registered new devices as well as IoT hub.

  1. Building the camera application:
  2. Step-1 : Enter below command to set up the cross-compilation environment on the host system.

    $ git clone <source repository>
    $ cd <source repository>
    $ source /usr/local/oecore-x86_64/environment-setup-armv7ahf-neon-oe
    -linux-gnueabi

    Step-2 : Build the camera application binary using command below. Note: before you start building, to add secure communication open the main.c file and replace the connection string details with device primary connection string.

    $CC main.c video_record.c -o iottest `pkg-config --cflags --libs gstreamer-1.0` -I
    ./azureiot/ -L ./lib -liothub_client -laziotsharedutil -liothub_client_mqtt_transport -
    liothub_client_amqp_transport -luamqp -lumqtt -lparson

    Step-3 : Initialize the target board with root access.

    $ adb root
    $ adb remount
    $ adb shell mount -o remount,rw /
    $ adb forward tcp:8900 tcp:8900

    Step-4 : Push the application binary and Azure IoT shared library to the target board with adb command.

    $ adb push iottest /data/azure/
    $ adb push lib/ /data/azure/
  3. Execute the binary file in the target environment.
  4. To start the application, run the below commands on the QCS610 board,

    $ adb shell
    /#

    To enable Wi-Fi connectivity on target board

    /# wpa_supplicant -Dnl80211 -iwlan0 -c /etc/misc/wifi/wpa_supplicant
    .conf -ddddt &
    /# dhcpcd wlan0

    Export the shared library to the LD_LIBRARY_PATH

    / # export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/azure/lib/
    /# cd data/azure/

    To start the application run below command

    /# ./iottest

    Once the above command is executed, the platform is designed to wait for the command from the IoT hub and take the required action.

  5. Event monitoring on Azure IoT hub,
  6. Open the new terminal on the host system
    Install azure cli on host system

    $ curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash

    Login to azure

    $ az login

    This will open the default browser, and you can enter your login credentials. After login, following command can be used to monitor the device messages.

    $ az iot hub monitor-events --hub-name <iot hub name> --device-id <devicename>
  7. For sending command from IoT hub to device
  8. Open the new terminal on the host system and traverse to the repo directory. Edit the cloud2device.py file and replace the ‘CONNECTION_STRING’ details with IoT hub primary connection string and replace the ‘DEVICE_ID’ details with device name.

    Install ‘azure iot-hub' on the host device.

    $ pip install azure-iot-hub

    Execute the python script and send the commands via command line option

    To start the video streaming on the QCS610 development kit.

    $ python3 cloud2device.py starttcp

    To stop the current streaming on the QCS610 development kit.

    $ python3 cloud2device.py stoptcp

    Once the development kit receives the command, it will start streaming the video. It will also send the camera status to the IoT hub, and the message can be shown on the event monitoring terminal.

    To see the live streaming, open the new terminal in the host system and enter the 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