diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2018-06-12 08:57:35 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2018-06-12 08:57:35 +0200 |
commit | ff7ff9a9a939d377bb9bf150e83099eab0f1e588 (patch) | |
tree | c16768ca9d58b3b15e247a444183dd2beede778b /slides | |
parent | 7c8b10601be8e89374d36599679c7d5aab6d692b (diff) | |
download | iot-workshop-ndc-2018-ff7ff9a9a939d377bb9bf150e83099eab0f1e588.tar.gz iot-workshop-ndc-2018-ff7ff9a9a939d377bb9bf150e83099eab0f1e588.tar.bz2 iot-workshop-ndc-2018-ff7ff9a9a939d377bb9bf150e83099eab0f1e588.tar.xz iot-workshop-ndc-2018-ff7ff9a9a939d377bb9bf150e83099eab0f1e588.zip |
wip
Diffstat (limited to 'slides')
-rw-r--r-- | slides/Makefile | 39 | ||||
-rw-r--r-- | slides/connected-arduino-slides.pdf (renamed from slides/what-is-iot-slides.pdf) | bin | 313148 -> 293025 bytes | |||
-rw-r--r-- | slides/connected-arduino-text.pdf | bin | 0 -> 64793 bytes | |||
-rw-r--r-- | slides/connected-arduino.md (renamed from slides/what-is-iot.md) | 184 | ||||
-rw-r--r-- | slides/templates/beamer.tex | 439 | ||||
-rw-r--r-- | slides/toc.md | 18 | ||||
-rw-r--r-- | slides/what-is-iot-slides.tex | 1424 | ||||
-rw-r--r-- | slides/what-is-iot-text.pdf | bin | 314159 -> 0 bytes |
8 files changed, 476 insertions, 1628 deletions
diff --git a/slides/Makefile b/slides/Makefile index 727031c..4f2b761 100644 --- a/slides/Makefile +++ b/slides/Makefile @@ -1,9 +1,12 @@ -P=what-is-iot +P=connected-arduino # Madrid Pittsburgh boxes SLIDE_THEME?=boxes PDFS=$(P)-text.pdf $(P)-slides.pdf HTMLS=$(P)-reveal.html +BUILD_DIR=build +TEMPLATE_DIR=templates +TEMPLATE_BEAMER=$(TEMPLATE_DIR)/beamer.tex ifeq (1,$(QUICK)) PP_DEFS+=QUICK PDF_ENGINE = xelatex @@ -17,11 +20,11 @@ endif RUN_PP_BEAMER=pp -DBEAMER $(patsubst %,-D%,$(PP_DEFS)) RUN_PP_REVEALJS=pp -DREVEALJS $(patsubst %,-D%,$(PP_DEFS)) RUN_PANDOC_BEAMER=pandoc -f markdown -t beamer $(PANDOC_ARGS) -V theme:$(SLIDE_THEME) \ - --pdf-engine=$(PDF_ENGINE) + --pdf-engine=$(PDF_ENGINE) --template=$(TEMPLATE_BEAMER) -V toc-depth:4 RUN_PANDOC_REVEALJS=pandoc -f markdown -t revealjs -s -V revealjs-url=./bower_components/reveal.js RUN_PANDOC_TEXT=pandoc -f markdown --pdf-engine=$(PDF_ENGINE) -all: toc.md $(PDFS) $(HTMLS) +all: toc.md $(PDFS) slides: $(P)-slides.tex $(P)-slides.pdf html: $(P)-reveal.html @@ -42,28 +45,28 @@ spell: .$(P).md.spell $(P).md: Makefile @touch $@ -include $(P).beamer.md.d -include $(P).revealjs.md.d +$(BUILD_DIR): + mkdir -p $(BUILD_DIR) -%.beamer.md: %.md .var/QUICK +%.beamer.md: %.md $(RUN_PP_BEAMER) < $< > $@ -%.beamer.md.d: %.md +$(BUILD_DIR)/%.beamer.md.d: %.md | $(BUILD_DIR) $(RUN_PP_BEAMER) -M $< < $< > $@ %-text.pdf: %.beamer.md $(RUN_PANDOC_TEXT) -o $@ $< -%-slides.pdf: %.beamer.md .var/SLIDE_THEME +%-slides.pdf: %.beamer.md $(TEMPLATE_BEAMER) $(RUN_PANDOC_BEAMER) -o $@ $< -%-slides.tex: %.beamer.md .var/SLIDE_THEME +%-slides.tex: %.beamer.md $(TEMPLATE_BEAMER) $(RUN_PANDOC_BEAMER) -o $@ $< -%.revealjs.md: %.md# %.revealjs.md.d +%.revealjs.md: %.md# $(BUILD_DIR)/%.revealjs.md.d $(RUN_PP_REVEALJS) < $< > $@ -%.revealjs.md.d: %.md +$(BUILD_DIR)/%.revealjs.md.d: %.md | $(BUILD_DIR) $(RUN_PP_REVEALJS) -M $< < $< > $@ %-reveal.html: %.revealjs.md @@ -74,13 +77,11 @@ images/%.pdf: images/%.tex | images/pp-template Makefile xelatex -output-directory=images $(patsubst %.tex,%-full.tex,$<) mv $(patsubst %.pdf,%-full.pdf,$@) $@ +$(TEMPLATE_BEAMER): $(dir $(TEMPLATE_BEAMER)) + pandoc --print-default-template=beamer > $@ -VARS=SLIDE_THEME QUICK +$(dir $(TEMPLATE_BEAMER)): + mkdir -p $@ -define refresh = -.var/$(1):: - @mkdir -p .var - @./refresh $$@ $(1) $($(1)) -endef - -$(foreach var,$(VARS),$(eval $(call refresh,$(var)))) +-include $(BUILD_DIR)/$(P).beamer.md.d +-include $(BUILD_DIR)/$(P).revealjs.md.d diff --git a/slides/what-is-iot-slides.pdf b/slides/connected-arduino-slides.pdf Binary files differindex a62a47c..83e8750 100644 --- a/slides/what-is-iot-slides.pdf +++ b/slides/connected-arduino-slides.pdf diff --git a/slides/connected-arduino-text.pdf b/slides/connected-arduino-text.pdf Binary files differnew file mode 100644 index 0000000..e5088b9 --- /dev/null +++ b/slides/connected-arduino-text.pdf diff --git a/slides/what-is-iot.md b/slides/connected-arduino.md index 01e6477..6a6b5e7 100644 --- a/slides/what-is-iot.md +++ b/slides/connected-arduino.md @@ -7,6 +7,7 @@ header-includes: pdfborderstyle={/S/U/W 1}} - \usepackage{tikz} \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} @@ -196,7 +197,7 @@ What differentiates a computer from an IoT device? * Wi-Fi * NB-IoT * LTE Cat-M - * LoRA + * LoRa * Proprietary radio ::: notes @@ -215,80 +216,27 @@ 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 - -* nRF52810: High performance, entry-level Bluetooth 4/ANT/2.4GHz SoC -* nRF52832: High performance Bluetooth 4/ANT/2.4GHz SoC -* nRF52840: Advanced multi-protocol System-on-Chip Supporting: Bluetooth 5, ANT/ANT+, 802.15.4 and 2.4GHz proprietary - -::: notes - -All quantities are 1000 pieces - -nRF51: https://www.digikey.no/products/en/rf-if-and-rfid/rf-transceiver-ics/879?k=nrf51822 - -nRF52832: these have different packagings, not only difference price - -https://www.digikey.no/products/en/rf-if-and-rfid/rf-transceiver-ics/879?FV=1c0001%2Cffe0036f&quantity=3000&ColumnSort=1000011&page=1&k=nrf52832&pageSize=500&pkeyword=nrf52810 - -nRF52810: High performance, entry-level Bluetooth 4/ANT/2.4GHz SoC -nRF52832: High performance Bluetooth 4/ANT/2.4GHz SoC -nRF52840: Advanced multi-protocol System-on-Chip Supporting: Bluetooth 5, ANT/ANT+, 802.15.4 and 2.4GHz proprietary - -::: - -## IoT Devices - LoRA - -### Modules +## IoT Devices - Example chips -Module Data Rate Price ------ --------- ------ -RN2483A-I/RM104 $12.05 @ 250 -CMWX1ZZABZ-078 SX1276 $10.74 @ 1000 -RF-LORA-868-SO SX1272 $16.55 @ 1000 +Protocol Chip Specs +------------- ---- ----- +Bluetooth 4/5 nRF52x 32-64 MHz, Cortex-M0/M4F, + 24-256k RAM, 192-1024 k Flash, + $1.88-$3.85 +WiFi ESP8266/ESP32 80MHz-160MHz, 1-2 cores, + ~80k RAM, < $1 - $4.53 +LoRa Semtech $3.23 - $4.74 -### Chips - -Chip Price ----- ------- -SX1281 $3.23 -SX1272 $4.25 -SX1276 $4.25 -SX1279 $4.74 ::: notes -These modules require an external MCU, so does the chips. - -::: - -## IoT Devices - NB-IoT +BT and Wi-Fi has many, many more chips. Technologies based on +open/accessible standards. LoRa is much more closed and driven by a +single company. -Module Price ------- ----- -uBlox SARA-N210 ~$10 @ 100 -Sierra Wireless HL7800_1103933 $15.72 - -## IoT Devices - Wi-Fi - -Chip CPU Freq ROM RAM Price ------ ------- ------- ----- ------ ------ -ESP8266 Tensilica L106 160 MHz N/A ~50 kB < $1 - -ESP32 - dual cpu, Wi-Fi, Bluetooth 4 -ESP32-D0WDQ6 2x Xtensa @ 160MHz $ 4.53 @ 10 - -::: notes - -The ESP8266's RAM depends on which firmware stack is used. Physical is probably 128k or most likely 64k. +4.53 is quantity=10 +LoRa chips are just trancievers, an MCU with LoRa stack is required. ::: ## ESP8266 details - Power usage @@ -313,106 +261,6 @@ Datasheet page 18 ::: -# Going back to basics - -## What is the internet again? - -## TCP/IP Layers - -!ifndef(QUICK)( -\begin{center} -!include(images/tcpip.pgf) -\end{center} -) - -## Packet encapsulation - -!ifndef(QUICK)( -\begin{center} -!include(images/ip-encapsulation.pgf) -\end{center} -) - -## Network interface - -* Ethernet - * 10BASE5, 10BASE2, 10BASE-T / 100BASE-TX / 1000BASE-TX -* Wi-Fi - * 802.11a/b/g/n -* RS-232 - -::: notes - -Ethernet: Hubs and switches (that act on this level) is not on it's own -layer. It is more of a implementation detail in the architecture diagram. - -RS-232 signaling is used in *all* MCUs, many have several ports -available. It is extremely flexible, both used for implementing -applications and debugging. Frequently an easy way to hack embedded -devices. "USB dongles", "USB TTL" all use RS-232 signaling. - -Note that this only applies to its logical signals, not voltage -levels. The signaling does not specify any max data rate, very high rates -(>= 1Mbps) is often supported. - -::: - -## Internet - -* IP -* ICMP - -## Transport - -* TCP -* UDP -* SCTP -* QUIC - -## Layer 7: Application Layer - -* HTTP -* DNS -* MQTT -* CoAP -* (everything else..) - -!comment -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -## Details: IP - -!ifdef(REVEAL) -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -![](images/ip-header.svg) -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!ifdef(BEAMER) -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!ifndef(QUICK)(![](images/ip-header.pdf)) -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -::: notes - -Note that the "total length" field is 16 bits, 2 bytes, it's maximum value is 64k, 65536. - -::: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -## Details: IP Header - -!ifndef(QUICK)( -\begin{center} -!include(images/ip-header.pgf) -\end{center} -) - -## Details: UDP Header - -!ifndef(QUICK)( -\begin{center} -!include(images/udp-header.pgf) -\end{center} -) - # Lecture: MQTT ## MQTT diff --git a/slides/templates/beamer.tex b/slides/templates/beamer.tex new file mode 100644 index 0000000..08e21c1 --- /dev/null +++ b/slides/templates/beamer.tex @@ -0,0 +1,439 @@ +\PassOptionsToPackage{unicode=true}{hyperref} % options for packages loaded elsewhere +\PassOptionsToPackage{hyphens}{url} +$if(colorlinks)$ +\PassOptionsToPackage{dvipsnames,svgnames*,x11names*}{xcolor} +$endif$$if(dir)$$if(latex-dir-rtl)$ +\PassOptionsToPackage{RTLdocument}{bidi} +$endif$$endif$% +\documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$babel-lang$,$endif$$if(papersize)$$papersize$paper,$endif$$if(beamer)$ignorenonframetext,$if(handout)$handout,$endif$$if(aspectratio)$aspectratio=$aspectratio$,$endif$$endif$$for(classoption)$$classoption$$sep$,$endfor$]{$documentclass$} +$if(beamer)$ +\setbeamertemplate{caption}[numbered] +\setbeamertemplate{caption label separator}{: } +\setbeamercolor{caption name}{fg=normal text.fg} +\beamertemplatenavigationsymbols$if(navigation)$$navigation$$else$empty$endif$ +$endif$ +$if(beamerarticle)$ +\usepackage{beamerarticle} % needs to be loaded first +$endif$ +$if(fontfamily)$ +\usepackage[$for(fontfamilyoptions)$$fontfamilyoptions$$sep$,$endfor$]{$fontfamily$} +$else$ +\usepackage{lmodern} +$endif$ +$if(linestretch)$ +\usepackage{setspace} +\setstretch{$linestretch$} +$endif$ +\usepackage{amssymb,amsmath} +\usepackage{ifxetex,ifluatex} +\usepackage{fixltx2e} % provides \textsubscript +\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex + \usepackage[$if(fontenc)$$fontenc$$else$T1$endif$]{fontenc} + \usepackage[utf8]{inputenc} + \usepackage{textcomp} % provides euro and other symbols +\else % if luatex or xelatex +$if(mathspec)$ + \ifxetex + \usepackage{mathspec} + \else + \usepackage{unicode-math} + \fi +$else$ + \usepackage{unicode-math} +$endif$ + \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase} +$for(fontfamilies)$ + \newfontfamily{$fontfamilies.name$}[$fontfamilies.options$]{$fontfamilies.font$} +$endfor$ +$if(mainfont)$ + \setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$} +$endif$ +$if(sansfont)$ + \setsansfont[$for(sansfontoptions)$$sansfontoptions$$sep$,$endfor$]{$sansfont$} +$endif$ +$if(monofont)$ + \setmonofont[Mapping=tex-ansi$if(monofontoptions)$,$for(monofontoptions)$$monofontoptions$$sep$,$endfor$$endif$]{$monofont$} +$endif$ +$if(mathfont)$ +$if(mathspec)$ + \ifxetex + \setmathfont(Digits,Latin,Greek)[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$} + \else + \setmathfont[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$} + \fi +$else$ + \setmathfont[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$} +$endif$ +$endif$ +$if(CJKmainfont)$ + \ifxetex + \usepackage{xeCJK} + \setCJKmainfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$} + \fi +$endif$ +$if(luatexjapresetoptions)$ + \ifluatex + \usepackage[$for(luatexjapresetoptions)$$luatexjapresetoptions$$sep$,$endfor$]{luatexja-preset} + \fi +$endif$ +$if(CJKmainfont)$ + \ifluatex + \usepackage[$for(luatexjafontspecoptions)$$luatexjafontspecoptions$$sep$,$endfor$]{luatexja-fontspec} + \setmainjfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$} + \fi +$endif$ +\fi +$if(beamer)$ +$if(theme)$ +\usetheme[$for(themeoptions)$$themeoptions$$sep$,$endfor$]{$theme$} +$endif$ +$if(colortheme)$ +\usecolortheme{$colortheme$} +$endif$ +$if(fonttheme)$ +\usefonttheme{$fonttheme$} +$endif$ +$if(mainfont)$ +\usefonttheme{serif} % use mainfont rather than sansfont for slide text +$endif$ +$if(innertheme)$ +\useinnertheme{$innertheme$} +$endif$ +$if(outertheme)$ +\useoutertheme{$outertheme$} +$endif$ +$endif$ +% use upquote if available, for straight quotes in verbatim environments +\IfFileExists{upquote.sty}{\usepackage{upquote}}{} +% use microtype if available +\IfFileExists{microtype.sty}{% +\usepackage[$for(microtypeoptions)$$microtypeoptions$$sep$,$endfor$]{microtype} +\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts +}{} +$if(indent)$ +$else$ +\IfFileExists{parskip.sty}{% +\usepackage{parskip} +}{% else +\setlength{\parindent}{0pt} +\setlength{\parskip}{6pt plus 2pt minus 1pt} +} +$endif$ +$if(verbatim-in-note)$ +\usepackage{fancyvrb} +$endif$ +$if(colorlinks)$ +\usepackage{xcolor} +$endif$ +\usepackage{hyperref} +\hypersetup{ +$if(title-meta)$ + pdftitle={$title-meta$}, +$endif$ +$if(author-meta)$ + pdfauthor={$author-meta$}, +$endif$ +$if(keywords)$ + pdfkeywords={$for(keywords)$$keywords$$sep$, $endfor$}, +$endif$ +$if(colorlinks)$ + colorlinks=true, + linkcolor=$if(linkcolor)$$linkcolor$$else$Maroon$endif$, + citecolor=$if(citecolor)$$citecolor$$else$Blue$endif$, + urlcolor=$if(urlcolor)$$urlcolor$$else$Blue$endif$, +$else$ + pdfborder={0 0 0}, +$endif$ + breaklinks=true} + +\urlstyle{same} % don't use monospace font for urls +$if(verbatim-in-note)$ +\VerbatimFootnotes % allows verbatim text in footnotes +$endif$ +$if(geometry)$ +\usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry} +$endif$ +$if(beamer)$ +\newif\ifbibliography +$endif$ +$if(listings)$ +\usepackage{listings} +\newcommand{\passthrough}[1]{#1} +$endif$ +$if(lhs)$ +\lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{} +$endif$ +$if(highlighting-macros)$ +$highlighting-macros$ +$endif$ +$if(tables)$ +\usepackage{longtable,booktabs} +$if(beamer)$ +\usepackage{caption} +% These lines are needed to make table captions work with longtable: +\makeatletter +\def\fnum@table{\tablename~\thetable} +\makeatother +$else$ +% Fix footnotes in tables (requires footnote package) +\IfFileExists{footnote.sty}{\usepackage{footnote}\makesavenoteenv{longtable}}{} +$endif$ +$endif$ +$if(graphics)$ +\usepackage{graphicx,grffile} +\makeatletter +\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi} +\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi} +\makeatother +% Scale images if necessary, so that they will not overflow the page +% margins by default, and it is still possible to overwrite the defaults +% using explicit options in \includegraphics[width, height, ...]{} +\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio} +$endif$ +$if(beamer)$ +% Prevent slide breaks in the middle of a paragraph: +\widowpenalties 1 10000 +\raggedbottom +$if(section-titles)$ +\setbeamertemplate{part page}{ +\centering +\begin{beamercolorbox}[sep=16pt,center]{part title} + \usebeamerfont{part title}\insertpart\par +\end{beamercolorbox} +} +\setbeamertemplate{section page}{ +\centering +\begin{beamercolorbox}[sep=12pt,center]{part title} + \usebeamerfont{section title}\insertsection\par +\end{beamercolorbox} +} +\setbeamertemplate{subsection page}{ +\centering +\begin{beamercolorbox}[sep=8pt,center]{part title} + \usebeamerfont{subsection title}\insertsubsection\par +\end{beamercolorbox} +} +\AtBeginPart{ + \frame{\partpage} +} +\AtBeginSection{ + \ifbibliography + \else + \frame{\sectionpage} + \fi +} +\AtBeginSubsection{ + \frame{\subsectionpage} +} +$endif$ +$endif$ +$if(links-as-notes)$ +% Make links footnotes instead of hotlinks: +\DeclareRobustCommand{\href}[2]{#2\footnote{\url{#1}}} +$endif$ +$if(strikeout)$ +\usepackage[normalem]{ulem} +% avoid problems with \sout in headers with hyperref: +\pdfstringdefDisableCommands{\renewcommand{\sout}{}} +$endif$ +\setlength{\emergencystretch}{3em} % prevent overfull lines +\providecommand{\tightlist}{% + \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} +$if(numbersections)$ +\setcounter{secnumdepth}{$if(secnumdepth)$$secnumdepth$$else$5$endif$} +$else$ +\setcounter{secnumdepth}{0} +$endif$ +$if(beamer)$ +$else$ +$if(subparagraph)$ +$else$ +% Redefines (sub)paragraphs to behave more like sections +\ifx\paragraph\undefined\else +\let\oldparagraph\paragraph +\renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}} +\fi +\ifx\subparagraph\undefined\else +\let\oldsubparagraph\subparagraph +\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}} +\fi +$endif$ +$endif$ +$if(pagestyle)$ +\pagestyle{$pagestyle$} +$endif$ + +% set default figure placement to htbp +\makeatletter +\def\fps@figure{htbp} +\makeatother + +$for(header-includes)$ +$header-includes$ +$endfor$ +$if(lang)$ +\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex + \usepackage[shorthands=off,$for(babel-otherlangs)$$babel-otherlangs$,$endfor$main=$babel-lang$]{babel} +$if(babel-newcommands)$ + $babel-newcommands$ +$endif$ +\else + % load polyglossia as late as possible as it *could* call bidi if RTL lang (e.g. Hebrew or Arabic) + \usepackage{polyglossia} + \setmainlanguage[$polyglossia-lang.options$]{$polyglossia-lang.name$} +$for(polyglossia-otherlangs)$ + \setotherlanguage[$polyglossia-otherlangs.options$]{$polyglossia-otherlangs.name$} +$endfor$ +\fi +$endif$ +$if(dir)$ +\ifxetex + % load bidi as late as possible as it modifies e.g. graphicx + \usepackage{bidi} +\fi +\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex + \TeXXeTstate=1 + \newcommand{\RL}[1]{\beginR #1\endR} + \newcommand{\LR}[1]{\beginL #1\endL} + \newenvironment{RTL}{\beginR}{\endR} + \newenvironment{LTR}{\beginL}{\endL} +\fi +$endif$ +$if(natbib)$ +\usepackage[$natbiboptions$]{natbib} +\bibliographystyle{$if(biblio-style)$$biblio-style$$else$plainnat$endif$} +$endif$ +$if(biblatex)$ +\usepackage[$if(biblio-style)$style=$biblio-style$,$endif$$for(biblatexoptions)$$biblatexoptions$$sep$,$endfor$]{biblatex} +$for(bibliography)$ +\addbibresource{$bibliography$} +$endfor$ +$endif$ + +$if(title)$ +\title{$title$$if(thanks)$\thanks{$thanks$}$endif$} +$endif$ +$if(subtitle)$ +\providecommand{\subtitle}[1]{} +\subtitle{$subtitle$} +$endif$ +$if(author)$ +\author{$for(author)$$author$$sep$ \and $endfor$} +$endif$ +$if(institute)$ +\providecommand{\institute}[1]{} +\institute{$for(institute)$$institute$$sep$ \and $endfor$} +$endif$ +\date{$date$} +$if(beamer)$ +$if(titlegraphic)$ +\titlegraphic{\includegraphics{$titlegraphic$}} +$endif$ +$if(logo)$ +\logo{\includegraphics{$logo$}} +$endif$ +$endif$ + +\iffalse +\makeatletter +% save the current definition of \beamer@@frametitle +\let\nobookmarkbeamer@@frametitle\beamer@@frametitle +% then patch it to do the bookmarks and/or TOC entries +\apptocmd{\beamer@@frametitle}{% + % keep this to add the frame title to the TOC at the "subsection level" + \addtocontents{toc}{\protect\beamer@subsectionintoc{\the\c@section}{0}{#1}{\the\c@page}{\the\c@part}% + {\the\beamer@tocsectionnumber}}% + % keep this line to add a bookmark that shows up in the PDF TOC at the subsection level + \bookmark[page=\the\c@page,level=3]{#1}% + }% + {\message{** patching of \string\beamer@@frametitle succeeded **}}% + {\errmessage{** patching of \string\beamer@@frametitle failed **}}% + +\pretocmd{\beamer@checknoslide}{% + % ensure the bookmark is not created if the slide is filtered out + \let\beamer@@frametitle\nobookmarkbeamer@@frametitle + }% + {\message{** patching of \string\beamer@checknoslide succeeded **}}% + {\errmessage{** patching of \string\beamer@checknoslide failed **}}% + +\makeatother +\fi + +\begin{document} +$if(title)$ +$if(beamer)$ +\frame{\titlepage} +$else$ +\maketitle +$endif$ +$if(abstract)$ +\begin{abstract} +$abstract$ +\end{abstract} +$endif$ +$endif$ + +$for(include-before)$ +$include-before$ + +$endfor$ +$if(toc)$ +$if(beamer)$ +\begin{frame} +%\tableofcontents[hideallsubsections] +\tableofcontents[currentsection,subsubsectionstyle=hide] +\end{frame} +$else$ +{ +$if(colorlinks)$ +\hypersetup{linkcolor=$if(toccolor)$$toccolor$$else$$endif$} +$endif$ +\setcounter{tocdepth}{$toc-depth$} +\tableofcontents +} +$endif$ +$endif$ +$if(lot)$ +\listoftables +$endif$ +$if(lof)$ +\listoffigures +$endif$ +$body$ + +$if(natbib)$ +$if(bibliography)$ +$if(biblio-title)$ +$if(book-class)$ +\renewcommand\bibname{$biblio-title$} +$else$ +\renewcommand\refname{$biblio-title$} +$endif$ +$endif$ +$if(beamer)$ +\begin{frame}[allowframebreaks]{$biblio-title$} +\bibliographytrue +$endif$ +\bibliography{$for(bibliography)$$bibliography$$sep$,$endfor$} +$if(beamer)$ +\end{frame} +$endif$ + +$endif$ +$endif$ +$if(biblatex)$ +$if(beamer)$ +\begin{frame}[allowframebreaks]{$biblio-title$} +\bibliographytrue +\printbibliography[heading=none] +\end{frame} +$else$ +\printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$ +$endif$ + +$endif$ +$for(include-after)$ +$include-after$ + +$endfor$ +\end{document} diff --git a/slides/toc.md b/slides/toc.md index cdc431e..6e54e03 100644 --- a/slides/toc.md +++ b/slides/toc.md @@ -14,24 +14,8 @@ * IoT is just a concept * What is an IoT Device? * What is an IoT Device? - * IoT Devices - Bluetooth 4/5 chips - * IoT Devices - LoRA -### Modules -### Chips - * IoT Devices - NB-IoT - * IoT Devices - Wi-Fi + * IoT Devices - Example chips * ESP8266 details - Power usage -* Going back to basics - * What is the internet again? - * TCP/IP Layers - * Packet encapsulation - * Network interface - * Internet - * Transport - * Layer 7: Application Layer - * Details: IP - * Details: IP Header - * Details: UDP Header * Lecture: MQTT * MQTT * Device and application architecture with MQTT diff --git a/slides/what-is-iot-slides.tex b/slides/what-is-iot-slides.tex deleted file mode 100644 index 1b65fc0..0000000 --- a/slides/what-is-iot-slides.tex +++ /dev/null @@ -1,1424 +0,0 @@ -\hypertarget{nodemcu}{% -\section{NodeMCU}\label{nodemcu}} - -\begin{frame}{NodeMCU hardware} -\protect\hypertarget{nodemcu-hardware}{} - -\includegraphics{images/NodeMCU-–-Board-de-desarrollo-con-módulo-ESP8266-WiFi-y-Lua-4.jpg} - -\end{frame} - -\begin{frame}{NodeMCU hardware} -\protect\hypertarget{nodemcu-hardware-1}{} - -\begin{center} -\begin{tikzpicture} - -\path - (0, 0) node(flash)[draw, rectangle, - minimum height=1cm, minimum width=2cm] {Flash} - - (0, 1.5) node(esp8266)[draw, rectangle, - minimum height=1cm, minimum width=2cm] {ESP8266} - - (3.5, 1.5) node(cp201x)[draw, rectangle, - minimum height=0.75cm, minimum width=1cm] - {CP201x} - - (5.5, 1.5) node(usb)[] - {USB} -; - -\draw[-] (esp8266) -- node[node font=\footnotesize, right]{QSPI} (flash); -\draw[-] (esp8266) -- node[node font=\footnotesize, above]{UART} (cp201x) -- (usb); - -\node[rectangle, draw, fit=(esp8266) (flash), inner sep=2 mm, - label={[name=esp12_label,anchor=south]ESP-12}] - (esp12){}; - -\node[rectangle, draw, thick, fit=(esp12_label) (esp12) (cp201x), inner sep=3 mm, - label={[anchor=north]south:NodeMCU}] - (nodemcu){}; - -\end{tikzpicture} - -\end{center} - -\end{frame} - -\begin{frame}{ESP8266 software layers} -\protect\hypertarget{esp8266-software-layers}{} - -\begin{center} -\begin{tikzpicture} - -\node (rect_hw) [rectangle, draw, anchor=south west, - minimum width=6 cm, minimum height=1 cm, - label={[anchor=south]center:ESP8266 Hardware}] at (0, 0) {}; - -\draw[thick] (-0.5, 1.25) -- (6.5, 1.25) ; - -\node [rectangle, draw, anchor=south west, - minimum width=4 cm, minimum height=1 cm, - label={[anchor=south]center:ESP SDK}] at (0, 1.5) {}; - -\node [rectangle, draw, anchor=south west, - minimum width=2 cm, minimum height=1 cm, - label={[align=center, text width=1cm]center:GCC libc}] at (4, 1.5) {}; - -\node [rectangle, draw, anchor=south west, - minimum width=6 cm, minimum height=1 cm, - label={[anchor=south]center:ESP interface}] at (0, 2.5) {}; - -\node [rectangle, draw, anchor=south west, - minimum width=2 cm, minimum height=1 cm, - label={[align=center, text width= 2cm]center:Generic Arduino}] at (0, 3.5) {}; - -\node [rectangle, draw, anchor=south west, - minimum width=2 cm, minimum height=1 cm, - label={[align=center, text width= 2cm]center:Ethernet}] at (2, 3.5) {}; - -\node [rectangle, draw, anchor=south west, - minimum width=2 cm, minimum height=1 cm, - label={[align=center, text width= 2cm]center:ESP APIs}] at (4, 3.5) {}; - -\draw [decorate, decoration={brace,amplitude=5pt, raise=-4pt}] (-0.5,2.5) -- (-0.5,4.5) node [black,midway,rotate=90, above] {Arduino}; - - -\end{tikzpicture} - -\end{center} - -\end{frame} - -\begin{frame}{ESP8266 + Arduino} -\protect\hypertarget{esp8266-arduino}{} - -\begin{itemize} -\tightlist -\item - Standard Arduino IDE -\item - ESP8266 Arduino core - - \begin{itemize} - \tightlist - \item - https://github.com/esp8266/Arduino - \end{itemize} -\end{itemize} - -\end{frame} - -\begin{frame}{Arduino IDE} -\protect\hypertarget{arduino-ide}{} - -\includegraphics{images/arduino-ide.png} - -\end{frame} - -\begin{frame}[fragile]{Arduino code structure} -\protect\hypertarget{arduino-code-structure}{} - -\begin{Shaded} -\begin{Highlighting}[] -\DataTypeTok{void}\NormalTok{ setup() \{} - \CommentTok{// Called once} -\NormalTok{\}} - -\DataTypeTok{void}\NormalTok{ loop() \{} - \CommentTok{// Called repeatedly} -\NormalTok{\}} -\end{Highlighting} -\end{Shaded} - -\note{MCU programming is often structured into: - -\begin{itemize} -\tightlist -\item - Configure - - \begin{itemize} - \tightlist - \item - CPU - \item - GPIO ports - \item - MCU’s peripherals - \item - The rest of the board - \item - Configure application and callbacks. - \end{itemize} -\item - Sleep -\end{itemize} - -Arduino chooses to run the cpu at 100\% instead of the sleep step..} - -\end{frame} - -\begin{frame}[fragile]{Arduino file structure} -\protect\hypertarget{arduino-file-structure}{} - -\begin{verbatim} -foo/ - foo.ino - config.h -\end{verbatim} - -\note{\texttt{foo.ino} must always be in a \texttt{foo} directory. - -config.h is created by “new tab”.} - -\end{frame} - -\begin{frame}[fragile]{Generic Arduino APIs} -\protect\hypertarget{generic-arduino-apis}{} - -\begin{Shaded} -\begin{Highlighting}[] -\CommentTok{// Pin: D0, D1, etc.} -\CommentTok{// Mode: OUTPUT, INPUT, INPUT_PULLUP} -\DataTypeTok{void}\NormalTok{ pinMode(}\DataTypeTok{uint8_t}\NormalTok{ pin, }\DataTypeTok{uint8_t}\NormalTok{ mode);} - -\CommentTok{// State: HIGH, LOW, true/false, 1/0} -\DataTypeTok{void}\NormalTok{ digitalWrite(}\DataTypeTok{uint8_t}\NormalTok{ pin, }\DataTypeTok{uint8_t}\NormalTok{ state);} -\DataTypeTok{int}\NormalTok{ digitalRead(}\DataTypeTok{uint8_t}\NormalTok{ pin);} - -\DataTypeTok{unsigned} \DataTypeTok{long}\NormalTok{ now millis();} -\DataTypeTok{unsigned} \DataTypeTok{long}\NormalTok{ now micros();} -\end{Highlighting} -\end{Shaded} - -\end{frame} - -\begin{frame}[fragile]{ESP Arduino APIs} -\protect\hypertarget{esp-arduino-apis}{} - -\begin{Shaded} -\begin{Highlighting}[] -\KeywordTok{class}\NormalTok{ \{} - \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} - -\end{frame} - -\begin{frame}[fragile]{ESP Arduino APIs} -\protect\hypertarget{esp-arduino-apis-1}{} - -\begin{Shaded} -\begin{Highlighting}[] -\KeywordTok{class}\NormalTok{ \{} -\NormalTok{ String macAddress();} - - \DataTypeTok{wl_status_t}\NormalTok{ status();} - \DataTypeTok{int32_t}\NormalTok{ RSSI();} - -\NormalTok{ IPAddress localIP();} -\NormalTok{ IPAddress subnetMask();} -\NormalTok{ IPAddress gatewayIP();} -\NormalTok{ IPAddress dnsIP(}\DataTypeTok{uint8_t}\NormalTok{ dns_no = }\DecValTok{0}\NormalTok{);} - -\NormalTok{ ...} -\NormalTok{\} WiFi;} - -\CommentTok{// Usage:} - -\NormalTok{Serial.println(WiFi.localIP().toString());} -\end{Highlighting} -\end{Shaded} - -\note{http://arduino-esp8266.readthedocs.io/en/latest/libraries.html} - -\end{frame} - -\hypertarget{what-is-iot}{% -\section{What is IoT}\label{what-is-iot}} - -\begin{frame}{What is IoT} -\protect\hypertarget{what-is-iot-1}{} - -\begin{itemize} -\tightlist -\item - Not “a computer connected to the internet” - - \begin{itemize} - \tightlist - \item - Then it is really just another computer connected to the internet - \end{itemize} -\item - Must be something else - - \begin{itemize} - \tightlist - \item - It is simply devices that are resource constrained - - \begin{itemize} - \tightlist - \item - Usually in more than one way - \end{itemize} - \end{itemize} -\item - Autonomous operation, the connection might not be permanent -\end{itemize} - -\end{frame} - -\begin{frame}{IoT is just a concept} -\protect\hypertarget{iot-is-just-a-concept}{} - -\begin{itemize} -\tightlist -\item - \emph{The Internet of Things (IoT) is the network of physical devices, - vehicles, home appliances and other items embedded with electronics, - software, sensors, actuators, and connectivity which enables these - objects to connect and exchange data.}\footnote<.->{Wikipedia - “Internet of Things”} -\end{itemize} - -\end{frame} - -\begin{frame}{What is an IoT Device?} -\protect\hypertarget{what-is-an-iot-device}{} - -\note{As for their definition. - -What differentiates a computer from an IoT device?} - -\end{frame} - -\begin{frame}{What is an IoT Device?} -\protect\hypertarget{what-is-an-iot-device-1}{} - -\begin{itemize} -\tightlist -\item - Constrained in (one or more of): - - \begin{itemize} - \tightlist - \item - Memory - \item - CPU - \item - Network bandwidth and/or latency - \item - Storage - \end{itemize} -\item - Has connectivity - - \begin{itemize} - \tightlist - \item - Bluetooth - \item - Wi-Fi - \item - NB-IoT - \item - LTE Cat-M - \item - LoRA - \item - Proprietary radio - \end{itemize} -\end{itemize} - -\note{Might not have: - -\begin{itemize} -\tightlist -\item - RTC -\end{itemize} - -Extra features: - -\begin{itemize} -\tightlist -\item - IR -\item - UART -\item - CAN -\end{itemize} - -Sparkfun and Adafruit etc sell modules with all of these technologies.} - -\end{frame} - -\begin{frame}{IoT Devices - Bluetooth 4/5 chips} -\protect\hypertarget{iot-devices---bluetooth-45-chips}{} - -\begin{longtable}[]{@{}llllll@{}} -\toprule -Chip & CPU & Freq & RAM & Flash & Price\tabularnewline -\midrule -\endhead -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-M4F & & 256k & 1024k & \$3.85\tabularnewline -\bottomrule -\end{longtable} - -\begin{itemize} -\tightlist -\item - nRF52810: High performance, entry-level Bluetooth 4/ANT/2.4GHz SoC -\item - nRF52832: High performance Bluetooth 4/ANT/2.4GHz SoC -\item - nRF52840: Advanced multi-protocol System-on-Chip Supporting: Bluetooth - 5, ANT/ANT+, 802.15.4 and 2.4GHz proprietary -\end{itemize} - -\note{All quantities are 1000 pieces - -nRF51: -https://www.digikey.no/products/en/rf-if-and-rfid/rf-transceiver-ics/879?k=nrf51822 - -nRF52832: these have different packagings, not only difference price - -https://www.digikey.no/products/en/rf-if-and-rfid/rf-transceiver-ics/879?FV=1c0001\%2Cffe0036f\&quantity=3000\&ColumnSort=1000011\&page=1\&k=nrf52832\&pageSize=500\&pkeyword=nrf52810 - -nRF52810: High performance, entry-level Bluetooth 4/ANT/2.4GHz SoC -nRF52832: High performance Bluetooth 4/ANT/2.4GHz SoC nRF52840: Advanced -multi-protocol System-on-Chip Supporting: Bluetooth 5, ANT/ANT+, -802.15.4 and 2.4GHz proprietary} - -\end{frame} - -\begin{frame}{IoT Devices - LoRA} -\protect\hypertarget{iot-devices---lora}{} - -\begin{block}{Modules} - -\begin{longtable}[]{@{}lll@{}} -\toprule -Module & Data Rate & Price\tabularnewline -\midrule -\endhead -RN2483A-I/RM104 & & \$12.05 @ 250\tabularnewline -CMWX1ZZABZ-078 & SX1276 & \$10.74 @ 1000\tabularnewline -RF-LORA-868-SO & SX1272 & \$16.55 @ 1000\tabularnewline -\bottomrule -\end{longtable} - -\end{block} - -\begin{block}{Chips} - -\begin{longtable}[]{@{}ll@{}} -\toprule -Chip & Price\tabularnewline -\midrule -\endhead -SX1281 & \$3.23\tabularnewline -SX1272 & \$4.25\tabularnewline -SX1276 & \$4.25\tabularnewline -SX1279 & \$4.74\tabularnewline -\bottomrule -\end{longtable} - -\note{These modules require an external MCU, so does the chips.} - -\end{block} - -\end{frame} - -\begin{frame}{IoT Devices - NB-IoT} -\protect\hypertarget{iot-devices---nb-iot}{} - -\begin{longtable}[]{@{}ll@{}} -\toprule -Module & Price\tabularnewline -\midrule -\endhead -uBlox SARA-N210 & \textasciitilde{}\$10 @ 100\tabularnewline -Sierra Wireless HL7800\_1103933 & \$15.72\tabularnewline -\bottomrule -\end{longtable} - -\end{frame} - -\begin{frame}{IoT Devices - Wi-Fi} -\protect\hypertarget{iot-devices---wi-fi}{} - -\begin{longtable}[]{@{}llllll@{}} -\toprule -Chip & CPU & Freq & ROM & RAM & Price\tabularnewline -\midrule -\endhead -ESP8266 & Tensilica L106 & 160 MHz & N/A & \textasciitilde{}50 kB & -\textless{} \$1\tabularnewline -\bottomrule -\end{longtable} - -ESP32 - dual cpu, Wi-Fi, Bluetooth 4 ESP32-D0WDQ6 2x Xtensa @ 160MHz \$ -4.53 @ 10 - -\note{The ESP8266’s RAM depends on which firmware stack is used. -Physical is probably 128k or most likely 64k.} - -\end{frame} - -\begin{frame}{ESP8266 details - Power usage} -\protect\hypertarget{esp8266-details---power-usage}{} - -\begin{longtable}[]{@{}lr@{}} -\toprule -\begin{minipage}[b]{0.35\columnwidth}\raggedright -State\strut -\end{minipage} & \begin{minipage}[b]{0.22\columnwidth}\raggedleft -Current usage\strut -\end{minipage}\tabularnewline -\midrule -\endhead -\begin{minipage}[t]{0.35\columnwidth}\raggedright -Off\strut -\end{minipage} & \begin{minipage}[t]{0.22\columnwidth}\raggedleft -0.5 µA\strut -\end{minipage}\tabularnewline -\begin{minipage}[t]{0.35\columnwidth}\raggedright -Deep sleep with RTC\strut -\end{minipage} & \begin{minipage}[t]{0.22\columnwidth}\raggedleft -20 µA\strut -\end{minipage}\tabularnewline -\begin{minipage}[t]{0.35\columnwidth}\raggedright -Light sleep (with Wi-Fi)\strut -\end{minipage} & \begin{minipage}[t]{0.22\columnwidth}\raggedleft -1 mA\strut -\end{minipage}\tabularnewline -\begin{minipage}[t]{0.35\columnwidth}\raggedright -Sleep with peripherials\strut -\end{minipage} & \begin{minipage}[t]{0.22\columnwidth}\raggedleft -15 mA\strut -\end{minipage}\tabularnewline -\begin{minipage}[t]{0.35\columnwidth}\raggedright -TX\strut -\end{minipage} & \begin{minipage}[t]{0.22\columnwidth}\raggedleft -170 mA\strut -\end{minipage}\tabularnewline -\bottomrule -\end{longtable} - -\note{Datasheet page 18} - -\end{frame} - -\hypertarget{going-back-to-basics}{% -\section{Going back to basics}\label{going-back-to-basics}} - -\begin{frame}{What is the internet again?} -\protect\hypertarget{what-is-the-internet-again}{} - -\end{frame} - -\begin{frame}{TCP/IP Layers} -\protect\hypertarget{tcpip-layers}{} - -\begin{center} -\begin{tikzpicture}[ -mybox/.style={draw, rectangle, minimum width=4cm, minimum height=1 cm,font=\bfseries} -] - -%\draw (0,0) rectangle (3cm, 1cm) {wat}; - -\node at (0, -0) [mybox] {Application}; -\node at (0, -1) [mybox] {Transport}; -\node at (0, -2) [mybox] {Internet}; -\node at (0, -3)[mybox] {Network interface}; - -\end{tikzpicture} - -\end{center} - -\end{frame} - -\begin{frame}{Packet encapsulation} -\protect\hypertarget{packet-encapsulation}{} - -\begin{center} -\begin{tikzpicture}[ -mybox/.style={ - draw, - rectangle, - minimum height=1 cm, - anchor=west, - align=center, - font=\bfseries} -] - -%\draw (0,0) rectangle (3cm, 1cm) {wat}; - -\node at (0 cm, 0 cm) [mybox, minimum width=2cm, text width=1.7cm] {Frame header}; -\node at (2 cm, 0 cm) [mybox, minimum width=6cm] {Frame data}; -\node at (8 cm, 0 cm) [mybox, minimum width=2cm, text width=1.7cm] {Frame footer}; - -\node at (2 cm, 1.1 cm) [mybox, minimum width=2cm] {IP header}; -\node at (4 cm, 1.1 cm) [mybox, minimum width=4cm] {IP Data}; - -\node at (4 cm, 2.2 cm) [mybox, minimum width=2cm, text width=1.7 cm] {UDP header}; -\node at (6 cm, 2.2 cm) [mybox, minimum width=2cm, text width=1.7 cm] {UDP Data}; - -\node at (6 cm, 3.3 cm) [mybox, minimum width=2cm, text width=1.7 cm] {Data}; - -\end{tikzpicture} - -\end{center} - -\end{frame} - -\begin{frame}{Network interface} -\protect\hypertarget{network-interface}{} - -\begin{itemize} -\tightlist -\item - Ethernet - - \begin{itemize} - \tightlist - \item - 10BASE5, 10BASE2, 10BASE-T / 100BASE-TX / 1000BASE-TX - \end{itemize} -\item - Wi-Fi - - \begin{itemize} - \tightlist - \item - 802.11a/b/g/n - \end{itemize} -\item - RS-232 -\end{itemize} - -\note{Ethernet: Hubs and switches (that act on this level) is not on -it’s own layer. It is more of a implementation detail in the -architecture diagram. - -RS-232 signaling is used in \emph{all} MCUs, many have several ports -available. It is extremely flexible, both used for implementing -applications and debugging. Frequently an easy way to hack embedded -devices. “USB dongles”, “USB TTL” all use RS-232 signaling. - -Note that this only applies to its logical signals, not voltage levels. -The signaling does not specify any max data rate, very high rates -(\textgreater{}= 1Mbps) is often supported.} - -\end{frame} - -\begin{frame}{Internet} -\protect\hypertarget{internet}{} - -\begin{itemize} -\tightlist -\item - IP -\item - ICMP -\end{itemize} - -\end{frame} - -\begin{frame}{Transport} -\protect\hypertarget{transport}{} - -\begin{itemize} -\tightlist -\item - TCP -\item - UDP -\item - SCTP -\item - QUIC -\end{itemize} - -\end{frame} - -\begin{frame}{Layer 7: Application Layer} -\protect\hypertarget{layer-7-application-layer}{} - -\begin{itemize} -\tightlist -\item - HTTP -\item - DNS -\item - MQTT -\item - CoAP -\item - (everything else..) -\end{itemize} - -\end{frame} - -\begin{frame}{Details: IP Header} -\protect\hypertarget{details-ip-header}{} - -\begin{center} -\scalebox{0.5}{ -\begin{tikzpicture}[ -every node/.style={font=\bfseries}, -basebox/.style={anchor=north west, minimum height=2em, draw, rectangle}, -bitbox/.style={basebox, minimum width=2em}, -bytebox/.style={basebox, minimum width=16em}, -wordbox/.style={basebox, minimum width=32em}, -qwordbox/.style={basebox, minimum width=64em}, -] - -\path -(-9em, 2em) node[basebox, minimum width=5em] {Offsets} -(-9em, 0em) node[basebox, minimum width=5em] {Octet} -(-4em, 2em) node[basebox, minimum width=4em] {Octet} -(-4em, 0em) node[basebox, minimum width=4em] {Bit} -; - -\foreach \x in {0,...,3} - \node[bytebox] at (\x * 16em, 2em) {\scriptsize \x}; -\foreach \x in {0,...,31} - \node[bitbox] at (\x * 2em, 0em) {\scriptsize \x}; - -\foreach \x in {0,32,...,160} - \node[basebox, minimum width=4em] at (-4em, \x * -1/16*1em - 2em) {\scriptsize \x}; - -\foreach \x in {0,4,...,20} - \node[basebox, minimum width=5em] at (-9em, \x * -0.5em - 2em) {\scriptsize \x}; - -\path -(0em, -1 * 2em) node[basebox, minimum width=8em] {Version} -(8em, -1 * 2em) node[basebox, minimum width=8em] {IHL} -(16em, -1 * 2em) node[basebox, minimum width=16em] {TOS} -(32em, -1 * 2em) node[wordbox] {Packet length} - -(0em, -2 * 2em) node[wordbox] {Identification} -(32em, -2 * 2em) node[bitbox] {X} -(34em, -2 * 2em) node[bitbox] {D} -(36em, -2 * 2em) node[bitbox] {M} -(38em, -2 * 2em) node[basebox, minimum width=26em] {Fragement offset} - -(0em, -3 * 2em) node[bytebox] {TTL} -(16em, -3 * 2em) node[bytebox] {Protocol} -(32em, -3 * 2em) node[wordbox] {Header checksum} - -(0em, -4 * 2em) node[qwordbox] {Source ip address} -(0em, -5 * 2em) node[qwordbox] {Destination ip address} -(0em, -6 * 2em) node[qwordbox] {Options (variable length)} - -%(0em, -7 * 2em) node[qwordbox, minimum height=4 em] {Payload} -; - -\end{tikzpicture} -} - -\end{center} - -\end{frame} - -\begin{frame}{Details: UDP Header} -\protect\hypertarget{details-udp-header}{} - -\begin{center} -\scalebox{0.5}{ -\begin{tikzpicture}[ -every node/.style={font=\bfseries}, -basebox/.style={anchor=west, minimum height=2em, draw, rectangle}, -bitbox/.style={basebox, minimum width=2em}, -bytebox/.style={basebox, minimum width=16em}, -wordbox/.style={basebox, minimum width=32em}, -qwordbox/.style={basebox, minimum width=64em}, -] - -\path -(-9em, 2em) node[basebox, minimum width=5em] {Offsets} -(-9em, 0em) node[basebox, minimum width=5em] {Octet} -(-4em, 2em) node[basebox, minimum width=4em] {Octet} -(-4em, 0em) node[basebox, minimum width=4em] {Bit} -; - -\foreach \x in {0,...,3} - \node[bytebox] at (\x * 16em, 2em) {\scriptsize \x}; -\foreach \x in {0,...,31} - \node[bitbox] at (\x * 2em, 0em) {\scriptsize \x}; - -\node[basebox, minimum width=4em] at (-4em, -2em) {\scriptsize 0}; -\node[basebox, minimum width=4em] at (-4em, -4em) {\scriptsize 32}; - -\node[basebox, minimum width=5em] at (-9em, -2em) {\scriptsize 0}; -\node[basebox, minimum width=5em] at (-9em, -4em) {\scriptsize 4}; - -\path -( 0 * 2em, -1 * 2em) node[wordbox] {source port} -(16 * 2em, -1 * 2em) node[wordbox] {destination port} -( 0 * 2em, -2 * 2em) node[wordbox] {length} -(16 * 2em, -2 * 2em) node[wordbox] {checksum} -; - -\end{tikzpicture} -} - -\end{center} - -\end{frame} - -\hypertarget{lecture-mqtt}{% -\section{Lecture: MQTT}\label{lecture-mqtt}} - -\begin{frame}{MQTT} -\protect\hypertarget{mqtt}{} - -\begin{itemize} -\tightlist -\item - \emph{Message Queuing Telemetry Transport} -\item - \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}{Device and application architecture with MQTT} -\protect\hypertarget{device-and-application-architecture-with-mqtt}{} - -\begin{center} -\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 (broker)[draw, rectangle, thick, inner ysep=5 mm, inner xsep=10 mm, fit=(broker_label)] {}; -\node (central) at (central_label) [draw, circle, text width=2 cm] {}; - -\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 - Implementations} -\protect\hypertarget{mqtt---implementations}{} - -\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 - Cloud - - \begin{itemize} - \tightlist - \item - Amazon IoT - \item - Google Cloud IoT - \item - Microsoft Azure IoT - \item - CloudMQTT (at Heroku) - \end{itemize} -\item - DIY - - \begin{itemize} - \tightlist - \item - ThingMQ - \item - HiveMQ - \end{itemize} -\end{itemize} - -\note{In between are: - -\begin{itemize} -\tightlist -\item - self hosted -\item - Generic bridges -\end{itemize}} - -\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 subscriptions - \item - Manages client - - \begin{itemize} - \tightlist - \item - Disconnects - \item - \emph{(last) will} - \end{itemize} - \item - Persistence of retained messages - \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. - -Push vs pull, central applications can push to clients} - -\end{frame} - -\begin{frame}{MQTT - The protocol - MQTT Packet} -\protect\hypertarget{mqtt---the-protocol---mqtt-packet}{} - -\begin{itemize} -\tightlist -\item - Size oriented -\item - Flags indicate type of remaining bytes - - \begin{itemize} - \tightlist - \item - Packet type - \item - Topic name - \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 Connect} -\protect\hypertarget{mqtt-connect}{} - -\begin{itemize} -\tightlist -\item - \texttt{CONNECT} - - \begin{itemize} - \tightlist - \item - \texttt{clientId} - \item - \texttt{username} - \item - \texttt{password} - \item - \texttt{keepAlive} - \end{itemize} -\end{itemize} - -\begin{itemize} -\tightlist -\item - Keep alive - - \begin{itemize} - \tightlist - \item - \texttt{PINGREQ} - \item - \texttt{PINGRESP} - \end{itemize} -\end{itemize} - -\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 - Retained message} -\protect\hypertarget{mqtt---the-protocol---retained-message}{} - -Message is kept by the server even after disconnect - -\begin{itemize} -\tightlist -\item - \texttt{CONNECT} -\item - \texttt{PUBLISH} - - \begin{itemize} - \tightlist - \item - \texttt{RETAIN} - \item - \texttt{\$app/\$device/temperature} - \item - \texttt{22.3} - \end{itemize} -\item - \texttt{DISCONNECT} -\end{itemize} - -Later on: - -\begin{itemize} -\tightlist -\item - \texttt{SUBSCRIBE} - - \begin{itemize} - \tightlist - \item - \texttt{\$app/\#/temperature} - \end{itemize} -\item - \texttt{PUBLISH} - - \begin{itemize} - \tightlist - \item - \texttt{\$app/\$device/temperature} - \item - \texttt{22.3} - \end{itemize} -\end{itemize} - -\note{The last PUBLISH is an incoming message} - -\end{frame} - -\begin{frame}[fragile]{MQTT - The protocol - Will message} -\protect\hypertarget{mqtt---the-protocol---will-message}{} - -Message sent when you disconnect - -Client \#1: - -\begin{enumerate} -[1.] -\tightlist -\item - \texttt{CONNECT} - - \begin{itemize} - \tightlist - \item - \texttt{WILL\ TOPIC:\ \$app/\$device/online} - \item - \texttt{WILL\ PAYLOAD:\ 0} - \end{itemize} -\item - \texttt{PUBLISH} - - \begin{itemize} - \tightlist - \item - \texttt{\$app/\$device/online} - \item - \texttt{1} - \end{itemize} -\item - \texttt{DISCONNECT} -\end{enumerate} - -Broker - -\begin{enumerate} -[1.] -\tightlist -\item - \emph{To all subscribers} \texttt{PUBLISH} - - \begin{itemize} - \tightlist - \item - \texttt{\$app/\$device/online} - \item - \texttt{0} - \end{itemize} -\end{enumerate} - -\end{frame} - -\begin{frame}[fragile]{MQTT Topic} -\protect\hypertarget{mqtt-topic}{} - -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}[fragile]{MQTT on Arduino} -\protect\hypertarget{mqtt-on-arduino}{} - -PubSubClient is our MQTT client implementation. - -\begin{Shaded} -\begin{Highlighting}[] -\NormalTok{WiFiClient wifiClient;} -\NormalTok{PubSubClient mqtt(wifiClient);} - -\DataTypeTok{void}\NormalTok{ callback(}\DataTypeTok{char}\NormalTok{* topic,} -\NormalTok{ byte* payload,} - \DataTypeTok{unsigned} \DataTypeTok{int}\NormalTok{ length);} - -\DataTypeTok{void}\NormalTok{ setup() \{} - \CommentTok{// Configure WiFi} -\NormalTok{ mqtt.setServer(mqtt_server, }\DecValTok{1883}\NormalTok{);} -\NormalTok{ mqtt.setCallback(callback);} -\NormalTok{\}} -\end{Highlighting} -\end{Shaded} - -\end{frame} - -\begin{frame}[fragile]{MQTT on Arduino} -\protect\hypertarget{mqtt-on-arduino-1}{} - -\begin{Shaded} -\begin{Highlighting}[] -\DataTypeTok{void}\NormalTok{ loop() \{} - \ControlFlowTok{if}\NormalTok{ (!mqtt.connected())} -\NormalTok{ reconnect();} - \ControlFlowTok{else} -\NormalTok{ mqtt.loop();} - \CommentTok{// Do work} -\NormalTok{\}} - -\DataTypeTok{void}\NormalTok{ reconnect() \{} - \ControlFlowTok{while}\NormalTok{ (!mqtt.}\FunctionTok{connect}\NormalTok{(client_id));} - -\NormalTok{ mqtt.subscribe(topic_pattern);} -\NormalTok{\}} -\end{Highlighting} -\end{Shaded} - -\note{This is blocking!} - -\end{frame} - -\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 - 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} - -\end{frame} - -\begin{frame}{MQTT topic architecture} -\protect\hypertarget{mqtt-topic-architecture-1}{} - -\begin{center} -\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 (broker)[draw, rectangle, thick, inner ysep=5 mm, inner xsep=10 mm, fit=(broker_label)] {}; -\node (central) at (central_label) [draw, circle, text width=2 cm] {}; - -\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 topic architecture} -\protect\hypertarget{mqtt-topic-architecture-2}{} - -\begin{center} -\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} - - (-2 cm, -6 cm) node (agg_label) {Aggregator} - ( 2 cm, -6 cm) node (email_label) {Email} -; - -\node (c1)[draw, circle, fit=(c1_label)] {}; -\node (c2)[draw, circle, fit=(c2_label)] {}; -\node (c3)[draw, circle, fit=(c3_label)] {}; -\node (broker)[draw, rectangle, thick, inner ysep=5 mm, inner xsep=10 mm, fit=(broker_label)] {}; -\node (agg) at (agg_label) [draw, circle, text width=2 cm] {}; -\node (email) at (email_label) [draw, circle, text width=2 cm] {}; - -\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]}] (agg) -- (broker); -\draw[{Latex[length=4mm, round]}-{Latex[length=4mm, round]}] (email) -- (broker); - -\end{tikzpicture} - -\end{center} - -\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 Binary files differdeleted file mode 100644 index 68d20f7..0000000 --- a/slides/what-is-iot-text.pdf +++ /dev/null |