Avnet IoTConnect Platform Solution with Gateworks SBC

The Internet of Things is revolutionizing the way the world works by having nearly any and every device connected to the internet for control and monitoring.

Avnet, a global technology solutions provider, has created an enterprise IoT Software Platform based on the Microsoft Azure framework. This allows for devices, such as a Gateworks Single Board Computer, to send data to the cloud for analysis, alerts, storage and more. Typical data comes from sensors, such as temperature, humidity, vibration, GPS location. These sensors can be connected over many different interfaces, such as I2C, SPI, RS485, RS232, ADC, and BLE. Gateworks offers many ways to connect to the cloud, including, but not limited to, Cellular, WiFi, Satellite Modem and Ethernet.

Gateworks has created a simple demo in which the onboard temperature sensor is probed and the data is sent using the Avnet IoT SDK in Python to the cloud over MQTT.

Gateworks is a manufacture of single board computers and Avnet provides the cloud and optional software services.

Learn more about Avnet's IoTConnect Platform:

Gateworks GW5910 SBC:

System Diagram


  • Avnet IoTConnect Trial or Full Account (contact Gateworks support)
  • Gateworks Single Board Computer (Ventana GW5220 was used for demo)
    • Ubuntu Bionic Operating System (although other OS's could work, they have not been tested)
    • Software packages in software requirements below

Software Requirements

  • Python packages on the Gateworks SBC
    • apt-get update
      apt-get install python2.7 python3.7 python-paho-mqtt python3-paho-mqtt python-pip python3-pip
  • Avnet Python IoT SDK
    • Download using wget or transfer to the Gateworks SBC
    • Unzip archive (may require apt-get install unzip utility)
    • Install archive on Gateworks SBC
      • cd iotconnect-sdk/
        pip install iotconnect-sdk-2.0.tar.gz

Getting Started

  • Access the Avnet IoT Dashboard here:
  • Setup a template and device on the Avnet Platform with instructions here:
  • Edit the demo python script (iotconnect/sample/ created by Gateworks to upload actual board temperature and simulated humidity every 60 seconds.
    • Three pieces of required data to be modified in the demo code using something like the 'vi' editor:
      • CPID is the company ID, a special key found on the Avnet IoT Dashboard under Settings -> Company Profile
      • DeviceID (Unique ID) is the device id. Something like device1 was used for the demo.
      • Environment should be set as what is provided by the Avnet support team
  • Run the Python script from the Gateworks SBC command line:
    • root@bionic-ventana:~iotconnect-sdk/sample# python
      Protocol Initialized...
      [{'data': {'Temperature': '41.3', 'Humidity': '42'}, 'uniqueId': 'gateworks1', 'time': '2020-05-08T22:31:42.000Z'}]
      Publish data sucessfully... 2020-05-08 22:31:42.000
  • Verify the data in the Devices area on the Avnet IoT Connect cloud site:
    • Device telemetry showing actual board temperature and simulated humidity:

  • Device graph showing temperature and simulated humidity

  • Devices listing:

Next Steps

  • Other sample scripts exist in the samples directory, including the
  • Connect more data from other sensors connected to other bus's
  • Explore on the IoTConnect platform to analyze, monitor and notify on the uploaded data
  • Expand the demo to have the Gateworks SBC act as an IoT Gateway for many sensors

Further IoT Reading

Source Demo Code Reference

The below code is that was used in the demo above. Please note to change the cpId.

# Compatible with python 2.* version
import sys
import os.path
from iotconnect import IoTConnectSDK
import json
import time
import random
from datetime import datetime

def callbackMessage(msg):
    if msg:
        print("\n--- Command Message Received ---")

def callbackTwinMessage(msg):
    if msg:
        print("\n--- Twin Message Received ---")

def main(argv):
 while True:
        env = "enter_evn_name_here"

        uniqueId = "enter_device_id_here_example_device1"
        cpId = "enter_company_id_here_from_avnet_portal"

        with IoTConnectSDK(cpId, uniqueId, callbackMessage, callbackTwinMessage, env) as sdk:
                dataArray = []

                aObj = {}
                temp = float(open('/sys/class/hwmon/hwmon0/temp1_input', 'r').read().strip())/1000
                aObj["Temperature"] = str(temp)
                aObj["Humidity"] = str(random.randint(40,50))

                dObj = {
                       "uniqueId": "gateworks1",
                       "time": datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%S.000Z"),
                       "data" : aObj
                if len(dataArray) > 0:
            except Exception as ex:
    except Exception as ex:

if __name__ == "__main__":

Last modified 5 weeks ago Last modified on 07/01/2020 09:51:18 PM

Attachments (6)

Download all attachments as: .zip