diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2018-06-13 20:02:36 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2018-06-13 20:02:36 +0200 |
commit | e4bdeee49319bc5570dfa0e998e4e68f3c33ee8c (patch) | |
tree | 27a4fc54611746d2c3c74f9412e68e0032f76ac1 | |
parent | 970b9667089f08a606d9df53d72123095f452a58 (diff) | |
download | iot-workshop-ndc-2018-e4bdeee49319bc5570dfa0e998e4e68f3c33ee8c.tar.gz iot-workshop-ndc-2018-e4bdeee49319bc5570dfa0e998e4e68f3c33ee8c.tar.bz2 iot-workshop-ndc-2018-e4bdeee49319bc5570dfa0e998e4e68f3c33ee8c.tar.xz iot-workshop-ndc-2018-e4bdeee49319bc5570dfa0e998e4e68f3c33ee8c.zip |
wip
-rw-r--r-- | .gitmodules | 0 | ||||
-rw-r--r-- | assignments/read-a-button/read-a-button.md | 2 | ||||
-rw-r--r-- | assignments/read-a-button/read-a-button.pdf | bin | 321997 -> 766818 bytes | |||
-rw-r--r-- | slides/.gitignore | 3 | ||||
-rw-r--r-- | slides/Makefile | 7 | ||||
-rw-r--r-- | slides/TODO.md | 5 | ||||
-rw-r--r-- | slides/connected-arduino.md | 93 | ||||
-rw-r--r-- | slides/images/mqtt-seq.pdf | bin | 0 -> 12113 bytes | |||
-rw-r--r-- | slides/images/mqtt-seq.pgf | 46 | ||||
-rwxr-xr-x | slides/images/pp-template | 8 | ||||
-rw-r--r-- | slides/images/qtikz-template.pgs | 3 |
11 files changed, 104 insertions, 63 deletions
diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.gitmodules diff --git a/assignments/read-a-button/read-a-button.md b/assignments/read-a-button/read-a-button.md index 2cf7592..6a7fcdd 100644 --- a/assignments/read-a-button/read-a-button.md +++ b/assignments/read-a-button/read-a-button.md @@ -6,6 +6,8 @@ Wire up this schematic on the bread board: ![](schematic/read-a-button_schem.pdf) +![](schematic/read-a-button_bb.pdf) + ## Step 2 * Change sampling frequency diff --git a/assignments/read-a-button/read-a-button.pdf b/assignments/read-a-button/read-a-button.pdf Binary files differindex 057d0a1..f32eab7 100644 --- a/assignments/read-a-button/read-a-button.pdf +++ b/assignments/read-a-button/read-a-button.pdf diff --git a/slides/.gitignore b/slides/.gitignore new file mode 100644 index 0000000..d8071c4 --- /dev/null +++ b/slides/.gitignore @@ -0,0 +1,3 @@ +*.tmp.tex +*.log +*.aux diff --git a/slides/Makefile b/slides/Makefile index 4f2b761..e92b20f 100644 --- a/slides/Makefile +++ b/slides/Makefile @@ -72,6 +72,13 @@ $(BUILD_DIR)/%.revealjs.md.d: %.md | $(BUILD_DIR) %-reveal.html: %.revealjs.md $(RUN_PANDOC_REVEALJS) -o $@ $< +images/%.pdf: images/%.pgf | images/pp-template Makefile + images/pp-template $< > $(patsubst %.pgf,%.tmp.tex,$<) + TEXINPUTS=./:images/tikzuml-v1.0-2016-03-29: \ + xelatex -output-directory=images \ + -jobname $(notdir $(basename $@)) \ + $(patsubst %.pgf,%.tmp.tex,$<) + images/%.pdf: images/%.tex | images/pp-template Makefile images/pp-template < $< > $(patsubst %.tex,%-full.tex,$<) xelatex -output-directory=images $(patsubst %.tex,%-full.tex,$<) diff --git a/slides/TODO.md b/slides/TODO.md new file mode 100644 index 0000000..ae81edd --- /dev/null +++ b/slides/TODO.md @@ -0,0 +1,5 @@ +Slide: *Device and application architecture with MQTT* + +* Add one-way pointers for TCP, keep existing as MQTT messaging. + Illustrates that everyone connects to the broker, but messages can + be pushed. Contrast to HTTP. diff --git a/slides/connected-arduino.md b/slides/connected-arduino.md index 6a6b5e7..79ba123 100644 --- a/slides/connected-arduino.md +++ b/slides/connected-arduino.md @@ -292,6 +292,36 @@ Version 3.1.1 er den som gjelder, V 3.1 er rar, de andre finnes ikke \end{center} ) +## 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` + +::: notes + +Typical first round of implementation. + +Commands can be: +* load new firmware (maybe an URL and firmware signature). +* Set new calibration values +* Change reading interval, altert levels (autonomous operation) + +::: + ## MQTT - Implementations * Mosquitto @@ -334,12 +364,13 @@ Agents have one of two roles: * *Client* * Publishes *messages* * Subscribes / unsubscribes to *topics* + * Keep alive * *Broker* (aka Server) * Handles network connections * Keeps subscriptions * Manages client - * Disconnects + * Timeouts and disconnects * *(last) will* * Persistence of retained messages @@ -359,36 +390,6 @@ Push vs pull, central applications can push to clients ::: -## MQTT - The protocol - MQTT Packet - -* Size oriented -* Flags indicate type of remaining bytes - * Packet type - * Topic name - * Payload - -::: notes - -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 Connect - -* `CONNECT` - * `clientId` - * `username` - * `password` - * `keepAlive` - -<!-- --> - -* Keep alive - * `PINGREQ` - * `PINGRESP` - ## MQTT - The protocol - MQTT Topic * Topic name: `foo/bar/baz` @@ -441,36 +442,6 @@ Broker * `$app/$device/online` * `0` -## 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` - -::: notes - -Typical first round of implementation. - -Commands can be: -* load new firmware (maybe an URL and firmware signature). -* Set new calibration values -* Change reading interval, altert levels (autonomous operation) - -::: - ## MQTT on Arduino PubSubClient is our MQTT client implementation. diff --git a/slides/images/mqtt-seq.pdf b/slides/images/mqtt-seq.pdf Binary files differnew file mode 100644 index 0000000..bcee05d --- /dev/null +++ b/slides/images/mqtt-seq.pdf diff --git a/slides/images/mqtt-seq.pgf b/slides/images/mqtt-seq.pgf new file mode 100644 index 0000000..8001ec1 --- /dev/null +++ b/slides/images/mqtt-seq.pgf @@ -0,0 +1,46 @@ +\begin{tikzpicture} +\begin{umlseqdiag} + +\umlactor{Device} +\umlactor{Broker} +\umlactor{Central} + +\begin{umlcall}[op={sub(dev/\#/online)}]{Central}{Broker} +\end{umlcall} + +\begin{umlcall}[dt=15, op={con(dev/123/online, 0)}]{Device}{Broker} \end{umlcall} +\begin{umlcall}[dt=5, name=pub,op={pub(dev/123/online, 1)}]{Device}{Broker} \end{umlcall} + +%\begin{umlcallself}[dt=5, op={terminate()}]{Device}\end{umlcallself} + +%\umlnote{death}{woop} +\umlnote[x=-3,y=-2]{sb-pub}{After this the device drops off the Wi-Fi} + + +\begin{umlcall}[dt=10, op={pub(dev/123/online, 0)}]{Broker}{Central} \end{umlcall} + +%\umlsdnode[dt=20]{Central} +%\umlsdnode[dt=5]{Broker} +%\begin{umlcall} +%\end{umlcall} + +\iffalse +\begin{umlcall}{A}{C} + \begin{umlcall}{C}{A} + \end{umlcall} + + \begin{umlcall}[dt=10]{B}{C} + \begin{umlcall}{C}{B} + \end{umlcall} + + \begin{umlcall}[return=1]{B}{C} + \end{umlcall} + \end{umlcall} + + \begin{umlcall}[dt=20, return=1]{A}{C} + \end{umlcall} + +\end{umlcall} +\fi +\end{umlseqdiag} +\end{tikzpicture} diff --git a/slides/images/pp-template b/slides/images/pp-template index 8021025..3e51cc9 100755 --- a/slides/images/pp-template +++ b/slides/images/pp-template @@ -1,8 +1,12 @@ #!/bin/bash +set -e + echo '\documentclass[preview]{standalone} \usepackage{blindtext} -\usepackage[utf8]{inputenc} +%\usepackage[utf8]{inputenc} \usepackage{tikz} +\usepackage{tikz-uml} +%\usepackage{pgf-umlsd} \usetikzlibrary{ angles, arrows, @@ -24,5 +28,5 @@ echo '\documentclass[preview]{standalone} \usepackage{fontspec} \setsansfont{Verdana} \begin{document}' -cat - +cat "$1" echo '\end{document}' diff --git a/slides/images/qtikz-template.pgs b/slides/images/qtikz-template.pgs index edb322b..c2fd323 100644 --- a/slides/images/qtikz-template.pgs +++ b/slides/images/qtikz-template.pgs @@ -2,7 +2,10 @@ \documentclass[preview]{standalone} \usepackage{blindtext} \usepackage[utf8]{inputenc} +\usepackage[english]{babel} \usepackage{tikz} +\usepackage{tikz-uml} +\usepackage{pgf-umlsd} \usetikzlibrary{ angles, arrows, |