From 284a60cf65523b3a868a58cf2edc97d190a95608 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Fri, 27 Apr 2018 00:39:19 +0200 Subject: wip --- slides/what-is-iot-reveal.html | 263 ++++++++++++++++++++++------------------- 1 file changed, 142 insertions(+), 121 deletions(-) (limited to 'slides/what-is-iot-reveal.html') diff --git a/slides/what-is-iot-reveal.html b/slides/what-is-iot-reveal.html index 0d73619..b63657a 100644 --- a/slides/what-is-iot-reveal.html +++ b/slides/what-is-iot-reveal.html @@ -172,9 +172,9 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni Chip CPU -Freq +Freq RAM -Flash +Flash Price @@ -182,33 +182,33 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni nRF52810 Cortex-M4 -64 M -Hz 24k -192k +64 MHz +24k +192k $1.88 nRF52832 -Cortex-M4 -F +Cortex-M4F + 32k -256k +256k $2.54 - + 64k -512k +512k $2.59 nRF52840 -Cortex-M4 -F +Cortex-M4F + 256k -1024k +1024k $3.85 @@ -451,12 +451,11 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni

Details: IP

- -
-

Details: IP

+
+

Details: UDP

+ +

TODO: add payload to “ip packets”

Lecture: ESP8266

NodeMCU hardware

@@ -530,8 +529,12 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni void restart(); uint32_t getFreeHeap(); uint32_t getChipId(); -} ESP; -

// Usage ESP.restart();

+ + ... +} ESP; + +// Usage +ESP.restart();

ESP Arduino APIs

class {
@@ -544,11 +547,13 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
     IPAddress subnetMask();
     IPAddress gatewayIP();
     IPAddress dnsIP(uint8_t dns_no = 0);
-} WiFi;
-
-// Usage:
+
+    ...
+} WiFi;
 
-Serial.println(WiFi.localIP().toString());
+// Usage: + +Serial.println(WiFi.localIP().toString()); @@ -565,6 +570,40 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni

Has UDP-like semantics with “fire and forget” but on a higher level (the message always have to be delivered and ACKed by the broker, not it’s final recipient.

Version 3.1.1 er den som gjelder, V 3.1 er rar, de andre finnes ikke (før standardisering).

+
+

MQTT - Implementations

+
    +
  • Mosquitto
  • +
  • Eclipse Paho
  • +
  • RabbitMQ
  • +
  • ActiveMQ
  • +
+ +
+

MQTT Cloud Connectors

+
    +
  • Cloud +
      +
    • Amazon IoT
    • +
    • Google Cloud IoT
    • +
    • Microsoft Azure IoT
    • +
    • CloudMQTT (at Heroku)
    • +
  • +
  • DIY +
      +
    • ThingMQ
    • +
    • HiveMQ
    • +
  • +
+

MQTT - The protocol

Agents have one of two roles:

@@ -591,47 +630,7 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni

http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/mqtt-v3.1.1.html

Subscriptions are not permanent. The connection is (unlike HTTP) stateful.

Some messages may be persistent, but only one per topic. You will often end up with a “proper” mq on the backend if queuing is needed.

- -
-

MQTT - The protocol - MQTT Topic

-
    -
  • Topic name: foo/bar/baz
  • -
  • Topic filter -
      -
    • foo/bar/?
    • -
    • foo/#
    • -
  • -
-
-

MQTT - The protocol - MQTT Topic

-

The temperature sensor:

-
    -
  • Publishes on: -
      -
    • myapp/$device-id/temperature
    • -
    • myapp/$device-id/humidity
    • -
    • myapp/$device-id/altert
    • -
  • -
  • Subscribes to: -
      -
    • myapp/$device-id/command
    • -
  • -
-

The central application:

-
    -
  • Subscribes to: -
      -
    • myapp/#/temperature
    • -
    • myapp/#/humidity
    • -
  • -
  • Publishes on: -
      -
    • myapp/$device-id/command
    • -
  • -
-

MQTT - The protocol - MQTT Packet

@@ -648,28 +647,19 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni

Only packet type + flags (1 byte) is required, everything else is optional.

The size field is variable length encoded, 0-127 bytes is 1 byte, 128-16383 use 2 bytes etc, up to 4 bytes for 256MB payload.

-
-

MQTT - The protocol - MQTT Topic - more

-

Enten må den holdes rett etter “## MQTT - The protocol - MQTT Topic” ellers kanskje flyttes etter “patterns”.

-

The central application is split:

-
    -
  • An aggregating agent: -
      -
    • myapp/#/temperature
    • -
    • myapp/#/humidity
    • -
  • -
  • Emailing agent +
+

MQTT - The protocol - Keep alive

+

TODO

+
+

MQTT - The protocol - MQTT Topic

    -
  • myapp/$device-id/altert
  • -
-
  • Publishes on: +
  • Topic name: foo/bar/baz
  • +
  • Topic filter
      -
    • myapp/$device-id/command
    • +
    • foo/bar/?
    • +
    • foo/#
  • -

    MQTT - The protocol - Retained message

    Message is kept by the server even after disconnect

    @@ -723,50 +713,42 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
  • 0
  • -
    -

    MQTT - Patterns

    -

    Må utvides

    -

    Explain:

    +
    +

    MQTT - The protocol - Client id

    +

    TODO

    +
    +

    Device and application architecture with MQTT

    + +
    +

    MQTT Topic

    +

    The temperature sensor:

      -
    • Push vs pull, central applications can push to clients
    • -
    • mostly mqtt, some http
    • -
    • Client id - sparker ut gamle koblinger
    • -
    • Keep alive / ping meldinger
    • -
    • Alternative transporter - websockets(!)
    • -
    -
    -

    MQTT - Implementations

    +
  • Publishes on:
      -
    • Mosquitto
    • -
    • Eclipse Paho
    • -
    • RabbitMQ
    • -
    • ActiveMQ
    • +
    • myapp/$device-id/temperature
    • +
    • myapp/$device-id/humidity
    • +
    • myapp/$device-id/altert
    • +
  • +
  • Subscribes to: +
      +
    • myapp/$device-id/command
    • +
  • - -
    -

    MQTT Cloud Connectors

    +

    The central application:

      -
    • Cloud +
    • Subscribes to:
        -
      • Amazon IoT
      • -
      • Google Cloud IoT
      • -
      • Microsoft Azure IoT
      • -
      • CloudMQTT (at Heroku)
      • +
      • myapp/#/temperature
      • +
      • myapp/#/humidity
    • -
    • DIY +
    • Publishes on:
        -
      • ThingMQ
      • -
      • HiveMQ
      • +
      • myapp/$device-id/command

    MQTT on Arduino

    @@ -801,12 +783,51 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni -
    -

    Assignment: Network play time

    +
    +

    Assignment

      -
    • Measure round trip time/latency. Measure UDP, TCP. Measure when the packet size is greater than the MTU

    • -
    • Notice variations in RTT

    • +
    • mqtt
    +
    +

    MQTT topic architecture

    +

    The central application is split:

    +
      +
    • An aggregating agent: +
        +
      • myapp/#/temperature
      • +
      • myapp/#/humidity
      • +
    • +
    • Emailing agent +
        +
      • myapp/$device-id/altert
      • +
    • +
    • Publishes on: +
        +
      • myapp/$device-id/command
      • +
    • +
    + +
    +

    MQTT - Patterns

    +
      +
    • Combining MQTT and HTTP
    • +
    • Using web sockets transport
    • +
    +
    +

    Assignment

    +
      +
    • mqtt2
    • +
    +
    +

    Assignment

    +
      +
    • mqtt3
    • +
    +

    -- cgit v1.2.3