Thunderboard BLE System Setup Tutorial

Steps

  1. Setup the Thunderboard device
  2. Import the thunderboard-ble-system from ipm.clearblade.com
  3. Configure Adapter
  4. Setup & start the edge on Raspberry Pi
  5. Test and Verify the setup
  6. Start the Adapter
  7. See Visualization

Setup the Thunderboard device

  • The default advertisement time is 30 seconds on Thunderboard Devices. We will be modifying this to advertise indefinitely.
  • Follow the steps in the instructions-to-setup-thunderboard to flash the Thunderboard’s default firmware with new changes.

Import BLE system on platform

  • Create a developer account on platform.clearblade.com
  • Once logged in, the developer can access a console.
  • To import thunderboard-ble-template into
    • A new system: click the New button & search for thunderboard.
    • An existing system: click the install button & search for thunderboard.
  • Select the system and hit import/create button. Image

Configure Adapter

  1. Edit adapterconfig.txt:

    • In the developer console, select your system and switch to the adapters tab.
    • Select the ThunderBoardAdapter adapter & edit the configuration.
    • Download the adapterconfig.txt file and edit the absolute paths based on where you install and run the edge on your gateway (here raspberry pi)


  2. Edit pythonScanner.py:

    • This python file has code which communicates with the edge running locally on the raspberry pi.
    • Set the credentials based on the TODO comments in the python file.

      ## Change the following fields in the pythonScanner.py
              
      "platformURL" - the platform where the system resides, default is communicating to the edge, keep it unchanged. 
      "systemKey" & "systemSecret" - The key & secret of the system, can be found by going in the about section of the system of the clearblade developer console.
      "username" - the user which is there in the users table
      "password" - respective password for the above username
      
  3. Replace these changed files in the adapter configuration.

Setup and start the edge on Raspberry Pi

  • Switch to the edge section in the developer console.
  • An edge ThunderBoardOnPi would already be created, if not create one by clicking the New button.
  • Note that it will not be connected as of now.
  • Click on the setting icon in the name column of the edge page click on setup instructions. Image
  • Select target as Linux 32bit - ARM

  • Assuming a Raspberry Pi is up and running, ssh into the Pi’s terminal & create a directory cbedge inside the home folder and cd into it. Note: By default, the edge folder will be set as /home/pi/cbedge

  • Perform the Download, Unzip, Install & Permission operations on the Pi.

  • ls the folder to find the edge binary. [Image]

  • Given edge ip and platform ip are as shown in the image. [Image]

  • Start the edge by running the command in Pi’s terminal.

Test and Verify the setup

  • Verify the edge is connected in the edge tab of the developer console
  • Verify the adapter is deployed, go to the adapter’s section and find the edge in the connected section. [Image]

Start the adapter

  • Navigate to the adapter section of the console.
  • Select the edge in the connected section
  • Select the ThunderBoardAdapter adapter, select the ThunderboardOnPi edge, and press the play button.
  • Go to the Devices tab and confirm your device is listed there. For an additional check, navigate to the Messages tab, and confirm there are MQTT messages listed.

See Visualization

  • To see a visualization of the data, go to the Portals tab and click on the AnomalyDetection portal. Change the topic field on the right to be thunderboard/environment/THUNDERBOARD_ID/_platform (the ID will be a 5 digit number in pretty much every MQTT topic in the Messages tab)
  • Update the Sensor Key field to one of sound, co2, temperature, voc, battery, light, uv, humidity, pressure.