aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2018-04-27 00:39:19 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2018-04-27 00:39:19 +0200
commit284a60cf65523b3a868a58cf2edc97d190a95608 (patch)
treee51a5502faf49a5ab94f7249ca43a8bd340089a7
parent02e2780d233c2d73fcbd32a2a970d5a6f3696224 (diff)
downloadiot-workshop-284a60cf65523b3a868a58cf2edc97d190a95608.tar.gz
iot-workshop-284a60cf65523b3a868a58cf2edc97d190a95608.tar.bz2
iot-workshop-284a60cf65523b3a868a58cf2edc97d190a95608.tar.xz
iot-workshop-284a60cf65523b3a868a58cf2edc97d190a95608.zip
wip
-rw-r--r--assignments/Makefile2
-rw-r--r--assignments/blink-a-led/blink-a-led.pdfbin722602 -> 722602 bytes
-rw-r--r--assignments/mqtt/mqtt.md5
-rw-r--r--assignments/mqtt/mqtt.pdfbin105234 -> 104784 bytes
-rw-r--r--assignments/mqtt2/mqtt2.md10
-rw-r--r--assignments/mqtt2/mqtt2.pdfbin0 -> 51245 bytes
-rw-r--r--assignments/mqtt3/mqtt3.md12
-rw-r--r--assignments/mqtt3/mqtt3.pdfbin0 -> 53509 bytes
-rw-r--r--assignments/network/network.md7
-rw-r--r--assignments/read-temperature/read-temperature.md4
-rw-r--r--assignments/read-temperature/read-temperature.pdfbin790129 -> 791810 bytes
-rw-r--r--host/requirements.txt2
-rw-r--r--slides/Makefile2
-rw-r--r--slides/images/ip-packet.pgf47
-rw-r--r--slides/images/mqtt-example-architecture.pgf23
-rw-r--r--slides/images/qtikz-template.pgs2
-rw-r--r--slides/images/udp-packet.pgf32
-rw-r--r--slides/toc.md20
-rw-r--r--slides/what-is-iot-reveal.html263
-rw-r--r--slides/what-is-iot-slides.pdfbin314262 -> 308648 bytes
-rw-r--r--slides/what-is-iot-slides.tex465
-rw-r--r--slides/what-is-iot-text.pdfbin331142 -> 315666 bytes
-rw-r--r--slides/what-is-iot.md230
23 files changed, 707 insertions, 419 deletions
diff --git a/assignments/Makefile b/assignments/Makefile
index 2f97a07..6d31568 100644
--- a/assignments/Makefile
+++ b/assignments/Makefile
@@ -2,6 +2,8 @@ AS =
AS += blink-a-led
AS += read-temperature
AS += mqtt
+AS += mqtt2
+AS += mqtt3
PDFS=$(foreach A,$(AS),$(A)/$(A).pdf)
diff --git a/assignments/blink-a-led/blink-a-led.pdf b/assignments/blink-a-led/blink-a-led.pdf
index 785547f..7efd91f 100644
--- a/assignments/blink-a-led/blink-a-led.pdf
+++ b/assignments/blink-a-led/blink-a-led.pdf
Binary files differ
diff --git a/assignments/mqtt/mqtt.md b/assignments/mqtt/mqtt.md
index e89e88c..f52eed3 100644
--- a/assignments/mqtt/mqtt.md
+++ b/assignments/mqtt/mqtt.md
@@ -11,9 +11,6 @@ Get aquainted with MQTT.
1. Connect to MQTT broker
1. Publish temperature
-1. Implement last will to indicate online status
-1. Implement subscription to reconfigure device
- 1. Change temperature report interval
## Tips
@@ -32,7 +29,7 @@ char *cStr = myString.c_str();
## Bonus
-**1:** Print the heap at regular intervals.
+**1:** Print the heap free size at regular intervals.
**2:** Implement min, max and average temperature over configured interval.
diff --git a/assignments/mqtt/mqtt.pdf b/assignments/mqtt/mqtt.pdf
index 4c578f9..35ecd0b 100644
--- a/assignments/mqtt/mqtt.pdf
+++ b/assignments/mqtt/mqtt.pdf
Binary files differ
diff --git a/assignments/mqtt2/mqtt2.md b/assignments/mqtt2/mqtt2.md
new file mode 100644
index 0000000..cfc623a
--- /dev/null
+++ b/assignments/mqtt2/mqtt2.md
@@ -0,0 +1,10 @@
+# Assignment: MQTT
+
+## Goal
+
+Get to know will messages and retained messages.
+
+## Steps
+
+1. Implement last will to indicate online status
+1. Retained message
diff --git a/assignments/mqtt2/mqtt2.pdf b/assignments/mqtt2/mqtt2.pdf
new file mode 100644
index 0000000..b34898e
--- /dev/null
+++ b/assignments/mqtt2/mqtt2.pdf
Binary files differ
diff --git a/assignments/mqtt3/mqtt3.md b/assignments/mqtt3/mqtt3.md
new file mode 100644
index 0000000..2994e9a
--- /dev/null
+++ b/assignments/mqtt3/mqtt3.md
@@ -0,0 +1,12 @@
+# Assignment: MQTT
+
+## Goal
+
+Connect two devices with MQTT
+
+## Steps
+
+1. Publish an alert
+1. Subscribe to alert topic, blink a led when you get a message
+1. Implement subscription to reconfigure device
+ 1. Change temperature report interval
diff --git a/assignments/mqtt3/mqtt3.pdf b/assignments/mqtt3/mqtt3.pdf
new file mode 100644
index 0000000..e156bcf
--- /dev/null
+++ b/assignments/mqtt3/mqtt3.pdf
Binary files differ
diff --git a/assignments/network/network.md b/assignments/network/network.md
new file mode 100644
index 0000000..8e49b24
--- /dev/null
+++ b/assignments/network/network.md
@@ -0,0 +1,7 @@
+## Assignment: Network play time
+
+* Measure round trip time/latency. Measure UDP, TCP. Measure when the
+ packet size is greater than the MTU
+
+* Notice variations in RTT
+
diff --git a/assignments/read-temperature/read-temperature.md b/assignments/read-temperature/read-temperature.md
index 2528b4a..1037ba9 100644
--- a/assignments/read-temperature/read-temperature.md
+++ b/assignments/read-temperature/read-temperature.md
@@ -6,3 +6,7 @@ Wire up this schematic on the bread board:
![](schematic/read-temperature_schem.pdf)
![](schematic/read-temperature_bb.pdf)
+
+## Step 2
+
+* Change sampling frequency
diff --git a/assignments/read-temperature/read-temperature.pdf b/assignments/read-temperature/read-temperature.pdf
index 5a13441..d3f21d1 100644
--- a/assignments/read-temperature/read-temperature.pdf
+++ b/assignments/read-temperature/read-temperature.pdf
Binary files differ
diff --git a/host/requirements.txt b/host/requirements.txt
new file mode 100644
index 0000000..a44e34e
--- /dev/null
+++ b/host/requirements.txt
@@ -0,0 +1,2 @@
+asyncore
+paho-mqtt
diff --git a/slides/Makefile b/slides/Makefile
index e0cc2a6..a94dcd6 100644
--- a/slides/Makefile
+++ b/slides/Makefile
@@ -6,7 +6,7 @@ HTMLS=$(P)-reveal.html
ifeq (1,$(QUICK))
PP_DEFS+=QUICK
-PDF_ENGINE = pdflatex
+PDF_ENGINE = xelatex
#PANDOC_ARGS += --no-highlight
PANDOC_ARGS += --highlight-style=pygments
else
diff --git a/slides/images/ip-packet.pgf b/slides/images/ip-packet.pgf
new file mode 100644
index 0000000..5a977a2
--- /dev/null
+++ b/slides/images/ip-packet.pgf
@@ -0,0 +1,47 @@
+\begin{tikzpicture}[scale=0.30]
+ \sffamily
+ \foreach \x in {0,7,8,15,16,31} % {0,...,32}
+ \node at (\x+0.5,20.5) {\scriptsize \x};
+% \foreach \x in {0,...,31}
+% \node at (\x+0.5,13.5) {\scriptsize \x};
+ \foreach \x in {0,8,16,32} % {0,...,32}
+ \draw[thick] (\x,20) -- (\x,21);
+ \foreach \x in {0,...,32}
+ \draw[thick] (\x,14) -- (\x,20);
+% \foreach \x in {0,...,32}
+% \draw[thick] (\x,13) -- (\x,14);
+ \node[thick] (bit1) at (-0.6,20.5) {\scriptsize bit};
+% \node[thick] (bit2) at (-0.6,13.5) {\scriptsize bit};
+
+\iffalse
+ \draw [<->, thick] (-0.6, 19.9) -- (-0.6,15.1);
+ \draw [thick] (-1, 20) -- (-0.1,20);
+ \draw [thick] (-1, 15) -- (-0.1,15);
+ \node[fill=white] at (-1.1,17.5) {\tiny 20 bytes};
+\fi
+ \foreach \y/\v in {0,4,8,12,16,20}
+ \node at (-0.6,{19.5-(\v / 4)}) {\scriptsize \v};
+
+ \filldraw[thick,draw=black, fill=white] (0,20) rectangle (4,19); \node (mode) at (2,19.5) {\scriptsize version};
+ \filldraw[thick,draw=black, fill=white] (4,20) rectangle (8,19); \node (mode) at (6,19.5) {\scriptsize len};
+% \draw[thick, draw=black, fill=white] (8,20) rectangle (16,19); \node (stratum) at (11.5,19.5) {\scriptsize type of service (TOS)};
+ \draw[thick, draw=black, fill=white] (8,20) rectangle (16,19); \node (stratum) at (11.5,19.5) {\scriptsize TOS};
+ \draw[thick, draw=black, fill=white] (16,20) rectangle (32,19); \node (li) at (24,19.5) {\scriptsize full length of packet};
+ \filldraw[thick,draw=black, fill=white] (0,19) rectangle (16,18); \node (mode) at (8,18.5) {\scriptsize identification};
+% \draw[thick, draw=black] (16,19) rectangle (19,18); \filldraw[white] (16.5,18.43) rectangle (19,18.88); \node [](li) at (17.5,18.67) {\tiny IP flags}; \node at (16.5,18.25) {\tiny x};\node at (17.5,18.25) {\tiny D};\node at (18.5,18.25) {\tiny M};
+ \draw[thick, draw=black] (16,19) rectangle (19,18); \filldraw[white] (16.5,18.43) rectangle (19,18.88); \node at (16.5,18.5) {\scriptsize X};\node at (17.5,18.5) {\scriptsize D};\node at (18.5,18.5) {\scriptsize M};
+ \draw[thick, draw=black, fill=white] (19,19) rectangle (32,18); \node (li) at (24,18.5) {\scriptsize fragment Offset};
+ \filldraw[thick,draw=black, fill=white] (0,18) rectangle (8,17); \node (mode) at (4,17.5) {\scriptsize time to live (TTL)};
+ \draw[thick, draw=black, fill=white] (8,18) rectangle (16,17); \node (stratum) at (11.5,17.5) {\scriptsize protocol};
+ \draw[thick, draw=black, fill=white] (16,18) rectangle (32,17); \node (li) at (24,17.5) {\scriptsize header checksum};
+ \filldraw[thick,draw=black, fill=white] (0,17) rectangle (32,16); \node (mode) at (16,16.5) {\scriptsize source IP address};
+ \filldraw[thick,draw=black, fill=white] (0,16) rectangle (32,15); \node (mode) at (16,15.5) {\scriptsize destination IP address};
+ \draw[thick,draw=black, fill=white] (0,15) rectangle (32,14);
+% \draw[thick,draw=black, fill=white] (0,15) rectangle (31.5,14);
+% \draw[fill=white, draw=white] (31.4,15) rectangle (31.6,16);
+% \draw[thick] (31.5,14.97) decorate [decoration=saw] { -- (31.5,14.02)};
+ \node (mode) at (16,14.5) {\scriptsize IP options (variable length)};
+
+ \filldraw[thick,draw=black, fill=white] (0,12) rectangle (32,14); \node (mode) at (16,13) {\scriptsize payload};
+
+\end{tikzpicture}
diff --git a/slides/images/mqtt-example-architecture.pgf b/slides/images/mqtt-example-architecture.pgf
new file mode 100644
index 0000000..b36827c
--- /dev/null
+++ b/slides/images/mqtt-example-architecture.pgf
@@ -0,0 +1,23 @@
+\begin{tikzpicture}
+
+\path
+ (-3 cm, 0) node (c1_label) {Device \#1}
+ ( 0 cm, 0) node (c2_label) {Device \#2}
+ ( 3 cm, 0) node (c3_label) {Device \#3}
+
+ (0, -3 cm) node (broker_label) {Broker}
+ (0, -6 cm) node (central_label) {Central}
+;
+
+\node (c1)[draw, circle, fit=(c1_label)] {};
+\node (c2)[draw, circle, fit=(c2_label)] {};
+\node (c3)[draw, circle, fit=(c3_label)] {};
+\node (central)[draw, circle, fit=(central_label)] {};
+\node (broker)[draw, rectangle, thick, inner ysep=5 mm, inner xsep=10 mm, fit=(broker_label)] {};
+
+\draw[{Latex[length=4mm, round]}-{Latex[length=4mm, round]}] (c1) to [bend right] (broker);
+\draw[{Latex[length=4mm, round]}-{Latex[length=4mm, round]}] (c2) -- (broker);
+\draw[{Latex[length=4mm, round]}-{Latex[length=4mm, round]}] (c3) to [bend left] (broker);
+\draw[{Latex[length=4mm, round]}-{Latex[length=4mm, round]}] (central) -- (broker);
+
+\end{tikzpicture}
diff --git a/slides/images/qtikz-template.pgs b/slides/images/qtikz-template.pgs
index 6d23d1a..edb322b 100644
--- a/slides/images/qtikz-template.pgs
+++ b/slides/images/qtikz-template.pgs
@@ -6,6 +6,7 @@
\usetikzlibrary{
angles,
arrows,
+ arrows.meta,
backgrounds,
calc,
chains,
@@ -14,6 +15,7 @@
decorations.pathreplacing,
decorations.text,
fit,
+ matrix,
positioning,
quotes,
shapes.arrows,
diff --git a/slides/images/udp-packet.pgf b/slides/images/udp-packet.pgf
new file mode 100644
index 0000000..405f805
--- /dev/null
+++ b/slides/images/udp-packet.pgf
@@ -0,0 +1,32 @@
+\scalebox{0.5}{
+
+\begin{tikzpicture}[
+every node/.style={font=\bfseries}
+]
+
+\path
+(-6.5em, 2em) node[draw, rectangle, minimum width=5em, minimum height=2em] {Offsets}
+(-6.5em, 0em) node[draw, rectangle, minimum width=5em, minimum height=2em] {Octet}
+(-2em, 2em) node[draw, rectangle, minimum width=4em, minimum height=2em] {Octet}
+(-2em, 0em) node[draw, rectangle, minimum width=4em, minimum height=2em] {Bit}
+
+(16em, -2em) node[draw, rectangle, minimum width=32em, minimum height=2em] {source port}
+(48em, -2em) node[draw, rectangle, minimum width=32em, minimum height=2em] {destination port}
+(16em, -4em) node[draw, rectangle, minimum width=32em, minimum height=2em] {length}
+(48em, -4em) node[draw, rectangle, minimum width=32em, minimum height=2em] {checksum}
+;
+
+\foreach \x in {0,...,3}
+ \node[draw, rectangle, minimum width=16em, minimum height=2em] at (\x * 16em + 8em, 2em) {\scriptsize \x};
+\foreach \x in {0,...,31}
+ \node[draw, rectangle, minimum width=2em, minimum height=2em] at (\x * 2em + 1em, 0em) {\scriptsize \x};
+
+\node[draw, rectangle, minimum width=4em, minimum height=2em] at (-2em, -2em) {\scriptsize 0};
+\node[draw, rectangle, minimum width=4em, minimum height=2em] at (-2em, -4em) {\scriptsize 32};
+
+\node[draw, rectangle, minimum width=5em, minimum height=2em] at (-6.5em, -2em) {\scriptsize 0};
+\node[draw, rectangle, minimum width=5em, minimum height=2em] at (-6.5em, -4em) {\scriptsize 4};
+
+\end{tikzpicture}
+
+}
diff --git a/slides/toc.md b/slides/toc.md
index 8c07c8b..76e65a6 100644
--- a/slides/toc.md
+++ b/slides/toc.md
@@ -22,6 +22,7 @@
* Layer 7: Application Layer
* Details: IP
* Details: IP
+ * Details: UDP
* Lecture: ESP8266
* NodeMCU hardware
* NodeMCU hardware
@@ -35,16 +36,21 @@
* ESP Arduino APIs
* Lecture: MQTT
* MQTT
+ * MQTT - Implementations
+ * MQTT Cloud Connectors
* MQTT - The protocol
- * MQTT - The protocol - MQTT Topic
- * MQTT - The protocol - MQTT Topic
* MQTT - The protocol - MQTT Packet
- * MQTT - The protocol - MQTT Topic - more
+ * MQTT - The protocol - Keep alive
+ * MQTT - The protocol - MQTT Topic
* MQTT - The protocol - Retained message
* MQTT - The protocol - Will message
- * MQTT - Patterns
- * MQTT - Implementations
- * MQTT Cloud Connectors
+ * MQTT - The protocol - Client id
+ * Device and application architecture with MQTT
+ * MQTT Topic
* MQTT on Arduino
* MQTT on Arduino
- * Assignment: Network play time
+ * Assignment
+ * MQTT topic architecture
+ * MQTT - Patterns
+ * Assignment
+ * Assignment
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
<tr class="header">
<th style="text-align: left;">Chip</th>
<th style="text-align: left;">CPU</th>
-<th>Freq</th>
+<th style="text-align: left;">Freq</th>
<th style="text-align: left;">RAM</th>
-<th style="text-align: left;">Flash</th>
+<th>Flash</th>
<th style="text-align: left;">Price</th>
</tr>
</thead>
@@ -182,33 +182,33 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
<tr class="odd">
<td style="text-align: left;">nRF52810</td>
<td style="text-align: left;">Cortex-M4</td>
-<td>64 M</td>
-<td style="text-align: left;">Hz 24k</td>
-<td style="text-align: left;">192k</td>
+<td style="text-align: left;">64 MHz</td>
+<td style="text-align: left;">24k</td>
+<td>192k</td>
<td style="text-align: left;">$1.88</td>
</tr>
<tr class="even">
<td style="text-align: left;">nRF52832</td>
-<td style="text-align: left;">Cortex-M4</td>
-<td>F</td>
+<td style="text-align: left;">Cortex-M4F</td>
+<td style="text-align: left;"></td>
<td style="text-align: left;">32k</td>
-<td style="text-align: left;">256k</td>
+<td>256k</td>
<td style="text-align: left;">$2.54</td>
</tr>
<tr class="odd">
<td style="text-align: left;"></td>
<td style="text-align: left;"></td>
-<td></td>
+<td style="text-align: left;"></td>
<td style="text-align: left;">64k</td>
-<td style="text-align: left;">512k</td>
+<td>512k</td>
<td style="text-align: left;">$2.59</td>
</tr>
<tr class="even">
<td style="text-align: left;">nRF52840</td>
-<td style="text-align: left;">Cortex-M4</td>
-<td>F</td>
+<td style="text-align: left;">Cortex-M4F</td>
+<td style="text-align: left;"></td>
<td style="text-align: left;">256k</td>
-<td style="text-align: left;">1024k</td>
+<td>1024k</td>
<td style="text-align: left;">$3.85</td>
</tr>
</tbody>
@@ -451,12 +451,11 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
</ul>
</section><section id="details-ip" class="slide level2">
<h2>Details: IP</h2>
-<aside class="notes">
-<p>Note that the “total length” field is 16 bits, 2 bytes, it’s maximum value is 64k, 65536.</p>
-</aside>
-</section><section id="details-ip-1" class="slide level2">
-<h2>Details: IP</h2>
+</section><section id="details-udp" class="slide level2">
+<h2>Details: UDP</h2>
+
+<p>TODO: add payload to “ip packets”</p>
</section></section>
<section><section id="lecture-esp8266" class="title-slide slide level1"><h1>Lecture: ESP8266</h1></section><section id="nodemcu-hardware" class="slide level2">
<h2>NodeMCU hardware</h2>
@@ -530,8 +529,12 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
<a class="sourceLine" id="cb4-2" data-line-number="2"> <span class="dt">void</span> restart();</a>
<a class="sourceLine" id="cb4-3" data-line-number="3"> <span class="dt">uint32_t</span> getFreeHeap();</a>
<a class="sourceLine" id="cb4-4" data-line-number="4"> <span class="dt">uint32_t</span> getChipId();</a>
-<a class="sourceLine" id="cb4-5" data-line-number="5">} ESP;</a></code></pre></div>
-<p>// Usage ESP.restart();</p>
+<a class="sourceLine" id="cb4-5" data-line-number="5"></a>
+<a class="sourceLine" id="cb4-6" data-line-number="6"> ...</a>
+<a class="sourceLine" id="cb4-7" data-line-number="7">} ESP;</a>
+<a class="sourceLine" id="cb4-8" data-line-number="8"></a>
+<a class="sourceLine" id="cb4-9" data-line-number="9"><span class="co">// Usage</span></a>
+<a class="sourceLine" id="cb4-10" data-line-number="10">ESP.restart();</a></code></pre></div>
</section><section id="esp-arduino-apis-1" class="slide level2">
<h2>ESP Arduino APIs</h2>
<div class="sourceCode" id="cb5"><pre class="sourceCode cpp"><code class="sourceCode cpp"><a class="sourceLine" id="cb5-1" data-line-number="1"><span class="kw">class</span> {</a>
@@ -544,11 +547,13 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
<a class="sourceLine" id="cb5-8" data-line-number="8"> IPAddress subnetMask();</a>
<a class="sourceLine" id="cb5-9" data-line-number="9"> IPAddress gatewayIP();</a>
<a class="sourceLine" id="cb5-10" data-line-number="10"> IPAddress dnsIP(<span class="dt">uint8_t</span> dns_no = <span class="dv">0</span>);</a>
-<a class="sourceLine" id="cb5-11" data-line-number="11">} WiFi;</a>
-<a class="sourceLine" id="cb5-12" data-line-number="12"></a>
-<a class="sourceLine" id="cb5-13" data-line-number="13"><span class="co">// Usage:</span></a>
+<a class="sourceLine" id="cb5-11" data-line-number="11"></a>
+<a class="sourceLine" id="cb5-12" data-line-number="12"> ...</a>
+<a class="sourceLine" id="cb5-13" data-line-number="13">} WiFi;</a>
<a class="sourceLine" id="cb5-14" data-line-number="14"></a>
-<a class="sourceLine" id="cb5-15" data-line-number="15">Serial.println(WiFi.localIP().toString());</a></code></pre></div>
+<a class="sourceLine" id="cb5-15" data-line-number="15"><span class="co">// Usage:</span></a>
+<a class="sourceLine" id="cb5-16" data-line-number="16"></a>
+<a class="sourceLine" id="cb5-17" data-line-number="17">Serial.println(WiFi.localIP().toString());</a></code></pre></div>
<aside class="notes">
<p>http://arduino-esp8266.readthedocs.io/en/latest/libraries.html</p>
</aside>
@@ -565,6 +570,40 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
<p>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.</p>
<p>Version 3.1.1 er den som gjelder, V 3.1 er rar, de andre finnes ikke (før standardisering).</p>
</aside>
+</section><section id="mqtt---implementations" class="slide level2">
+<h2>MQTT - Implementations</h2>
+<ul>
+<li>Mosquitto</li>
+<li>Eclipse Paho</li>
+<li>RabbitMQ</li>
+<li>ActiveMQ</li>
+</ul>
+<aside class="notes">
+<p>RabbitMQ has a separate connector that must be installed Not sure about ActiveMQ but it is at least a part of the project so it is releases at the same time.</p>
+</aside>
+</section><section id="mqtt-cloud-connectors" class="slide level2">
+<h2>MQTT Cloud Connectors</h2>
+<ul>
+<li>Cloud
+<ul>
+<li>Amazon IoT</li>
+<li>Google Cloud IoT</li>
+<li>Microsoft Azure IoT</li>
+<li>CloudMQTT (at Heroku)</li>
+</ul></li>
+<li>DIY
+<ul>
+<li>ThingMQ</li>
+<li>HiveMQ</li>
+</ul></li>
+</ul>
+<aside class="notes">
+<p>In between are:</p>
+<ul>
+<li>self hosted</li>
+<li>Generic bridges</li>
+</ul>
+</aside>
</section><section id="mqtt---the-protocol" class="slide level2">
<h2>MQTT - The protocol</h2>
<p>Agents have one of two roles:</p>
@@ -591,47 +630,7 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
<p>http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/mqtt-v3.1.1.html</p>
<p>Subscriptions are not permanent. The connection is (unlike HTTP) stateful.</p>
<p>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.</p>
-</aside>
-</section><section id="mqtt---the-protocol---mqtt-topic" class="slide level2">
-<h2>MQTT - The protocol - MQTT Topic</h2>
-<ul>
-<li>Topic name: <code>foo/bar/baz</code></li>
-<li>Topic filter
-<ul>
-<li><code>foo/bar/?</code></li>
-<li><code>foo/#</code></li>
-</ul></li>
-</ul>
-</section><section id="mqtt---the-protocol---mqtt-topic-1" class="slide level2">
-<h2>MQTT - The protocol - MQTT Topic</h2>
-<p>The temperature sensor:</p>
-<ul>
-<li>Publishes on:
-<ul>
-<li><code>myapp/$device-id/temperature</code></li>
-<li><code>myapp/$device-id/humidity</code></li>
-<li><code>myapp/$device-id/altert</code></li>
-</ul></li>
-<li>Subscribes to:
-<ul>
-<li><code>myapp/$device-id/command</code></li>
-</ul></li>
-</ul>
-<p>The central application:</p>
-<ul>
-<li>Subscribes to:
-<ul>
-<li><code>myapp/#/temperature</code></li>
-<li><code>myapp/#/humidity</code></li>
-</ul></li>
-<li>Publishes on:
-<ul>
-<li><code>myapp/$device-id/command</code></li>
-</ul></li>
-</ul>
-<aside class="notes">
-<p>Typical first round of implementation.</p>
-<p>Commands can be: * load new firmware (maybe an URL and firmware signature). * Set new calibration values * Change reading interval, altert levels (autonomous operation)</p>
+<p>Push vs pull, central applications can push to clients</p>
</aside>
</section><section id="mqtt---the-protocol---mqtt-packet" class="slide level2">
<h2>MQTT - The protocol - MQTT Packet</h2>
@@ -648,28 +647,19 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
<p>Only packet type + flags (1 byte) is required, everything else is optional.</p>
<p>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.</p>
</aside>
-</section><section id="mqtt---the-protocol---mqtt-topic---more" class="slide level2">
-<h2>MQTT - The protocol - MQTT Topic - more</h2>
-<p>Enten må den holdes rett etter “## MQTT - The protocol - MQTT Topic” ellers kanskje flyttes etter “patterns”.</p>
-<p>The central application is split:</p>
-<ul>
-<li>An aggregating agent:
-<ul>
-<li><code>myapp/#/temperature</code></li>
-<li><code>myapp/#/humidity</code></li>
-</ul></li>
-<li>Emailing agent
+</section><section id="mqtt---the-protocol---keep-alive" class="slide level2">
+<h2>MQTT - The protocol - Keep alive</h2>
+<p>TODO</p>
+</section><section id="mqtt---the-protocol---mqtt-topic" class="slide level2">
+<h2>MQTT - The protocol - MQTT Topic</h2>
<ul>
-<li><code>myapp/$device-id/altert</code></li>
-</ul></li>
-<li>Publishes on:
+<li>Topic name: <code>foo/bar/baz</code></li>
+<li>Topic filter
<ul>
-<li><code>myapp/$device-id/command</code></li>
+<li><code>foo/bar/?</code></li>
+<li><code>foo/#</code></li>
</ul></li>
</ul>
-<aside class="notes">
-
-</aside>
</section><section id="mqtt---the-protocol---retained-message" class="slide level2">
<h2>MQTT - The protocol - Retained message</h2>
<p>Message is kept by the server even after disconnect</p>
@@ -723,50 +713,42 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
<li><code>0</code></li>
</ul></li>
</ol>
-</section><section id="mqtt---patterns" class="slide level2">
-<h2>MQTT - Patterns</h2>
-<p>Må utvides</p>
-<p>Explain:</p>
+</section><section id="mqtt---the-protocol---client-id" class="slide level2">
+<h2>MQTT - The protocol - Client id</h2>
+<p>TODO</p>
+</section><section id="device-and-application-architecture-with-mqtt" class="slide level2">
+<h2>Device and application architecture with MQTT</h2>
+
+</section><section id="mqtt-topic" class="slide level2">
+<h2>MQTT Topic</h2>
+<p>The temperature sensor:</p>
<ul>
-<li>Push vs pull, central applications can push to clients</li>
-<li>mostly mqtt, some http</li>
-<li>Client id - sparker ut gamle koblinger</li>
-<li>Keep alive / ping meldinger</li>
-<li>Alternative transporter - websockets(!)</li>
-</ul>
-</section><section id="mqtt---implementations" class="slide level2">
-<h2>MQTT - Implementations</h2>
+<li>Publishes on:
<ul>
-<li>Mosquitto</li>
-<li>Eclipse Paho</li>
-<li>RabbitMQ</li>
-<li>ActiveMQ</li>
+<li><code>myapp/$device-id/temperature</code></li>
+<li><code>myapp/$device-id/humidity</code></li>
+<li><code>myapp/$device-id/altert</code></li>
+</ul></li>
+<li>Subscribes to:
+<ul>
+<li><code>myapp/$device-id/command</code></li>
+</ul></li>
</ul>
-<aside class="notes">
-<p>RabbitMQ has a separate connector that must be installed Not sure about ActiveMQ but it is at least a part of the project so it is releases at the same time.</p>
-</aside>
-</section><section id="mqtt-cloud-connectors" class="slide level2">
-<h2>MQTT Cloud Connectors</h2>
+<p>The central application:</p>
<ul>
-<li>Cloud
+<li>Subscribes to:
<ul>
-<li>Amazon IoT</li>
-<li>Google Cloud IoT</li>
-<li>Microsoft Azure IoT</li>
-<li>CloudMQTT (at Heroku)</li>
+<li><code>myapp/#/temperature</code></li>
+<li><code>myapp/#/humidity</code></li>
</ul></li>
-<li>DIY
+<li>Publishes on:
<ul>
-<li>ThingMQ</li>
-<li>HiveMQ</li>
+<li><code>myapp/$device-id/command</code></li>
</ul></li>
</ul>
<aside class="notes">
-<p>In between are:</p>
-<ul>
-<li>self hosted</li>
-<li>Generic bridges</li>
-</ul>
+<p>Typical first round of implementation.</p>
+<p>Commands can be: * load new firmware (maybe an URL and firmware signature). * Set new calibration values * Change reading interval, altert levels (autonomous operation)</p>
</aside>
</section><section id="mqtt-on-arduino" class="slide level2">
<h2>MQTT on Arduino</h2>
@@ -801,12 +783,51 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
<aside class="notes">
<p>This is blocking!</p>
</aside>
-</section><section id="assignment-network-play-time" class="slide level2">
-<h2>Assignment: Network play time</h2>
+</section><section id="assignment" class="slide level2">
+<h2>Assignment</h2>
<ul>
-<li><p>Measure round trip time/latency. Measure UDP, TCP. Measure when the packet size is greater than the MTU</p></li>
-<li><p>Notice variations in RTT</p></li>
+<li><code>mqtt</code></li>
</ul>
+</section><section id="mqtt-topic-architecture" class="slide level2">
+<h2>MQTT topic architecture</h2>
+<p>The central application is split:</p>
+<ul>
+<li>An aggregating agent:
+<ul>
+<li><code>myapp/#/temperature</code></li>
+<li><code>myapp/#/humidity</code></li>
+</ul></li>
+<li>Emailing agent
+<ul>
+<li><code>myapp/$device-id/altert</code></li>
+</ul></li>
+<li>Publishes on:
+<ul>
+<li><code>myapp/$device-id/command</code></li>
+</ul></li>
+</ul>
+<aside class="notes">
+
+</aside>
+</section><section id="mqtt---patterns" class="slide level2">
+<h2>MQTT - Patterns</h2>
+<ul>
+<li>Combining MQTT and HTTP</li>
+<li>Using web sockets transport</li>
+</ul>
+</section><section id="assignment-1" class="slide level2">
+<h2>Assignment</h2>
+<ul>
+<li><code>mqtt2</code></li>
+</ul>
+</section><section id="assignment-2" class="slide level2">
+<h2>Assignment</h2>
+<ul>
+<li><code>mqtt3</code></li>
+</ul>
+<aside class="notes">
+<p>discussion: how to connect these two devices?</p>
+</aside>
</section></section>
<section class="footnotes">
<hr />
diff --git a/slides/what-is-iot-slides.pdf b/slides/what-is-iot-slides.pdf
index cb3b978..efee6d1 100644
--- a/slides/what-is-iot-slides.pdf
+++ b/slides/what-is-iot-slides.pdf
Binary files differ
diff --git a/slides/what-is-iot-slides.tex b/slides/what-is-iot-slides.tex
index 68f0c06..1e31381 100644
--- a/slides/what-is-iot-slides.tex
+++ b/slides/what-is-iot-slides.tex
@@ -129,10 +129,10 @@ Sparkfun and Adafruit etc sell modules with all of these technologies.}
Chip & CPU & Freq & RAM & Flash & Price\tabularnewline
\midrule
\endhead
-nRF52810 & Cortex-M4 & 64 M & Hz 24k & 192k & \$1.88\tabularnewline
-nRF52832 & Cortex-M4 & F & 32k & 256k & \$2.54\tabularnewline
+nRF52810 & Cortex-M4 & 64 MHz & 24k & 192k & \$1.88\tabularnewline
+nRF52832 & Cortex-M4F & & 32k & 256k & \$2.54\tabularnewline
& & & 64k & 512k & \$2.59\tabularnewline
-nRF52840 & Cortex-M4 & F & 256k & 1024k & \$3.85\tabularnewline
+nRF52840 & Cortex-M4F & & 256k & 1024k & \$3.85\tabularnewline
\bottomrule
\end{longtable}
@@ -447,21 +447,7 @@ The signaling does not specify any max data rate, very high rates
\begin{frame}{Details: IP}
\protect\hypertarget{details-ip}{}
-\includegraphics{images/ip-header.pdf}
-
-\note{Note that the “total length” field is 16 bits, 2 bytes, it’s
-maximum value is 64k, 65536.}
-
-\end{frame}
-
-\begin{frame}{Details: IP}
-\protect\hypertarget{details-ip-1}{}
-
\begin{center}
-\iffalse
-Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
-\fi
-
\begin{tikzpicture}[scale=0.30]
\sffamily
\foreach \x in {0,7,8,15,16,31} % {0,...,32}
@@ -500,12 +486,57 @@ Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem
\draw[thick, draw=black, fill=white] (16,18) rectangle (32,17); \node (li) at (24,17.5) {\scriptsize header checksum};
\filldraw[thick,draw=black, fill=white] (0,17) rectangle (32,16); \node (mode) at (16,16.5) {\scriptsize source IP address};
\filldraw[thick,draw=black, fill=white] (0,16) rectangle (32,15); \node (mode) at (16,15.5) {\scriptsize destination IP address};
- \draw[thick,draw=black, fill=white] (0,15) rectangle (31.5,14);
- \draw[fill=white, draw=white] (31.4,14.96) rectangle (31.6,14.05);
- \draw[thick] (31.5,14.97) decorate [decoration=saw] { -- (31.5,14.02)};
+ \draw[thick,draw=black, fill=white] (0,15) rectangle (32,14);
+% \draw[thick,draw=black, fill=white] (0,15) rectangle (31.5,14);
+% \draw[fill=white, draw=white] (31.4,15) rectangle (31.6,16);
+% \draw[thick] (31.5,14.97) decorate [decoration=saw] { -- (31.5,14.02)};
\node (mode) at (16,14.5) {\scriptsize IP options (variable length)};
+
+ \filldraw[thick,draw=black, fill=white] (0,12) rectangle (32,14); \node (mode) at (16,13) {\scriptsize payload};
+
+\end{tikzpicture}
+
+\end{center}
+
+\end{frame}
+
+\begin{frame}{Details: UDP}
+\protect\hypertarget{details-udp}{}
+
+\begin{center}
+\scalebox{0.5}{
+
+\begin{tikzpicture}[
+every node/.style={font=\bfseries}
+]
+
+\path
+(-6.5em, 2em) node[draw, rectangle, minimum width=5em, minimum height=2em] {Offsets}
+(-6.5em, 0em) node[draw, rectangle, minimum width=5em, minimum height=2em] {Octet}
+(-2em, 2em) node[draw, rectangle, minimum width=4em, minimum height=2em] {Octet}
+(-2em, 0em) node[draw, rectangle, minimum width=4em, minimum height=2em] {Bit}
+
+(16em, -2em) node[draw, rectangle, minimum width=32em, minimum height=2em] {source port}
+(48em, -2em) node[draw, rectangle, minimum width=32em, minimum height=2em] {destination port}
+(16em, -4em) node[draw, rectangle, minimum width=32em, minimum height=2em] {length}
+(48em, -4em) node[draw, rectangle, minimum width=32em, minimum height=2em] {checksum}
+;
+
+\foreach \x in {0,...,3}
+ \node[draw, rectangle, minimum width=16em, minimum height=2em] at (\x * 16em + 8em, 2em) {\scriptsize \x};
+\foreach \x in {0,...,31}
+ \node[draw, rectangle, minimum width=2em, minimum height=2em] at (\x * 2em + 1em, 0em) {\scriptsize \x};
+
+\node[draw, rectangle, minimum width=4em, minimum height=2em] at (-2em, -2em) {\scriptsize 0};
+\node[draw, rectangle, minimum width=4em, minimum height=2em] at (-2em, -4em) {\scriptsize 32};
+
+\node[draw, rectangle, minimum width=5em, minimum height=2em] at (-6.5em, -2em) {\scriptsize 0};
+\node[draw, rectangle, minimum width=5em, minimum height=2em] at (-6.5em, -4em) {\scriptsize 4};
+
\end{tikzpicture}
+}
+
\end{center}
\end{frame}
@@ -527,13 +558,13 @@ Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem
\begin{tikzpicture}
\path
- (0, 0) node(flash)[draw, rectangle,
+ (0, 0) node(flash)[draw, rectangle,
minimum height=1cm, minimum width=2cm] {Flash}
- (0, 1.5) node(esp8266)[draw, rectangle,
+ (0, 1.5) node(esp8266)[draw, rectangle,
minimum height=1cm, minimum width=2cm] {ESP8266}
- (3.5, 1.5) node(cp201x)[draw, rectangle,
+ (3.5, 1.5) node(cp201x)[draw, rectangle,
minimum height=0.75cm, minimum width=1cm]
{CP201x}
@@ -716,12 +747,15 @@ config.h is created by “new tab”.}
\DataTypeTok{void}\NormalTok{ restart();}
\DataTypeTok{uint32_t}\NormalTok{ getFreeHeap();}
\DataTypeTok{uint32_t}\NormalTok{ getChipId();}
+
+\NormalTok{ ...}
\NormalTok{\} ESP;}
+
+\CommentTok{// Usage}
+\NormalTok{ESP.restart();}
\end{Highlighting}
\end{Shaded}
-// Usage ESP.restart();
-
\end{frame}
\begin{frame}[fragile]{ESP Arduino APIs}
@@ -739,6 +773,8 @@ config.h is created by “new tab”.}
\NormalTok{ IPAddress subnetMask();}
\NormalTok{ IPAddress gatewayIP();}
\NormalTok{ IPAddress dnsIP(}\DataTypeTok{uint8_t}\NormalTok{ dns_no = }\DecValTok{0}\NormalTok{);}
+
+\NormalTok{ ...}
\NormalTok{\} WiFi;}
\CommentTok{// Usage:}
@@ -779,139 +815,123 @@ Version 3.1.1 er den som gjelder, V 3.1 er rar, de andre finnes ikke
\end{frame}
-\begin{frame}{MQTT - The protocol}
-\protect\hypertarget{mqtt---the-protocol}{}
+\begin{frame}{MQTT - Implementations}
+\protect\hypertarget{mqtt---implementations}{}
-Agents have one of two roles:
+\begin{itemize}
+\tightlist
+\item
+ Mosquitto
+\item
+ Eclipse Paho
+\item
+ RabbitMQ
+\item
+ ActiveMQ
+\end{itemize}
+
+\note{RabbitMQ has a separate connector that must be installed Not sure
+about ActiveMQ but it is at least a part of the project so it is
+releases at the same time.}
+
+\end{frame}
+
+\begin{frame}{MQTT Cloud Connectors}
+\protect\hypertarget{mqtt-cloud-connectors}{}
\begin{itemize}
\tightlist
\item
- \emph{Client}
+ Cloud
\begin{itemize}
\tightlist
\item
- Publishes \emph{messages}
+ Amazon IoT
\item
- Subscribes / unsubscribes to \emph{topics}
+ Google Cloud IoT
+ \item
+ Microsoft Azure IoT
+ \item
+ CloudMQTT (at Heroku)
\end{itemize}
\item
- \emph{Broker} (aka Server)
+ DIY
\begin{itemize}
\tightlist
\item
- Handles network connections
- \item
- Keeps subscriptions
- \item
- Manages client
-
- \begin{itemize}
- \tightlist
- \item
- Disconnects
- \item
- \emph{(last) will}
- \end{itemize}
+ ThingMQ
\item
- Persistence of retained messages
+ HiveMQ
\end{itemize}
\end{itemize}
-\note{network connections: this includes removing closed sockets,
-client’s that doesn’t respons to timeouts and duplicate clients.
-
-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.}
-
-\end{frame}
-
-\begin{frame}[fragile]{MQTT - The protocol - MQTT Topic}
-\protect\hypertarget{mqtt---the-protocol---mqtt-topic}{}
+\note{In between are:
\begin{itemize}
\tightlist
\item
- Topic name: \texttt{foo/bar/baz}
+ self hosted
\item
- Topic filter
-
- \begin{itemize}
- \tightlist
- \item
- \texttt{foo/bar/?}
- \item
- \texttt{foo/\#}
- \end{itemize}
-\end{itemize}
+ Generic bridges
+\end{itemize}}
\end{frame}
-\begin{frame}[fragile]{MQTT - The protocol - MQTT Topic}
-\protect\hypertarget{mqtt---the-protocol---mqtt-topic-1}{}
+\begin{frame}{MQTT - The protocol}
+\protect\hypertarget{mqtt---the-protocol}{}
-The temperature sensor:
+Agents have one of two roles:
\begin{itemize}
\tightlist
\item
- Publishes on:
+ \emph{Client}
\begin{itemize}
\tightlist
\item
- \texttt{myapp/\$device-id/temperature}
- \item
- \texttt{myapp/\$device-id/humidity}
+ Publishes \emph{messages}
\item
- \texttt{myapp/\$device-id/altert}
+ Subscribes / unsubscribes to \emph{topics}
\end{itemize}
\item
- Subscribes to:
+ \emph{Broker} (aka Server)
\begin{itemize}
\tightlist
\item
- \texttt{myapp/\$device-id/command}
- \end{itemize}
-\end{itemize}
-
-The central application:
-
-\begin{itemize}
-\tightlist
-\item
- Subscribes to:
-
- \begin{itemize}
- \tightlist
+ Handles network connections
\item
- \texttt{myapp/\#/temperature}
+ Keeps subscriptions
\item
- \texttt{myapp/\#/humidity}
- \end{itemize}
-\item
- Publishes on:
+ Manages client
- \begin{itemize}
- \tightlist
+ \begin{itemize}
+ \tightlist
+ \item
+ Disconnects
+ \item
+ \emph{(last) will}
+ \end{itemize}
\item
- \texttt{myapp/\$device-id/command}
+ Persistence of retained messages
\end{itemize}
\end{itemize}
-\note{Typical first round of implementation.
+\note{network connections: this includes removing closed sockets,
+client’s that doesn’t respons to timeouts and duplicate clients.
-Commands can be: * load new firmware (maybe an URL and firmware
-signature). * Set new calibration values * Change reading interval,
-altert levels (autonomous operation)}
+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.
+
+Push vs pull, central applications can push to clients}
\end{frame}
@@ -944,46 +964,32 @@ The size field is variable length encoded, 0-127 bytes is 1 byte,
\end{frame}
-\begin{frame}[fragile]{MQTT - The protocol - MQTT Topic - more}
-\protect\hypertarget{mqtt---the-protocol---mqtt-topic---more}{}
+\begin{frame}{MQTT - The protocol - Keep alive}
+\protect\hypertarget{mqtt---the-protocol---keep-alive}{}
-Enten må den holdes rett etter “\#\# MQTT - The protocol - MQTT Topic”
-ellers kanskje flyttes etter “patterns”.
+TODO
-The central application is split:
+\end{frame}
+
+\begin{frame}[fragile]{MQTT - The protocol - MQTT Topic}
+\protect\hypertarget{mqtt---the-protocol---mqtt-topic}{}
\begin{itemize}
\tightlist
\item
- An aggregating agent:
-
- \begin{itemize}
- \tightlist
- \item
- \texttt{myapp/\#/temperature}
- \item
- \texttt{myapp/\#/humidity}
- \end{itemize}
+ Topic name: \texttt{foo/bar/baz}
\item
- Emailing agent
+ Topic filter
\begin{itemize}
\tightlist
\item
- \texttt{myapp/\$device-id/altert}
- \end{itemize}
-\item
- Publishes on:
-
- \begin{itemize}
- \tightlist
+ \texttt{foo/bar/?}
\item
- \texttt{myapp/\$device-id/command}
+ \texttt{foo/\#}
\end{itemize}
\end{itemize}
-\note{}
-
\end{frame}
\begin{frame}[fragile]{MQTT - The protocol - Retained message}
@@ -1092,90 +1098,103 @@ Broker
\end{frame}
-\begin{frame}{MQTT - Patterns}
-\protect\hypertarget{mqtt---patterns}{}
+\begin{frame}{MQTT - The protocol - Client id}
+\protect\hypertarget{mqtt---the-protocol---client-id}{}
-Må utvides
+TODO
-Explain:
+\end{frame}
-\begin{itemize}
-\tightlist
-\item
- Push vs pull, central applications can push to clients
-\item
- mostly mqtt, some http
-\item
- Client id - sparker ut gamle koblinger
-\item
- Keep alive / ping meldinger
-\item
- Alternative transporter - websockets(!)
-\end{itemize}
+\begin{frame}{Device and application architecture with MQTT}
+\protect\hypertarget{device-and-application-architecture-with-mqtt}{}
-\end{frame}
+\begin{center}
+\begin{tikzpicture}
-\begin{frame}{MQTT - Implementations}
-\protect\hypertarget{mqtt---implementations}{}
+\path
+ (-3 cm, 0) node (c1_label) {Device \#1}
+ ( 0 cm, 0) node (c2_label) {Device \#2}
+ ( 3 cm, 0) node (c3_label) {Device \#3}
-\begin{itemize}
-\tightlist
-\item
- Mosquitto
-\item
- Eclipse Paho
-\item
- RabbitMQ
-\item
- ActiveMQ
-\end{itemize}
+ (0, -3 cm) node (broker_label) {Broker}
+ (0, -6 cm) node (central_label) {Central}
+;
-\note{RabbitMQ has a separate connector that must be installed Not sure
-about ActiveMQ but it is at least a part of the project so it is
-releases at the same time.}
+\node (c1)[draw, circle, fit=(c1_label)] {};
+\node (c2)[draw, circle, fit=(c2_label)] {};
+\node (c3)[draw, circle, fit=(c3_label)] {};
+\node (central)[draw, circle, fit=(central_label)] {};
+\node (broker)[draw, rectangle, thick, inner ysep=5 mm, inner xsep=10 mm, fit=(broker_label)] {};
+
+\draw[{Latex[length=4mm, round]}-{Latex[length=4mm, round]}] (c1) to [bend right] (broker);
+\draw[{Latex[length=4mm, round]}-{Latex[length=4mm, round]}] (c2) -- (broker);
+\draw[{Latex[length=4mm, round]}-{Latex[length=4mm, round]}] (c3) to [bend left] (broker);
+\draw[{Latex[length=4mm, round]}-{Latex[length=4mm, round]}] (central) -- (broker);
+
+\end{tikzpicture}
+
+\end{center}
\end{frame}
-\begin{frame}{MQTT Cloud Connectors}
-\protect\hypertarget{mqtt-cloud-connectors}{}
+\begin{frame}[fragile]{MQTT Topic}
+\protect\hypertarget{mqtt-topic}{}
+
+The temperature sensor:
\begin{itemize}
\tightlist
\item
- Cloud
+ Publishes on:
\begin{itemize}
\tightlist
\item
- Amazon IoT
- \item
- Google Cloud IoT
+ \texttt{myapp/\$device-id/temperature}
\item
- Microsoft Azure IoT
+ \texttt{myapp/\$device-id/humidity}
\item
- CloudMQTT (at Heroku)
+ \texttt{myapp/\$device-id/altert}
\end{itemize}
\item
- DIY
+ Subscribes to:
\begin{itemize}
\tightlist
\item
- ThingMQ
- \item
- HiveMQ
+ \texttt{myapp/\$device-id/command}
\end{itemize}
\end{itemize}
-\note{In between are:
+The central application:
\begin{itemize}
\tightlist
\item
- self hosted
+ Subscribes to:
+
+ \begin{itemize}
+ \tightlist
+ \item
+ \texttt{myapp/\#/temperature}
+ \item
+ \texttt{myapp/\#/humidity}
+ \end{itemize}
\item
- Generic bridges
-\end{itemize}}
+ Publishes on:
+
+ \begin{itemize}
+ \tightlist
+ \item
+ \texttt{myapp/\$device-id/command}
+ \end{itemize}
+\end{itemize}
+
+\note{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)}
\end{frame}
@@ -1228,15 +1247,89 @@ PubSubClient is our MQTT client implementation.
\end{frame}
-\begin{frame}{Assignment: Network play time}
-\protect\hypertarget{assignment-network-play-time}{}
+\begin{frame}[fragile]{Assignment}
+\protect\hypertarget{assignment}{}
\begin{itemize}
+\tightlist
+\item
+ \texttt{mqtt}
+\end{itemize}
+
+\end{frame}
+
+\begin{frame}[fragile]{MQTT topic architecture}
+\protect\hypertarget{mqtt-topic-architecture}{}
+
+The central application is split:
+
+\begin{itemize}
+\tightlist
\item
- Measure round trip time/latency. Measure UDP, TCP. Measure when the
- packet size is greater than the MTU
+ An aggregating agent:
+
+ \begin{itemize}
+ \tightlist
+ \item
+ \texttt{myapp/\#/temperature}
+ \item
+ \texttt{myapp/\#/humidity}
+ \end{itemize}
\item
- Notice variations in RTT
+ Emailing agent
+
+ \begin{itemize}
+ \tightlist
+ \item
+ \texttt{myapp/\$device-id/altert}
+ \end{itemize}
+\item
+ Publishes on:
+
+ \begin{itemize}
+ \tightlist
+ \item
+ \texttt{myapp/\$device-id/command}
+ \end{itemize}
\end{itemize}
+\note{}
+
+\end{frame}
+
+\begin{frame}{MQTT - Patterns}
+\protect\hypertarget{mqtt---patterns}{}
+
+\begin{itemize}
+\tightlist
+\item
+ Combining MQTT and HTTP
+\item
+ Using web sockets transport
+\end{itemize}
+
+\end{frame}
+
+\begin{frame}[fragile]{Assignment}
+\protect\hypertarget{assignment-1}{}
+
+\begin{itemize}
+\tightlist
+\item
+ \texttt{mqtt2}
+\end{itemize}
+
+\end{frame}
+
+\begin{frame}[fragile]{Assignment}
+\protect\hypertarget{assignment-2}{}
+
+\begin{itemize}
+\tightlist
+\item
+ \texttt{mqtt3}
+\end{itemize}
+
+\note{discussion: how to connect these two devices?}
+
\end{frame}
diff --git a/slides/what-is-iot-text.pdf b/slides/what-is-iot-text.pdf
index 5f9f0e1..2508346 100644
--- a/slides/what-is-iot-text.pdf
+++ b/slides/what-is-iot-text.pdf
Binary files differ
diff --git a/slides/what-is-iot.md b/slides/what-is-iot.md
index c3a74eb..e3c3591 100644
--- a/slides/what-is-iot.md
+++ b/slides/what-is-iot.md
@@ -6,7 +6,7 @@ header-includes:
allbordercolors={0 0 0},
pdfborderstyle={/S/U/W 1}}
- \usepackage{tikz}
- \usetikzlibrary{angles,arrows,backgrounds,calc,chains,decorations,decorations.pathmorphing,decorations.pathreplacing,decorations.text,fit,positioning, quotes,shapes.arrows,shapes.geometric,shapes.symbols}
+ \usetikzlibrary{angles,arrows,arrows.meta,backgrounds,calc,chains,decorations,decorations.pathmorphing,decorations.pathreplacing,decorations.text,fit,matrix,positioning,quotes,shapes.arrows,shapes.geometric,shapes.symbols}
!ifndef(QUICK)
~~~~~~
- \usepackage{fontspec}
@@ -79,12 +79,12 @@ Sparkfun and Adafruit etc sell modules with all of these technologies.
## IoT Devices - Bluetooth 4/5 chips
-Chip CPU Freq RAM Flash Price
--------- -------- ---- -------- ------ ------
-nRF52810 Cortex-M4 64 MHz 24k 192k $1.88
-nRF52832 Cortex-M4F 32k 256k $2.54
- 64k 512k $2.59
-nRF52840 Cortex-M4F 256k 1024k $3.85
+Chip CPU Freq RAM Flash Price
+-------- ---------- ------ ---- ----- ------
+nRF52810 Cortex-M4 64 MHz 24k 192k $1.88
+nRF52832 Cortex-M4F 32k 256k $2.54
+ 64k 512k $2.59
+nRF52840 Cortex-M4F 256k 1024k $3.85
* nRF52810: High performance, entry-level Bluetooth 4/ANT/2.4GHz SoC
* nRF52832: High performance Bluetooth 4/ANT/2.4GHz SoC
@@ -264,6 +264,8 @@ This layer is not really much used in the IP stack
* CoAP
* (everything else..)
+!comment
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
## Details: IP
!ifdef(REVEAL)
@@ -280,19 +282,23 @@ This layer is not really much used in the IP stack
Note that the "total length" field is 16 bits, 2 bytes, it's maximum value is 64k, 65536.
:::
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
## Details: IP
!ifndef(QUICK)(
\begin{center}
-!include(images/IP-Header_eng.tex)
+!include(images/ip-packet.pgf)
\end{center}
)
-!comment
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-![](images/IP-Header_eng.pdf)
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+## Details: UDP
+
+!ifndef(QUICK)(
+\begin{center}
+!include(images/udp-packet.pgf)
+\end{center}
+)
# Lecture: ESP8266
@@ -396,11 +402,13 @@ class {
void restart();
uint32_t getFreeHeap();
uint32_t getChipId();
+
+ ...
} ESP;
-~~~
// Usage
ESP.restart();
+~~~
## ESP Arduino APIs
@@ -415,6 +423,8 @@ class {
IPAddress subnetMask();
IPAddress gatewayIP();
IPAddress dnsIP(uint8_t dns_no = 0);
+
+ ...
} WiFi;
// Usage:
@@ -451,6 +461,41 @@ Version 3.1.1 er den som gjelder, V 3.1 er rar, de andre finnes ikke
:::
+## MQTT - Implementations
+
+* Mosquitto
+* Eclipse Paho
+* RabbitMQ
+* ActiveMQ
+
+::: notes
+
+RabbitMQ has a separate connector that must be installed
+Not sure about ActiveMQ but it is at least a part of the project so it is releases at the same time.
+
+:::
+
+## MQTT Cloud Connectors
+
+* Cloud
+ * Amazon IoT
+ * Google Cloud IoT
+ * Microsoft Azure IoT
+ * CloudMQTT (at Heroku)
+
+* DIY
+ * ThingMQ
+ * HiveMQ
+
+::: notes
+
+In between are:
+
+* self hosted
+* Generic bridges
+
+:::
+
## MQTT - The protocol
Agents have one of two roles:
@@ -479,42 +524,7 @@ 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`
-
-::: 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)
+Push vs pull, central applications can push to clients
:::
@@ -534,24 +544,16 @@ The size field is variable length encoded, 0-127 bytes is 1 byte, 128-16383 use
:::
-## 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
- * `myapp/$device-id/altert`
+## MQTT - The protocol - Keep alive
-* Publishes on:
- * `myapp/$device-id/command`
+TODO
-::: notes
+## MQTT - The protocol - MQTT Topic
-:::
+* Topic name: `foo/bar/baz`
+* Topic filter
+ * `foo/bar/?`
+ * `foo/#`
## MQTT - The protocol - Retained message
@@ -598,50 +600,45 @@ Broker
* `$app/$device/online`
* `0`
-## MQTT - Patterns
-
-Må utvides
-
-Explain:
+## MQTT - The protocol - Client id
-* 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(!)
+TODO
-## MQTT - Implementations
-
-* Mosquitto
-* Eclipse Paho
-* RabbitMQ
-* ActiveMQ
+## Device and application architecture with MQTT
-::: notes
+!ifndef(QUICK)(
+\begin{center}
+!include(images/mqtt-example-architecture.pgf)
+\end{center}
+)
-RabbitMQ has a separate connector that must be installed
-Not sure about ActiveMQ but it is at least a part of the project so it is releases at the same time.
+## MQTT Topic
-:::
+The temperature sensor:
-## MQTT Cloud Connectors
+* Publishes on:
+ * `myapp/$device-id/temperature`
+ * `myapp/$device-id/humidity`
+ * `myapp/$device-id/altert`
+* Subscribes to:
+ * `myapp/$device-id/command`
-* Cloud
- * Amazon IoT
- * Google Cloud IoT
- * Microsoft Azure IoT
- * CloudMQTT (at Heroku)
+The central application:
-* DIY
- * ThingMQ
- * HiveMQ
+* Subscribes to:
+ * `myapp/#/temperature`
+ * `myapp/#/humidity`
+* Publishes on:
+ * `myapp/$device-id/command`
::: notes
-In between are:
+Typical first round of implementation.
-* self hosted
-* Generic bridges
+Commands can be:
+* load new firmware (maybe an URL and firmware signature).
+* Set new calibration values
+* Change reading interval, altert levels (autonomous operation)
:::
@@ -686,9 +683,42 @@ void reconnect() {
This is blocking!
:::
-## Assignment: Network play time
+## Assignment
+
+* `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`
+
+::: notes
+
+:::
+
+## MQTT - Patterns
+
+* Combining MQTT and HTTP
+* Using web sockets transport
+
+## Assignment
+
+* `mqtt2`
-* Measure round trip time/latency. Measure UDP, TCP. Measure when the
- packet size is greater than the MTU
+## Assignment
-* Notice variations in RTT
+* `mqtt3`
+
+::: notes
+
+discussion: how to connect these two devices?
+
+:::