Files and study material for the Arup IoT Workshop 2020
Slides for the workshop.
Instructions and video walkthrough
- 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“
- 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
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
gcloud projects list
to check that theiot-workshop-2020
is listedgcloud config set project iot-workshop-2020
- Create a new Cloud IoT device
changing
gcloud iot devices create LPS-## \ --region=europe-west1 \ --registry=iot-workshop-2020-registry \ --public-key="path=./iot_public.pem,type=es256"
##
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
- Install these three libraries in the Arduino software
- code/04_esp32_to_giotcloud
- Add the private key to the
ciotc_config.h
file in thecode/04_esp32_to_giotcloud
and change the other variables to point to the project, location, registry, device and local WiFi settings
TBC