QCA402x Onboard with Cloud Mode

Skill LevelArea of FocusOperating SystemPlatform/Hardware
BeginnerBluetooth, IoT, Education, Embedded, Smart HomeRTOSQCA 402x WiFi/BLE/ZigBee

This project is intended to help you get familiar with the QCA4020 System-On-Chip (SoC) Product Development kit. The QCA4020 IoT solution offers Wi-Fi, Bluetooth low energy (BLE), and 802.15.4 capable radios in a single-chip package.

The project uses the “Onboard” sample demo included in the SDK with the Eclipse IDE to get started.

As part of this project, you will set up the development environment, import, build and flash a project on the QCA402x development board using the Eclipse IDE. You will then load a sample application on your Android smartphone to read the sensor values that are sent from the development board. The application will:

  1. Display the list of devices you’ve configured under the Zigbee network
  2. Allow you to select the Zigbee-connected QCA402x device, read the sensor values, and control the light intensity via a cloud connection.

The “Onboard_demo” application included in the SDK provides a mechanism to demonstrate end-to-end communication between the QCA402x development boards and the mobile app through cloud network or wireless technology. Using the “Onboard_demo” application, the objective of this project is to explain the steps needed to onboard the QCA4020 development kit to the AWS cloud network.

There are two separate applications/components required to set up the onboarding:

  1. “Onboard_demo” application running on QCA4020 development kit
  2. “QCAOnboard and Sensor” application running on the mobile device.

The mobile app, which can also be found in the downloaded SDK package, is designed to read sensor data and control sensors on the QCA4020 development kit. The communication happens through BLE or Wi-Fi (between the mobile application and development kit) and Zigbee/Thread (between the various development kits in the setup). The QCA4020 development kit is connected to the home access point to send the sensor information to the AWS cloud network.

The desired outcome for this project is to use the onboard demo application in “With Cloud” mode to directly read/write sensor data from the development kit using the BLE and Zigbee connections.

Onboard demo with cloud mode on QCA4020 Development Kit

Setup of the Onboard_demo with cloud mode on QCA4020 Development Kit

In the Box

The contents of the QCA4020 Development kit, as seen above, include:

  • QCA4020 development board
  • USB to Micro USB cables
  • Power supply
  • Jumpers
  • Setup guide

For the time being, you can set the kit aside while you install the software components and set up the development environment on your computer. During the setup process, you will only briefly use the kit while installing the FTDI drivers for JTAG.

Follow the detailed instructions listed in the “QCA4020 Onboard without Cloud Mode” Project to complete the following steps:

  1. Setup the development environment.
  2. Import sample “Onboard_demo” application.
  3. Build the application.
  4. Flash the Application on the QCA4020 development board using JTAG and Eclipse.
  5. Install the mobile application.

Once you have finished the above steps from the “Onboard demo without cloud mode” project, you will additionally have to follow the below steps to run the demo in cloud mode.

  1. Build with AWS IoT SDK (Section 3.9.1 on page 37 of the dev kit User’s Guide)
  2. Prerequisites to build onboard AWS demo (Section 5.1 on page 49 of the dev kit User’s Guide)

Run the application on the development board

You can use the autoboot mode to run the application on the development board. The Autoboot mode refers to the mode where the system boots up on a power cycle and no JTAG connectivity is required. Follow the below steps to run the application in Autoboot mode on both the development boards.

  1. Remove the jumper on J31.
    This was connected to flash the image on the board.
  2. Power cycle the system.
  3. The device starts in BLE peripheral mode and starts advertising.

Launch the Smartphone App

  1. This first step is not required if you are onboarding for the first time.
    The application has the provision to save a list of previously onboarded ZigBee coordinators, so if you have used the application before, it is required to delete the previously onboarded device.
    1. Click on the “Settings” icon on top right corner of qca_onboarding mobile application. By selecting the Coordinator List, you will find the list of saved Zigbee Coordinator devices.
    2. Click on the “Delete” icon and choose “YES” to remove the device from saved list of Zigbee Coordinators. Delete previously onboarded devices in the app
  2. On your smartphone, launch the “QCA OnBoarding” application that was installed during the setup.
  3. Default passwords used by the mobile app are “123456” for BLE connection and “12345678” for Wi-Fi connection.
  4. Once the development board receives the BLE/Wi-Fi passkey and proceeds onboarding from the mobile app, it validates the configuration and saves it to the filesystem.
  5. Mobile app reads the QCA4020 development board status and displays the Wi-Fi onboarding screen. Enter the Home AP credentials to connect to the network.
  6. Next step is to onboard the Zigbee coordinator on QCA4020 development board. On successful BLE/Wi-Fi connection of mobile app and QCA4020 device, the mobile app reads the Zigbee service for onboard status through BLE connection. If the status is success, and either Zigbee is in coordinator mode or Thread is in joiner router mode, the mobile app generates link key and sends the credentials packet to the QCA4020 device running as Zigbee coordinator or Thread joiner router.
  7. Once the QCA4020 device gets the operating mode and link key, the onboarding demo extracts the onboard details, validates the configuration, stores to the filesystem and sends the ACK to the mobile app. The QCA4020 device starts Zigbee service as a coordinator/router/end device based on the user-configured Zigbee operating mode. Onboarding the ZigBee coordinator in the app
  8. Once the mobile app receives the Zigbee onboard status notification it displays the onboard status screen and status.
  9. User can “onboard” the QCA402x device via BLE connection.
    1. In case of Zigbee onboarding, the QCA402x device runs as Zigbee end device connecting to the Zigbee coordinator QCA4020 device.
    2. In case of Thread onboarding, the QCA402x device runs as Thread joiner connecting to the Thread joiner router QCA4020 device. On the mobile app main screen, select the QCA402x device and onboard the device by using default password “123456” via BLE connection or passphrase “123456789” via Wi-Fi connection.
  10. The mobile app checks for the QCA402x onboard status and displays the Zigbee/Thread connection status via BLE/Wi-Fi, selects the relevant coordinator QCA4020 device name or joiner router QCA4020 device name which lets the QCA402x as end device to join the Zigbee network, or joiner to join the Thread network via BLE/Wi-Fi connection.
  11. If the QCA4024 is onboarded successfully, the mobile app displays successful onboarding device status; or else notifies with failure status and disconnects from the device. Get sensor data [Zigbee+BLE] using “qca_sensors” application After successfully onboarding QCA402x devices, the Zigbee end device/Thread joiner sends the sensor information to Zigbee coordinator/thread joiner router.
  12. Use the “qca_sensors” app to view the sensor information by saving credentials.csv file in the Android device downloaded from Creating IAM Users (Console).
  13. The next two steps are required only once, when you are trying to connect to AWS IoT services and send sensors and thermostat data.
  14. Once the application is launched, you will be prompted with a dialog to have the IAM user credentials.csv file saved in the Phone.
  15. You can select the file and AWS region from the dialog displayed with the list of available regions. AWS credentials and Region selection in the app
  16. After successful login, the application displays the list of things from the AWS IoT, which has the details of sensors and thermostat of one or more boards connected to each thing.
  17. Choose a device under the list of devices which are associated with it to view the sensors and thermostat data. Sensor and Thermostat data in the app
  18. Congratulations! You set up the development environment, imported, built and flashed a project on the QCA402x development board using the Eclipse IDE. On your smartphone, you can now read the sensor values that are sent from the development board.

    Troubleshoot using the Console connection

    QCLI command interface is provided for debugging purposes. If the high-speed UART is connected and a serial console is open, a CLI menu appears. Use the reset command to reset the onboarding information save on the CDB to allow it to be onboarded again from the mobile app. More details regarding this can be found in section 5.4 “Console for onboarding demo” in the dev kit User’s Guide.