Skip to content

makezurich/makezurich-software-intro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

#MakeZurich software intro

Introduction to software and platforms available at #MakeZurich.

Found a bug or have a question? Submit an issue.

Internet of Things

Here's a simple reference model for Internet of Things (IoT) applications:

For a general introduction to IoT, see this presentation.

Device

A device contains a microcontroller, connectivity and sensors or actuators.

To create a custom device, read the #MakeZurich hardware intro.

Connectivity

Connectivity options include Bluetooth Low Energy (BLE) and LoRaWAN.

The Things Network (TTN) is a global, open LoRaWAN infrastructure.

Gateway

A gateway forwards data from a device to the backend and vice versa.

The Things Network LoRaWAN gateway

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.

Raspberry Pi as a BLE gateway

See this tutorial based on the Zero W.

Backend

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.

The Things Network LoRaWAN backend

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.

Building applications with TTN

Here there is a general overview of how to build applications with TTN, including different SDKs and other integration options.

Using the ThingSpeak integration to store data from TTN

The TTN LoRaWAN backend provides an integration with ThingSpeak, check this tutorial.

Receiving your data from TTN with an HTTP Web service

The TTN LoRaWAN backend offers a Webhook based HTTP integration.

Subscribing to data from TTN with an MQTT client

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 …

Hosting on virtual machines

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

3rd-party services allow to store or display data, and add logic "in the cloud".

Dweet.io

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

IFTTT is a rule-based service to integrate connected products.

Node-RED

Node-RED is a flow-based development tool for visual programming.

ThingSpeak

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

Client

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.

Tools

cURL

cURL is a great command line (CLI) HTTP client.

Use cURL to debug Web API calls.

$ 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/...

Postbin

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

MQTT.js comes with a command line (CLI) MQTT client.

Use the mqtt tool to debug MQTT API calls.

$ 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'

Support

#MakeZurich on the TTN Switzerland Slack.

License

This tutorial by MakeZurich.ch is licensed under CC BY 4.0.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published