gerrykou / iot_workshop_2020

Files and study material for the Arup IoT Workshop 2020

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

iot_workshop_2020

Files and study material for the Arup IoT Workshop 2020

Slides for the workshop.

ESP32 Controller

ESP32

ESP32 board

ESP32 Pinout

ESP32 software installation

Instructions and video walkthrough

GitHub ESP32 software page

ESP32 tools and documentation

ESP32 pinout guide

  • Install the Arduino GUI
  • Enter https://dl.espressif.com/dl/package_esp32_index.json into the “Additional Board Manager URLs” field in File > Preferences on the Arduino GUI . Then, click the “OK” button
  • Restart the Arduino GUI
  • Go to Tools > Board > Boards Manager
  • Search for ESP32 and press install button for the “ESP32 by Espressif Systems“

Push the example code to the ESP32

Google Cloud Platform (GCP) setup

  • Install Google Cloud SDK
  • Optional: if using Windows install the new Windows Terminal application
  • If you already have the GCP SDK installed, update it with gcloud components update
  • gcloud auth login to authenticate the GCP command line interface
  • Check that you can access the GCP project console

Steps done before the workshop

Don't do these steps as they have been done already. They are listed for reference in case you need to create a new project.

For this workshop the following variables are used:

  • PROJECT_ID = iot-workshop-2020

  • REGISTRY_NAME = iot-workshop-2020-registry

  • PUBSUB_TOPIC = iot-workshop-topic

  • PUBSUB_SUBSCRIPTION = iot-workshop-subscription

  • Create a new project gcloud projects create PROJECT_ID

  • Set default project gcloud config set project PROJECT_ID

  • Enable Cloud Pub/Sub gcloud services enable pubsub.googleapis.com

  • Enable billing (required for Cloud IoT)

  • Enable Cloud IoT gcloud services enable cloudiot.googleapis.com

  • Give permission to Cloud IoT Core to publish messages on Cloud Pub/Sub

    gcloud projects add-iam-policy-binding PROJECT_ID \
    --member=serviceAccount:cloud-iot@system.gserviceaccount.com \
    --role=roles/pubsub.publisher
    
  • Create device registry and enable the MQTT Bridge and the HTTP Bridge

    gcloud iot registries create REGISTRY_NAME \
    --region=REGION_NAME \
    --event-notification-config=topic=PUBSUB_TOPIC \
    --enable-mqtt-config --enable-http-config
    
  • Generate an Eliptic Curve (EC) ES256 private / public key pair

    openssl ecparam -genkey -name prime256v1 -noout -out iot_private.pem
    openssl ec -in iot_private.pem -pubout -out iot_public.pem
    
  • gcloud pubsub topics create PUBSUB_TOPIC

  • gcloud pubsub subscriptions create PUBSUB_SUBSCRIPTION --topic PUBSUB_TOPIC

Steps for the workshop

Set the active project

  • gcloud projects list to check that the iot-workshop-2020 is listed
  • gcloud config set project iot-workshop-2020

Create the IoT core device

  • Create a new Cloud IoT device
    gcloud iot devices create LPS-## \
    --region=europe-west1 \
    --registry=iot-workshop-2020-registry \
    --public-key="path=./iot_public.pem,type=es256"
    
    changing ## with a number from the list in the spreadsheet
  • openssl ec -in iot_private.pem -noout -text
    read EC key
    Private-Key: (256 bit)
    priv:
        35:da:f1:6b:e5:c4:ec:fb:5f:0a:35:99:a0:61:e5:
        34:45:46:2c:16:2e:19:49:ed:0a:50:8e:cb:3c:1d:
        03:f2
    pub:
        04:64:4e:44:89:89:80:33:14:ea:7e:72:aa:4d:de:
        8e:e0:ac:f1:a8:6f:11:b1:2d:54:25:8b:6c:5c:8e:
        a4:02:e7:2d:2e:c4:10:66:ee:51:1e:33:cf:95:bd:
        80:00:b2:ad:44:11:4c:70:4b:38:6e:ad:86:63:80:
        03:7c:22:7c:c6
    ASN1 OID: prime256v1
    NIST CURVE: P-256
    

Push the example code to the ESP32

Data communication stack

Data pipeline

TBC

About

Files and study material for the Arup IoT Workshop 2020

License:MIT License


Languages

Language:C++ 45.0%Language:C 36.7%Language:Python 10.6%Language:Shell 7.7%