aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-ximages/pp-template18
-rw-r--r--images/qtikz-template.pgs32
-rw-r--r--toc.md16
-rw-r--r--what-is-iot-reveal.html150
-rw-r--r--what-is-iot-slides.pdfbin57390 -> 67939 bytes
-rw-r--r--what-is-iot-slides.tex305
-rw-r--r--what-is-iot-text.pdfbin71346 -> 80980 bytes
-rw-r--r--what-is-iot.md174
8 files changed, 650 insertions, 45 deletions
diff --git a/images/pp-template b/images/pp-template
index 33fa981..8021025 100755
--- a/images/pp-template
+++ b/images/pp-template
@@ -3,7 +3,23 @@ echo '\documentclass[preview]{standalone}
\usepackage{blindtext}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
-\usetikzlibrary{arrows,decorations.pathmorphing,backgrounds,fit,positioning,shapes.symbols,chains,shapes.geometric,shapes.arrows,calc}
+\usetikzlibrary{
+ angles,
+ arrows,
+ backgrounds,
+ calc,
+ chains,
+ decorations,
+ decorations.pathmorphing,
+ decorations.pathreplacing,
+ decorations.text,
+ fit,
+ positioning,
+ quotes,
+ shapes.arrows,
+ shapes.geometric,
+ shapes.symbols,
+}
\usepackage{fontspec}
\setsansfont{Verdana}
diff --git a/images/qtikz-template.pgs b/images/qtikz-template.pgs
index 34582f2..b05f8ef 100644
--- a/images/qtikz-template.pgs
+++ b/images/qtikz-template.pgs
@@ -7,21 +7,23 @@
\usepackage{tikz}
-\usetikzlibrary{arrows,
-decorations,
-decorations.pathmorphing,
-decorations.pathreplacing,
-decorations.text,
-backgrounds,
-fit,
-positioning,
-shapes.symbols,
-chains,
-shapes.geometric,
-shapes.arrows,
-angles,
-quotes,
-calc}
+\usetikzlibrary{
+ angles,
+ arrows,
+ backgrounds,
+ calc,
+ chains,
+ decorations,
+ decorations.pathmorphing,
+ decorations.pathreplacing,
+ decorations.text,
+ fit,
+ positioning,
+ quotes,
+ shapes.arrows,
+ shapes.geometric,
+ shapes.symbols,
+}
\begin{document}
diff --git a/toc.md b/toc.md
index 785be3f..dd6db1d 100644
--- a/toc.md
+++ b/toc.md
@@ -20,9 +20,21 @@
* Details: IP
* Details: IP
* Lecture: ESP8266 aka NodeMCU aka ESP-12
+ * ESP8266 software layers
* Lecture: MQTT
* MQTT
- * MQTT Implementations
+ * 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
+ * MQTT - Patterns
+ * MQTT - Implementations
* MQTT Cloud Connectors
* Notes
- * Assignments
+* Assignments
+ * Assignment 1: Blink a led
+ * Assignment 2: Connect to Wi-Fi
+ * Assignment 3: Connect to MQTT broker
+ * Assignment 4: Network play time
diff --git a/what-is-iot-reveal.html b/what-is-iot-reveal.html
index cf0d641..3a5698e 100644
--- a/what-is-iot-reveal.html
+++ b/what-is-iot-reveal.html
@@ -277,20 +277,149 @@
<p>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. </p>
</section></section>
-<section><section id="lecture-esp8266-aka-nodemcu-aka-esp-12" class="title-slide slide level1"><h1>Lecture: ESP8266 aka NodeMCU aka ESP-12</h1></section></section>
+<section><section id="lecture-esp8266-aka-nodemcu-aka-esp-12" class="title-slide slide level1"><h1>Lecture: ESP8266 aka NodeMCU aka ESP-12</h1></section><section id="esp8266-software-layers" class="slide level2">
+<h2>ESP8266 software layers</h2>
+
+</section></section>
<section><section id="lecture-mqtt" class="title-slide slide level1"><h1>Lecture: MQTT</h1></section><section id="mqtt" class="slide level2">
<h2>MQTT</h2>
<ul>
<li><em>Message Queuing Telemetry Transport</em></li>
<li><a href="https://en.wikipedia.org/wiki/MQTT">Wikipedia: MQTT</a></li>
</ul>
-</section><section id="mqtt-implementations" class="slide level2">
-<h2>MQTT Implementations</h2>
+<aside class="notes">
+<p>MQTT is <em>the</em> standard for IoT applications (and lots of other useful stuff to). Using HTTP is just silly.</p>
+<p>Supports SSL, and requires TCP.</p>
+<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---the-protocol" class="slide level2">
+<h2>MQTT - The protocol</h2>
+<p>Agents have one of two roles:</p>
+<ul>
+<li><em>Client</em>
+<ul>
+<li>Publishes <em>messages</em></li>
+<li>Subscribes / unsubscribes to <em>topics</em></li>
+</ul></li>
+<li><em>Broker</em> (aka Server)
+<ul>
+<li>Handles network connections</li>
+<li>Keeps subscription state</li>
+<li>Manages client
+<ul>
+<li>Disconnects</li>
+<li><em>(last) will</em></li>
+</ul></li>
+<li>Persistence</li>
+</ul></li>
+</ul>
+<aside class="notes">
+<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>
+</aside>
+</section><section id="mqtt---the-protocol---mqtt-packet" class="slide level2">
+<h2>MQTT - The protocol - MQTT Packet</h2>
+<ul>
+<li>Size oriented</li>
+<li>Flags indicate type of remaining bytes
+<ul>
+<li>Packet type</li>
+<li>Topic name</li>
+<li>Payload</li>
+</ul></li>
+</ul>
+<aside class="notes">
+<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
+<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---the-protocol-1" class="slide level2">
+<h2>MQTT - The protocol</h2>
+</section><section id="mqtt---patterns" class="slide level2">
+<h2>MQTT - Patterns</h2>
+<p>Må utvides</p>
+<p>Explain:</p>
+<ul>
+<li>Message sizes with MQTT</li>
+<li>“will” messages</li>
+<li>Push vs pull, central applications can push to clients</li>
+<li>mostly mqtt, some http</li>
+</ul>
+</section><section id="mqtt---implementations" class="slide level2">
+<h2>MQTT - Implementations</h2>
<ul>
<li>Mosquitto</li>
<li>Eclipse Paho</li>
-<li>Redis with MQTT connector</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>
@@ -315,11 +444,18 @@
</ul>
</aside>
</section></section>
-<section><section id="notes" class="title-slide slide level1"><h1>Notes</h1></section><section id="assignments" class="slide level2">
-<h2>Assignments</h2>
+<section><section id="notes" class="title-slide slide level1"><h1>Notes</h1></section></section>
+<section><section id="assignments" class="title-slide slide level1"><h1>Assignments</h1></section><section id="assignment-1-blink-a-led" class="slide level2">
+<h2>Assignment 1: Blink a led</h2>
+</section><section id="assignment-2-connect-to-wi-fi" class="slide level2">
+<h2>Assignment 2: Connect to Wi-Fi</h2>
+</section><section id="assignment-3-connect-to-mqtt-broker" class="slide level2">
+<h2>Assignment 3: Connect to MQTT broker</h2>
+</section><section id="assignment-4-network-play-time" class="slide level2">
+<h2>Assignment 4: Network play time</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>Measure ISR timing</p></li>
+<li><p>Notice variations in RTT</p></li>
</ul>
</section></section>
<section class="footnotes">
diff --git a/what-is-iot-slides.pdf b/what-is-iot-slides.pdf
index 7f99fd3..59b1f24 100644
--- a/what-is-iot-slides.pdf
+++ b/what-is-iot-slides.pdf
Binary files differ
diff --git a/what-is-iot-slides.tex b/what-is-iot-slides.tex
index ea08852..bf541c1 100644
--- a/what-is-iot-slides.tex
+++ b/what-is-iot-slides.tex
@@ -178,6 +178,13 @@ TX\strut
\end{frame}
+\begin{frame}{ESP8266 details - Arduino}
+\protect\hypertarget{esp8266-details---arduino}{}
+
+https://github.com/esp8266/Arduino
+
+\end{frame}
+
\hypertarget{going-back-to-basics}{%
\section{Going back to basics}\label{going-back-to-basics}}
@@ -354,6 +361,15 @@ maximum value is 64k, 65536.}
\end{frame}
+\hypertarget{lecture-esp8266-aka-nodemcu-aka-esp-12}{%
+\section{Lecture: ESP8266 aka NodeMCU aka
+ESP-12}\label{lecture-esp8266-aka-nodemcu-aka-esp-12}}
+
+\begin{frame}{ESP8266 software layers}
+\protect\hypertarget{esp8266-software-layers}{}
+
+\end{frame}
+
\hypertarget{lecture-mqtt}{%
\section{Lecture: MQTT}\label{lecture-mqtt}}
@@ -368,10 +384,253 @@ maximum value is 64k, 65536.}
\href{https://en.wikipedia.org/wiki/MQTT}{Wikipedia: MQTT}
\end{itemize}
+\note{MQTT is \emph{the} standard for IoT applications (and lots of
+other useful stuff to). Using HTTP is just silly.
+
+Supports SSL, and requires TCP.
+
+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).}
+
+\end{frame}
+
+\begin{frame}{MQTT - The protocol}
+\protect\hypertarget{mqtt---the-protocol}{}
+
+Agents have one of two roles:
+
+\begin{itemize}
+\tightlist
+\item
+ \emph{Client}
+
+ \begin{itemize}
+ \tightlist
+ \item
+ Publishes \emph{messages}
+ \item
+ Subscribes / unsubscribes to \emph{topics}
+ \end{itemize}
+\item
+ \emph{Broker} (aka Server)
+
+ \begin{itemize}
+ \tightlist
+ \item
+ Handles network connections
+ \item
+ Keeps subscription state
+ \item
+ Manages client
+
+ \begin{itemize}
+ \tightlist
+ \item
+ Disconnects
+ \item
+ \emph{(last) will}
+ \end{itemize}
+ \item
+ Persistence
+ \end{itemize}
+\end{itemize}
+
+\note{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}{}
+
+\begin{itemize}
+\tightlist
+\item
+ Topic name: \texttt{foo/bar/baz}
+\item
+ Topic filter
+
+ \begin{itemize}
+ \tightlist
+ \item
+ \texttt{foo/bar/?}
+ \item
+ \texttt{foo/\#}
+ \end{itemize}
+\end{itemize}
+
+\end{frame}
+
+\begin{frame}[fragile]{MQTT - The protocol - MQTT Topic}
+\protect\hypertarget{mqtt---the-protocol---mqtt-topic-1}{}
+
+The temperature sensor:
+
+\begin{itemize}
+\tightlist
+\item
+ Publishes on:
+
+ \begin{itemize}
+ \tightlist
+ \item
+ \texttt{myapp/\$device-id/temperature}
+ \item
+ \texttt{myapp/\$device-id/humidity}
+ \item
+ \texttt{myapp/\$device-id/altert}
+ \end{itemize}
+\item
+ Subscribes to:
+
+ \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
+ \item
+ \texttt{myapp/\#/temperature}
+ \item
+ \texttt{myapp/\#/humidity}
+ \end{itemize}
+\item
+ 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}
-\begin{frame}{MQTT Implementations}
-\protect\hypertarget{mqtt-implementations}{}
+\begin{frame}{MQTT - The protocol - MQTT Packet}
+\protect\hypertarget{mqtt---the-protocol---mqtt-packet}{}
+
+\begin{itemize}
+\tightlist
+\item
+ Very small
+\end{itemize}
+
+\begin{itemize}
+\tightlist
+\item
+ Packet type + flags
+\item
+ Packet identifier
+\item
+ Payload
+
+ \begin{itemize}
+ \tightlist
+ \item
+ Size
+ \item
+ Payload
+ \end{itemize}
+\end{itemize}
+
+\note{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.}
+
+\end{frame}
+
+\begin{frame}[fragile]{MQTT - The protocol - MQTT Topic - more}
+\protect\hypertarget{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:
+
+\begin{itemize}
+\tightlist
+\item
+ An aggregating agent:
+
+ \begin{itemize}
+ \tightlist
+ \item
+ \texttt{myapp/\#/temperature}
+ \item
+ \texttt{myapp/\#/humidity}
+ \end{itemize}
+\item
+ 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}{}
+
+Må utvides
+
+Explain:
+
+\begin{itemize}
+\tightlist
+\item
+ Message sizes with MQTT
+\item
+ “will” messages
+\item
+ Push vs pull, central applications can push to clients
+\item
+ mostly mqtt, some http
+\end{itemize}
+
+\end{frame}
+
+\begin{frame}{MQTT - Implementations}
+\protect\hypertarget{mqtt---implementations}{}
\begin{itemize}
\tightlist
@@ -379,8 +638,16 @@ maximum value is 64k, 65536.}
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}
@@ -414,20 +681,48 @@ maximum value is 64k, 65536.}
\end{itemize}
\end{itemize}
+\note{In between are:
+
+\begin{itemize}
+\tightlist
+\item
+ self hosted
+\item
+ Generic bridges
+\end{itemize}}
+
\end{frame}
\hypertarget{notes}{%
\section{Notes}\label{notes}}
-\begin{frame}{Assignments}
-\protect\hypertarget{assignments}{}
+\hypertarget{assignments}{%
+\section{Assignments}\label{assignments}}
+
+\begin{frame}{Assignment 1: Blink a led}
+\protect\hypertarget{assignment-1-blink-a-led}{}
+
+\end{frame}
+
+\begin{frame}{Assignment 2: Connect to Wi-Fi}
+\protect\hypertarget{assignment-2-connect-to-wi-fi}{}
+
+\end{frame}
+
+\begin{frame}{Assignment 3: Connect to MQTT broker}
+\protect\hypertarget{assignment-3-connect-to-mqtt-broker}{}
+
+\end{frame}
+
+\begin{frame}{Assignment 4: Network play time}
+\protect\hypertarget{assignment-4-network-play-time}{}
\begin{itemize}
\item
Measure round trip time/latency. Measure UDP, TCP. Measure when the
packet size is greater than the MTU
\item
- Measure ISR timing
+ Notice variations in RTT
\end{itemize}
\end{frame}
diff --git a/what-is-iot-text.pdf b/what-is-iot-text.pdf
index b3f6aa4..8609058 100644
--- a/what-is-iot-text.pdf
+++ b/what-is-iot-text.pdf
Binary files differ
diff --git a/what-is-iot.md b/what-is-iot.md
index c4a1a63..3b1b570 100644
--- a/what-is-iot.md
+++ b/what-is-iot.md
@@ -6,11 +6,11 @@ header-includes:
allbordercolors={0 0 0},
pdfborderstyle={/S/U/W 1}}
- \usepackage{tikz}
- \usetikzlibrary{arrows,decorations.pathmorphing,backgrounds,fit,positioning,shapes.symbols,chains,shapes.geometric,shapes.arrows,calc}
+ \usetikzlibrary{angles,arrows,backgrounds,calc,chains,decorations,decorations.pathmorphing,decorations.pathreplacing,decorations.text,fit,positioning, quotes,shapes.arrows,shapes.geometric,shapes.symbols}
!ifndef(QUICK)
~~~~~~
- \usepackage{fontspec}
- \setsansfont{Verdana}
+ \setsansfont{Verdana}
~~~~~~
---
@@ -103,15 +103,15 @@ The ESP8266's RAM depends on which firmware stack is used. Physical is probably
+--------------------------+----------------+
| State | Current usage |
+==========================+===============:+
-| Off | 0.5 µA |
+| Off | 0.5 µA |
+--------------------------+----------------+
-| Deep sleep with RTC | 20 µA |
+| Deep sleep with RTC | 20 µA |
+--------------------------+----------------+
| Light sleep (with Wi-Fi) | 1 mA |
+--------------------------+----------------+
| Sleep with peripherials | 15 mA |
+--------------------------+----------------+
-| TX | 170 mA |
+| TX | 170 mA |
+--------------------------+----------------+
::: notes
@@ -241,6 +241,10 @@ Note that the "total length" field is 16 bits, 2 bytes, it's maximum value is 64
# Lecture: ESP8266 aka NodeMCU aka ESP-12
+## ESP8266 software layers
+
+!ifndef(QUICK)(!include(images/esp+arduino-sdks.pgf))
+
# Lecture: MQTT
## MQTT
@@ -248,23 +252,154 @@ Note that the "total length" field is 16 bits, 2 bytes, it's maximum value is 64
* *Message Queuing Telemetry Transport*
* [Wikipedia: MQTT](https://en.wikipedia.org/wiki/MQTT)
-## MQTT Implementations
+::: notes
+
+MQTT is *the* standard for IoT applications (and lots of other useful stuff to). Using HTTP is just silly.
+
+Supports SSL, and requires TCP.
+
+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 - The protocol
+
+Agents have one of two roles:
+
+* *Client*
+ * Publishes *messages*
+ * Subscribes / unsubscribes to *topics*
+
+* *Broker* (aka Server)
+ * Handles network connections
+ * Keeps subscription state
+ * Manages client
+ * Disconnects
+ * *(last) will*
+ * Persistence
+
+::: notes
+
+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`
+
+::: 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 - 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 - 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`
+
+* Publishes on:
+ * `myapp/$device-id/command`
+
+::: notes
+
+:::
+
+## MQTT - Patterns
+
+Må utvides
+
+Explain:
+
+* Message sizes with MQTT
+* "will" messages
+* Push vs pull, central applications can push to clients
+* mostly mqtt, some http
+
+## MQTT - Implementations
* Mosquitto
* Eclipse Paho
-* Redis with MQTT connector
+* 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
+ * Amazon IoT
+ * Google Cloud IoT
+ * Microsoft Azure IoT
+ * CloudMQTT
* DIY
- * ThingMQ
- * HiveMQ
+ * ThingMQ
+ * HiveMQ
::: notes
@@ -275,11 +410,20 @@ In between are:
:::
+
# Notes
-## Assignments
+# Assignments
+
+## Assignment 1: Blink a led
+
+## Assignment 2: Connect to Wi-Fi
+
+## Assignment 3: Connect to MQTT broker
+
+## Assignment 4: Network play time
* Measure round trip time/latency. Measure UDP, TCP. Measure when the
packet size is greater than the MTU
-* Measure ISR timing
+* Notice variations in RTT