Introduction to software and platforms available at #MakeZurich.
Found a bug or have a question? Submit an issue.
Here's a simple reference model for Internet of Things (IoT) applications:
For a general introduction to IoT, see this presentation.
A device contains a microcontroller, connectivity and sensors or actuators.
To create a custom device, read the #MakeZurich hardware intro.
Connectivity options include Bluetooth Low Energy (BLE) and LoRaWAN.
The Things Network (TTN) is a global, open LoRaWAN infrastructure.
A gateway forwards data from a device to the backend and vice versa.
In Zürich there are plenty of TTN LoRaWAN gateways already.
To check if there's network coverage, use the TTN mapper.
You can also build or buy a indoor or outdoor gateway.
See this tutorial based on the Zero W.
The backend server provides a service endpoint in the cloud.
Devices send data to the backend, or receive commands.
Clients get data from the backend, or send commands.
Crash course: LoRaWAN and TTN, October
2628, 7pm at Bitwäscherei.
The TTN LoRaWAN backend provides access to data sent by your devices, here's a system overview.
To send data, sign up for a TTN account, open the EU or Swiss console, create an app and add your device.
The TTN LoRaWAN backend provides integrations with 3rd-party services, an HTTP API and a MQTT API.
Here there is a general overview of how to build applications with TTN, including different SDKs and other integration options.
The TTN LoRaWAN backend provides an integration with ThingSpeak, check this tutorial.
The TTN LoRaWAN backend offers a Webhook based HTTP integration.
The TTN LoRaWAN backend is also an MQTT broker.
This means you can read your data with any MQTT client library.
Consider using these MQTT client libraries for Go, Java, Node.js or Python.
- To get uplink packets from a device:
$ mqtt sub -t "<AppID>/devices/<DevID>/up" \
-h "eu.thethings.network" -u "<AppID>" \
-P "<AppAccessKey>" # see TTN console, apps
- To send a packet downlink, Base64 encoded:
$ mqtt pub -t "<AppID>/devices/<DevID>/down" \
-m '{"port":1,"payload_raw":"<Bytes>"}' -h …
To host your own code during #MakeZurich, get a free Linux virtual machine (VM) from Datacenter Light.
Contact [email protected] with the subject MakeZurich VM and specify what you need:
CPU cores (1..8), RAM size (1..16) GB, SSD size (10..50) GB and native IPv4 (yes/no).
3rd-party services allow to store or display data, and add logic "in the cloud".
Dweet.io is a simple storage service for name/value pairs.
- Host: dweet.io
- Port: 443
- POST /dweet/for/THING_NAME?NAME=VALUE
- POST /dweet/for/THING_NAME?NAME=VALUE&NAME2=VALUE2
- GET /get/latest/dweet/for/THING_NAME
- GET /get/dweets/for/THING_NAME
IFTTT is a rule-based service to integrate connected products.
Node-RED is a flow-based development tool for visual programming.
- Host: LOCAL_IP (e.g. on your Laptop or a Raspberry Pi)
- Port: 1880
- https://nodered.org/docs/
- https://cookbook.nodered.org/ (e.g. mqtt or http)
- https://www.npmjs.com/package/node-red-contrib-ttn
ThingSpeak is an IoT platform to store and display sensor data.
- https://www.mathworks.com/help/thingspeak
- Host: api.thingspeak.com
- Port: 80 or 443
- POST /update?api_key=WRITE_API_KEY&field1=42
- POST /update?api_key=WRITE_API_KEY&field1=7&created_at=2019-05-03T00:00:00Z
- GET /channels/CHANNEL_ID/feed.json?api_key=READ_API_KEY
The client is usually a Web browser, an Android app or an iOS app.
Or, an Internet-connected device like a Raspberry Pi or an ESP8266 device acts as a client.
cURL is a great command line (CLI) HTTP client.
Use cURL to debug Web API calls.
- Install cURL via https://curl.haxx.se > Download
- Send a GET request:
$ curl -v tmb.gr/hello.html
- Send a POST request with a text body:
$ curl -v --data 't=23' https://postb.in/...
- Send a POST request with a JSON body:
$ curl -v -H 'Content-Type: application/json' --data '{"t":23}' https://postb.in/...
- Send a PUT request:
$ curl -vX PUT --data 'hello' https://postb.in/...
- For details, see https://curl.haxx.se/docs/manual.html and https://curl.haxx.se/book.html
Postbin is a Web based tool to debug Webhook calls.
- Visit https://postb.in/ to create a new (temporary) bin
- Send a Web request to the displayed URL, e.g. with cURL
- Refresh the bin Web page to see incoming Web requests
MQTT.js comes with a command line (CLI) MQTT client.
Use the mqtt tool to debug MQTT API calls.
- Install MQTT.js CLI from https://github.com/mqttjs/MQTT.js or
$ sudo npm install mqtt -g
- Publish a message to a topic:
$ mqtt pub -t 'mytopic' -h 'test.mosquitto.org' -m 'Hello, world!'
- Subscribe to a topic:
$ mqtt sub -t 'mytopic' -h 'test.mosquitto.org'
#MakeZurich on the TTN Switzerland Slack.
This tutorial by MakeZurich.ch is licensed under CC BY 4.0.