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.
Objective
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.
Equipment Required / Parts List / Tools
Equipment | Description |
---|---|
Thundercomm TurboX C610 development board | Link to purchase the development kit: https://www.thundercomm.com/app_en/product/1593776185472315?index=1&categoryId=categorynull |
USB Cables | For serial console interface, ADB and fastboot commands. USB3.0 Type C port for connecting to the board and flashing images. |
Additional Resources
Resource Title | Link or File Name (and provide file) |
---|---|
Thundercomm TurboX C610 Platform Linux User Guide | Please refer to technical documents section on the product page: https://www.thundercomm.com/app_en/product/1593776185472315?index=1&categoryId=categorynull |
About the project
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
Dependencies
- Ubuntu System 18.04 or above
- Install ADB tool (Android debugging bridge) on host system
- Valid Microsoft Azure user account
- Install python3.5 or above on the host system
Prerequisites
- Setting up the camera application SDK on the host system.
- Camera environment configuration setup on the target device.
- Setting up resource group and device creation on Azure IoT-hub
- Setting up the Application SDK on the host system.
- To Install application SDK, download the Application SDK from the given url:
https://thundercomm.s3.ap-northeast-1.amazonaws.com/shop/doc/1593776185472315/Turbox-C610_Application-SDK_v1.0.tar.gz - Unpack the SDK using below command
- Execute the below script file, it will ask the default target directory, press enter and input ‘Y’
$ tar -xzvf Turbox-C610_Application-SDK_v1.0.tar.gz
$ ./oecore-x86_64-armv7ahf-neon-toolchain-nodistro.0.sh
Now the environment setup is complete.
- Camera Environment configuration setup on the target device.
- Set up resource group and register the device on Azure IoT-hub
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
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.
Steps to build and run the application:
- Building the camera application:
- Execute the binary file in the target environment.
- Event monitoring on Azure IoT hub,
- For sending command from IoT hub to device
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/
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.
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>
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.
Contributor(s) Info
Name | Title 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 |