aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2018-04-25 23:28:02 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2018-04-25 23:28:02 +0200
commit129a22667006ec4f7ebca9c9d5b8e4d492103304 (patch)
tree991035d5d48d4fa3ce5774177e304d2d16dac779
parent4bae244f426a39951f404af8f752f715a151f20e (diff)
downloadiot-workshop-129a22667006ec4f7ebca9c9d5b8e4d492103304.tar.gz
iot-workshop-129a22667006ec4f7ebca9c9d5b8e4d492103304.tar.bz2
iot-workshop-129a22667006ec4f7ebca9c9d5b8e4d492103304.tar.xz
iot-workshop-129a22667006ec4f7ebca9c9d5b8e4d492103304.zip
wip
-rw-r--r--.gitignore14
-rw-r--r--README.md (renamed from slides/README.md)3
-rw-r--r--assignments/Makefile14
-rw-r--r--assignments/Makefile.assignment8
-rw-r--r--assignments/README.md60
-rw-r--r--assignments/README.pdfbin0 -> 112702 bytes
-rw-r--r--assignments/blink-a-led/Makefile4
-rw-r--r--assignments/blink-a-led/blink-a-led.pdfbin703496 -> 703496 bytes
-rw-r--r--doc/arduino-esp8266.pdfbin0 -> 3435090 bytes
-rw-r--r--doc/esp32_datasheet_en.pdf (renamed from slides/images/esp32_datasheet_en.pdf)bin892800 -> 892800 bytes
-rw-r--r--doc/esp8266ex_datasheet_en.pdf (renamed from slides/images/esp8266ex_datasheet_en.pdf)bin642062 -> 642062 bytes
-rw-r--r--passwords.txt2
-rw-r--r--slides/images/arduino-ide.pngbin0 -> 86135 bytes
-rw-r--r--slides/what-is-iot-slides.pdfbin571648 -> 181891 bytes
-rw-r--r--slides/what-is-iot-slides.tex204
-rw-r--r--slides/what-is-iot.md78
16 files changed, 249 insertions, 138 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..ecc2f1d
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,14 @@
+.*
+!.gitignore
+*.bak
+*~
+
+*.log
+*.aux
+*.d
+
+env
+config.h
+
+*.beamer.md*
+*.revealjs.md*
diff --git a/slides/README.md b/README.md
index 9d1d71e..4373dea 100644
--- a/slides/README.md
+++ b/README.md
@@ -1,3 +1,5 @@
+# IoT Workshop
+
# Credits
* Some TikZ diagrams where taken from:
@@ -5,3 +7,4 @@
(Beerwarae licensed)
* NodeMCU picture from: https://i2.wp.com/electronilab.co/wp-content/uploads/2016/02/NodeMCU-%E2%80%93-Board-de-desarrollo-con-m%C3%B3dulo-ESP8266-WiFi-y-Lua-4.jpg
* Fritzing model of NodeMCU: https://github.com/roman-minyaylov/fritzing-parts/tree/master/esp8266-nodemcu-v3
+* Arduino ESP8266 documentation: https://media.readthedocs.org/pdf/arduino-esp8266/latest/arduino-esp8266.pdf
diff --git a/assignments/Makefile b/assignments/Makefile
index c7ae828..24208f2 100644
--- a/assignments/Makefile
+++ b/assignments/Makefile
@@ -1,5 +1,13 @@
-AS=01-blink-a-led
+AS=blink-a-led
-BASEDIR=$(CURDIR)
+PDFS=$(foreach A,$(AS),$(A)/$(A).pdf)
-include $(patsubst %,%/Makefile,$(AS))
+all: README.pdf $(PDFS)
+
+README.pdf: README.md
+$(eval $(foreach A,$(AS),$(A)/$(A).pdf: $(A)/$(A).md))
+
+%.pdf: %.md
+ cd $(dir $<); pandoc $(notdir $<) -o $(notdir $@)
+
+#$(patsubst )/%,%,$<) -o $(patsubst $(DIR)/%,%,$@)
diff --git a/assignments/Makefile.assignment b/assignments/Makefile.assignment
deleted file mode 100644
index d05662f..0000000
--- a/assignments/Makefile.assignment
+++ /dev/null
@@ -1,8 +0,0 @@
-all: $(DIR)/$(A).pdf
-
-$(DIR)/$(A).pdf: $(DIR)/$(A).md
- @echo pandoc $(A).md
- @cd $(DIR); pandoc $(patsubst $(DIR)/%,%,$<) -o $(patsubst $(DIR)/%,%,$@)
-
-clean:
- @rm -f $(DIR)/$(A).pdf
diff --git a/assignments/README.md b/assignments/README.md
new file mode 100644
index 0000000..b420798
--- /dev/null
+++ b/assignments/README.md
@@ -0,0 +1,60 @@
+# Assignment preparations
+
+## Install Arduino IDE
+
+Download and install from https://www.arduino.cc/en/Main/Software. The
+workshop is tested with version 1.8.5.
+
+## Install ESP8266 board support
+
+Follow the instructions on
+https://github.com/esp8266/Arduino#installing-with-boards-manager
+
+## Testing the Arduino installation
+
+In the menu Tools -> Board there should be a list of "ESP8266 boards"
+which should include "NodeMCU 1.0 (ESP-12E Module)".
+
+## Install some libraries
+
+* PubSubClient
+* Time
+* TimeAlarms
+
+## Install Python 3
+
+Use your favorite package manager or download from
+https://www.python.org/downloads/. Make sure `virtualenv` is
+installed.
+
+### Create a virtualenv for the assignments
+
+On Windows you might not need the `-p python3` argument.
+
+ $ cd host
+ $ virtualenv -p python3 env
+ $ env/bin/pip install -r requirements.txt
+
+To test that everything was properly installed run python and execute
+`import asyncore`:
+
+ $ env/bin/python
+ Python 3.6.5rc1 (default, Mar 14 2018, 06:54:23)
+ [GCC 7.3.0] on linux
+ Type "help", "copyright", "credits" or "license" for more information.
+ >>> import asyncore
+
+## Install Mosquitto
+
+Either install Mosquitto server and client packages from your
+platform's package manager or download and follow the instructions
+from https://mosquitto.org/.
+
+After installation you should have the commands `mosquitto_pub` and
+`mosquitto_sub` available.
+
+## Install Wireshark (optional)
+
+Either install the Wireshark packages from your platform's package
+manager or download and follow the instructions
+https://www.wireshark.org/.
diff --git a/assignments/README.pdf b/assignments/README.pdf
new file mode 100644
index 0000000..a65c448
--- /dev/null
+++ b/assignments/README.pdf
Binary files differ
diff --git a/assignments/blink-a-led/Makefile b/assignments/blink-a-led/Makefile
deleted file mode 100644
index b015ec1..0000000
--- a/assignments/blink-a-led/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-DIR=01-blink-a-led
-A=blink-a-led
-
-include $(BASEDIR)/Makefile.assignment
diff --git a/assignments/blink-a-led/blink-a-led.pdf b/assignments/blink-a-led/blink-a-led.pdf
index de719fd..c963e79 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/doc/arduino-esp8266.pdf b/doc/arduino-esp8266.pdf
new file mode 100644
index 0000000..c1ff332
--- /dev/null
+++ b/doc/arduino-esp8266.pdf
Binary files differ
diff --git a/slides/images/esp32_datasheet_en.pdf b/doc/esp32_datasheet_en.pdf
index 4b18b52..4b18b52 100644
--- a/slides/images/esp32_datasheet_en.pdf
+++ b/doc/esp32_datasheet_en.pdf
Binary files differ
diff --git a/slides/images/esp8266ex_datasheet_en.pdf b/doc/esp8266ex_datasheet_en.pdf
index ff463f1..ff463f1 100644
--- a/slides/images/esp8266ex_datasheet_en.pdf
+++ b/doc/esp8266ex_datasheet_en.pdf
Binary files differ
diff --git a/passwords.txt b/passwords.txt
new file mode 100644
index 0000000..0a4d8cd
--- /dev/null
+++ b/passwords.txt
@@ -0,0 +1,2 @@
+hesterbest
+kv24
diff --git a/slides/images/arduino-ide.png b/slides/images/arduino-ide.png
new file mode 100644
index 0000000..e744d9f
--- /dev/null
+++ b/slides/images/arduino-ide.png
Binary files differ
diff --git a/slides/what-is-iot-slides.pdf b/slides/what-is-iot-slides.pdf
index 9eb29db..49b1b5e 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 e3646f7..582922b 100644
--- a/slides/what-is-iot-slides.tex
+++ b/slides/what-is-iot-slides.tex
@@ -97,7 +97,17 @@ What differentiates a computer from an IoT device?}
\end{itemize}
\end{itemize}
-\note{\begin{itemize}
+\note{Might not have:
+
+\begin{itemize}
+\tightlist
+\item
+ RTC
+\end{itemize}
+
+Extra features:
+
+\begin{itemize}
\tightlist
\item
IR
@@ -271,13 +281,6 @@ 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}}
@@ -444,8 +447,6 @@ 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.}
@@ -454,57 +455,6 @@ maximum value is 64k, 65536.}
\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}
- \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 (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)};
- \node (mode) at (16,14.5) {\scriptsize IP options (variable length)};
-\end{tikzpicture}
-
-\end{center}
-
\end{frame}
\hypertarget{lecture-esp8266}{%
@@ -513,90 +463,110 @@ Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem
\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}
+\end{frame}
-\path
- (0, 0) node(flash)[draw, rectangle,
- minimum height=1cm, minimum width=2cm] {Flash}
+\begin{frame}{ESP8266 software layers}
+\protect\hypertarget{esp8266-software-layers}{}
+
+\end{frame}
- (0, 1.5) node(esp8266)[draw, rectangle,
- minimum height=1cm, minimum width=2cm] {ESP8266}
+\begin{frame}{ESP8266 + Arduino}
+\protect\hypertarget{esp8266-arduino}{}
- (3.5, 1.5) node(cp201x)[draw, rectangle,
- minimum height=0.75cm, minimum width=1cm]
- {CP201x}
+\begin{itemize}
+\tightlist
+\item
+ Standard Arduino IDE
+\item
+ ESP8266 Arduino core
+
+ \begin{itemize}
+ \tightlist
+ \item
+ https://github.com/esp8266/Arduino
+ \end{itemize}
+\end{itemize}
- (5.5, 1.5) node(usb)[]
- {USB}
-;
+\end{frame}
-\draw[-] (esp8266) -- node[node font=\footnotesize, right]{QSPI} (flash);
-\draw[-] (esp8266) -- node[node font=\footnotesize, above]{UART} (cp201x) -- (usb);
+\begin{frame}{Arduino IDE}
+\protect\hypertarget{arduino-ide}{}
-\node[rectangle, draw, fit=(esp8266) (flash), inner sep=2 mm,
- label={[name=esp12_label,anchor=south]ESP-12}]
- (esp12){};
+\end{frame}
-\node[rectangle, draw, thick, fit=(esp12_label) (esp12) (cp201x), inner sep=3 mm,
- label={[anchor=north]south:NodeMCU}]
- (nodemcu){};
+\begin{frame}[fragile]{Arduino code structure}
+\protect\hypertarget{arduino-code-structure}{}
-\end{tikzpicture}
+\begin{verbatim}
+void setup() {
+ // Called once
+}
-\end{center}
+void loop() {
+ // Called repeatedly
+}
+\end{verbatim}
-\end{frame}
+\note{MCU programming is often structured into:
-\begin{frame}{ESP8266 software layers}
-\protect\hypertarget{esp8266-software-layers}{}
+\begin{itemize}
+\tightlist
+\item
+ Configure
-\begin{center}
-\begin{tikzpicture}
+ \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}
-\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) {};
+Arduino chooses to run the cpu at 100\% instead of the sleep step..}
-\draw[thick] (-0.5, 1.25) -- (6.5, 1.25) ;
+\end{frame}
-\node [rectangle, draw, anchor=south west,
- minimum width=4 cm, minimum height=1 cm,
- label={[anchor=south]center:ESP SDK}] at (0, 1.5) {};
+\begin{frame}[fragile]{Arduino file structure}
+\protect\hypertarget{arduino-file-structure}{}
-\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) {};
+\begin{verbatim}
+foo/
+ foo.ino
+ config.h
+\end{verbatim}
-\node [rectangle, draw, anchor=south west,
- minimum width=6 cm, minimum height=1 cm,
- label={[anchor=south]center:ESP interface}] at (0, 2.5) {};
+\note{\texttt{foo.ino} must always be in a \texttt{foo} directory.
-\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) {};
+config.h is created by “new tab”.}
-\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) {};
+\end{frame}
-\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) {};
+\begin{frame}[fragile]{Generic Arduino APIs}
+\protect\hypertarget{generic-arduino-apis}{}
-\draw [decorate, decoration={brace,amplitude=5pt, raise=-4pt}] (-0.5,2.5) -- (-0.5,4.5) node [black,midway,rotate=90, above] {Arduino};
+// Pin: D0, D1, etc. // Mode: OUTPUT, INPUT, INPUT\_PULLUP
+\begin{verbatim}
+pinMode(pin, mode);
-\end{tikzpicture}
+digitalWrite(pin, state);
-\end{center}
+state = digitalRead(pin);
+\end{verbatim}
\end{frame}
@@ -1034,8 +1004,6 @@ releases at the same time.}
\begin{frame}{Assignment 1: Blink a led}
\protect\hypertarget{assignment-1-blink-a-led}{}
-\includegraphics{../arduino/assignment-1/solution/assignment-1_bb.pdf}
-
\end{frame}
\begin{frame}{Assignment 2: Connect to Wi-Fi}
diff --git a/slides/what-is-iot.md b/slides/what-is-iot.md
index edc3940..ef11ca3 100644
--- a/slides/what-is-iot.md
+++ b/slides/what-is-iot.md
@@ -63,6 +63,12 @@ What differentiates a computer from an IoT device?
::: notes
+Might not have:
+
+* RTC
+
+Extra features:
+
* IR
* UART
* CAN
@@ -169,10 +175,6 @@ Datasheet page 18
:::
-## ESP8266 details - Arduino
-
-https://github.com/esp8266/Arduino
-
# Going back to basics
## What is the internet again?
@@ -318,6 +320,73 @@ Note that the "total length" field is 16 bits, 2 bytes, it's maximum value is 64
\end{center}
)
+## ESP8266 + Arduino
+
+* Standard Arduino IDE
+* ESP8266 Arduino core
+ * https://github.com/esp8266/Arduino
+
+## Arduino IDE
+
+!ifndef(QUICK)(
+![](images/arduino-ide.png)
+)
+
+## Arduino code structure
+
+~~~ .c++
+void setup() {
+ // Called once
+}
+
+void loop() {
+ // Called repeatedly
+}
+~~~
+
+::: notes
+
+MCU programming is often structured into:
+
+* Configure
+ * CPU
+ * GPIO ports
+ * MCU's peripherals
+ * The rest of the board
+ * Configure application and callbacks.
+* Sleep
+
+Arduino chooses to run the cpu at 100% instead of the sleep step..
+
+:::
+
+## Arduino file structure
+
+ foo/
+ foo.ino
+ config.h
+
+::: notes
+
+`foo.ino` must always be in a `foo` directory.
+
+config.h is created by "new tab".
+
+:::
+
+## Generic Arduino APIs
+
+// Pin: D0, D1, etc.
+// Mode: OUTPUT, INPUT, INPUT_PULLUP
+
+~~~c++
+pinMode(pin, mode);
+
+digitalWrite(pin, state);
+
+state = digitalRead(pin);
+~~~
+
# Lecture: MQTT
## MQTT
@@ -535,7 +604,6 @@ In between are:
## Assignment 1: Blink a led
-
## Assignment 2: Connect to Wi-Fi
## Assignment 3: Connect to MQTT broker