IoT Edge Developer Webcast

Tired of the endless IoT Edge marketing and want to get your hands dirty?

Join Akash Sharma each week as he fires up the editor and starts cutting code for everyone to see, use and learn from.

Session 11: ClearBlade Command Line Interface

Introduction

In this session we will be discussing the use of the cb-cli and their local editing commands.

Additional Info

Date posted: November 13th, 2020
YouTube Link: Click here to see the recording

Session 10: Shared Cache and Timers

Introduction

In this session we modify our getTemperature microservice to retrieve temperature data from the National Weather Service endpoint periodically using a timer. We then save the temperature we receive from the endpoint in a Shared Cache and treat it as an Ambient Temperature.
We modify our logTemperaturesMqtt stream service to read the Ambient Temperature from the Shared Cache, then subtract it from the received device temperature and save the difference in our collection.

Pre-requisites

Completed Session 9 system or have the .zip file of the system accessible.

Code Snippets (copy & paste)

Get Temperature API
Temperature Stream Service

Additional Info

Date posted: October 9th, 2020
YouTube Link: Click here to see the recording

Session 9: Relay Topics

Introduction

In this session we will learn how to send messages between MQTT clients that are connected to one of the different MQTT brokers within one ClearBlade system. There is one MQTT broker in the platform and one broker per edge.
We will modify our Python adapter to subscribe to a “Platform to Edge” topic based on which it returns smooth or raw temperature data. We will also have the adapter publish an acknowledgement to an “Edge to Platform” topic.
We will add a Toggle widget to our portal to allow us to select between smooth and raw data. Then we will add a Text widget to display the acknowledgement message.

Pre-requisites

Completed Session 8 system or have the .zip file of the system accessible.

Code Snippets (copy & paste)

Toggle Widget Event Parser Data
Temperature Adapter

Additional Info

Date posted: September 18th, 2020
YouTube Link: Click here to see the recording

Session 8: Using the New MQTT Library and Handling Promises

Introduction

In this session we will tackle two main tasks that are unified by the fact that they both involve handling promises:
A. Create a version of the logTemperatures stream service that uses the new MQTT library.
B. Add a Toggle widget to our portal that will allow us to select between “C” (Celsius) and “F” (Farenheit). Our choice will dictate the unit in which the Speedometer widget (which has been part of our portal since Session 1) displays the temperature. Recall that this temperature is retrieved by the getTemperature microservice we created in Session 1. This code-service retrieves an array of time/temperature forecast data from an HTTP endpoint maintained by the National Weather Service. Therefore, this task will involve modifying the getTemperature microservice.

Pre-requisites

Completed Session 7 system or have the .zip file of the system accessible.

Checking out the Python Adapter Library

Code Snippets (copy & paste)

Get Temperature API
Temperature Conversion Function
Temperature Stream Service
Python Temperature Adapter
Speedometer Widget Data Parser
Speedometer Widget Event Parser

Additional Info

Date posted: September 11th, 2020
YouTube Link: Click here to see the recording

Session 7: Custom Device Columns, Libraries, and Configurations

Introduction

In this session we will address the situation where different devices may send temperature data in different units (Fahrenheit/ Celsius).
We will add a custom string column to our Devices table called temperature_unit, which will hold F (Fahrenheit) or C (Celsius). We will create a Library with a function that converts Fahrenheit to Celsius. We will also create a Configuration with an upper temperature limit such that only temperatures above that limit will be logged.
Then we will modify the stream service to save only Celsius temperatures above the threshold.

Pre-requisites

Completed Session 6 system or have the .zip file of the system accessible.

Code Snippets (copy & paste)

Configuration File
Temperature Conversion Function
Temperature Stream Service
Python Temperature Adapter

Additional Info

Date posted: September 4th, 2020
YouTube Link: Click here to see the recording

Session 6: Capturing and Displaying Data from Multiple Devices

Introduction

In this session we modified our system to capture and display data from two devices. We will have two copies of our temperature adapter running on one edge. One will authenticate as device-1 and the other as device-2. The time and temperature data for both will be stored in a single collection on the edge that is synced up to the platform. The data is displayed in a new line chart widget showing one plot for device-1 data and a second plot for device-2 data.

Pre-requisites

Completed Session 5 system or have the .zip file of the system accessible.

Code Snippets (copy & paste)

Line Chart Data Parser
Plot Data Internal Resource
Temperature Stream Service
Python Temperature Adapter

Additional Info

Date posted: August 28th, 2020
YouTube Link: Click here to see the recording

Session 5: Deploying an Edge and Adapter

Introduction

In this session, we will be installing the ClearBlade Edge on a Gateway (it can be your personal computer in this case). We will be modifying the Python code written in Session 4 to function as an adapter.  The adapter will publish messages to the MQTT broker running at the edge.  The temperature data will then be stored in a Collection on the edge. We will sync relevant assets between the platform and the edge by using a deployment such that our portal will still show incoming data.

Pre-requisites
    Completed Session 4 system or have the .zip file of the system accessible.
    Windows users will need either:
    1. A Linux machine / VM you can SSH into (something like a RaspberryPi is fine) OR
    2. A Windows Store Linux app running on top of the Windows Subsystem for Linux (WSL).
    If using (1) above you will need to install PuTTY

    If using (2) above, the most up-to-date instructions on this are here (one modification – rather than the main Ubuntu app, install the “Ubuntu 18.04 LTS” app

Note regarding Ubuntu 18.04:
Ubuntu 18.04 LTS comes preinstalled with Python3.6.9 but not pip3. Follow the “Installing pip for Python 3” instructions here

Note on installing the clearblade PyPi module:
Install using “pip3 install clearblade”.

Code Snippets (copy & paste)

mqttClientUserDevice_s5.py

Additional Info

Date posted: August 20th, 2020
YouTube Link: Click here to see the recording
Windows Version

Session 4: Building an external MQTT client using an SDK

Introduction

In this session, we will have a Python program connect to our temperatureMonitor system as an external MQTT client. This MQTT client will have the following characteristics:

It will authenticate as a device.
It will subscribe to one topic on which a request can be sent.
It will publish to one topic. The data published will be raw or smoothed (averaged) temperature data depending on what request was received.
The temperature data will be displayed in the existing Scatter Plot widget.

Pre-requisites
    Completed Session 3 system or have the .zip file of the system accessible.
    Have Python 3.6 or newer installed and ready to use. Python can be installed from here.
    Have completed at least a Hello World Python exercise.
    Ensure you know how to change directories and run a Python3 program from your terminal (e.g. Bash on Linux, Cmd or PowerShell on Windows, Terminal on MacOS). Be aware that many Operating Systems come pre-installed with Python2, so make sure you’re able to run code using Python 3.6.x.
    Have an editor available to edit and save changes to the Python code. A simple text editor is sufficient, but something like VSCode is ideal.
    Install the ClearBlade Python SDK (not from source) as indicated here.
    Ensure that port 1884 is not blocked by your firewall.
Code Snippets (copy & paste)
Additional Info

Date posted: August 13th, 2020
YouTube Link: Click here to see the recording

Session 3: Using a stream service to subscribe to an MQTT topic

Introduction

In this session, we will be publishing and subscribing to message topics using MQTT.

The process will include creating a Stream Service which will:

(a) subscribe to a topic to get temperature data and

(b) write that data to the existing collection.

Pre-requisites
    Completed Session 2 system or have the .zip
    file of the system accessible.
    Have the two code-snippets accessible for copy and paste:
    Modified scatter plot data parser
Additional Info

Date posted: August 5th, 2020
YouTube Link: Click here to see the recording

Session 2: Storing data using a Collection

Introduction

In this session, we will be using our simple system from last session to capture temperature data from an HTTP Endpoint and display it in a Scatter Plot.  We will be using an array of temperatures from a forecast period from the National Weather Service. The data we capture will then be written into a collection and sorted by timestamp.

The system will include a portal with a Speedometer widget that will show temperature data from a microservice we build. The temperature data will be from a National Weather Service API endpoint

Pre-requisites
    Completed Session 1 system or have the .zip file of the system accessible.
    Have the two code-snippets accessible for copy and paste:
    Scatter plot data parser
Additional Info

Date posted: July 30th, 2020
YouTube Link: Click here to see the recording

Session 1: Capturing data from an HTTP Endpoint using a Microservice

Introduction

We will be creating a generic temperature monitoring system.
The system will include a portal with a Speedometer widget that will show temperature data from a microservice we build. The temperature data will be from a National Weather Service API endpoint

Pre-requisites
    Please create an account on ClearBlade Platform
Additional Info

Date posted: July 23rd, 2020
YouTube Link: Click here to see the recording