SlideShare a Scribd company logo
Internet of Things Workshop
with Arduino
This work by http://tamberg.org/ is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
A CC licensed workshop by @tamberg, first held 07.07.2012 at SGMK MechArtLab Zürich, Switzerland,
in collaboration with Zürich IoT Meetup, Perey Research & Consulting, Thomas Brühlmann and SGMK.
Internet
Computers, connected through Internet
protocols
Display or manipulate documents
http://blog.com/2011-09-15/todays-post.html
Internet of Things (IoT)
Computers, sensors and actuators connected
through Internet protocols
Measure or manipulate physical properties
http://e-home.com/tamberg/kitchen/light
Internet-connected devices
IoT reference model
IoT hardware
Any Internet-connected computer with an
interface to the real world (sensors, actuators)
Small => can be embedded into things
Small computer = microcontroller (or board),
e.g. Arduino, Netduino Plus, BeagleBone, …
Note: connecting your board to the Internet via a
desktop PC and USB is also fine, just a bit overkill
IoT hardware
http://arduino.cc/
http://netduino.com/netduhttp://beagleboard.org/bone
Note: Thanks to TCP/IP & HTTP, any client can talk to
any service, no matter which hardware you choose
IoT infrastructure services
Thingspeak and Xively to store and use sensor measurements
e.g. https://thingspeak.com/channels/9
Twitter allows objects to talk to humans or receive commands
e.g. @twrbrdg_itself (f.k.a. @towerbridge)
Yaler enables remote access to Internet-connected devices
e.g. http://try.yaler.net/~arduino/led (Disclosure: I’m a founder)
Zapier and IFTTT allow mash-ups of Webservices
e.g. http://goo.gl/7Y8a7z
Just a beginning
Reactive buildings, flying / crawling IoT devices,
underused devices selling themselves on Ebay…
Connected products become service avatars, or
“everything becomes a service” (e.g. car sharing,
home sharing, shoe sharing)
“Once it’s here it will no longer be called
the Internet of Things” Open IoT Assembly 2012
Topics of this workshop
Getting started
(setup and programming of IoT hardware)
Measuring and manipulating
(physical computing: sensors and actuators)
Connecting your device to the Internet
(IoT: monitoring sensors, controlling actuators)
Mash-ups with Web-enabled devices
(together, if time permits)
How the Internet works under the hood
Hands on
Broad range of topics => learn by doing
Copy&paste examples, make 'em work for you,
https://bitbucket.org/tamberg/iotworkshop/get/tip.zip
Focus on end-to-end results, not details
Google, help each other, ask us
Note: Once it has been programmed, your board
can run on its own, without another computer
Getting started
The IDE (Integrated Development Environment)
allows you to program your board, i.e. “make it
do something new”
You edit a program on your computer, then
upload it to your board where it’s stored in the
program memory (flash) and executed in RAM
Getting started with Arduino
To install the Arduino IDE and connect your
Arduino board to your computer via USB, see
http://arduino.cc/en/Guide/MacOSX or
http://arduino.cc/en/Guide/Windows or
http://arduino.cc/playground/Learning/Linux
Measuring and manipulating
Measuring and manipulating
IoT hardware has an interface to the real world
GPIO (General Purpose Input/Output) pins
Measure: read sensor value from input pin
Manipulate: write actuator value to output pin
Inputs and outputs can be digital or analog
The resistor
Resistors are the workhorse of electronics
Resistance is measured in Ω (Ohm) and adds up
in series; a resistors orientation doesn’t matter
A resistors Ω value is color-coded right on it
Note: color codes are great, but it’s easier to use a
multi-meter if you’ve got one, and just measure Ω
The LED
The LED (Light Emitting Diode)
is a simple, digital actuator
LEDs have a short leg (-) and a long leg (+)
and it matters how they are oriented in a circuit
To prevent damage, LEDs are used together
with a 1KΩ resistor (or anything from 300Ω to
2KΩ)
+ -
+ -Anode Cathode
The breadboard
A breadboard lets you wire electronic
components without any soldering
Its holes are connected
“under the hood” as
shown here
Wiring a LED with Arduino
The long leg of the
LED is connected to
pin 13, the short leg
to ground (GND)
Note: the additional
1K Ω resistor should
be used to prevent
damage to the pins /
LED if it’s reversed
The Ethernet Shield
is not needed here
+
HIGH = digital 1 (5V)
means LED is on,
LOW = digital 0 (0V)
means LED is off
Set ledPin as wired
in your LED circuit
Digital output with Arduino
int ledPin = 13;
void setup () {
pinMode(ledPin, OUTPUT);
}
void loop () {
digitalWrite(ledPin, HIGH);
delay(500); // wait 500ms
digitalWrite(ledPin, LOW);
delay(500);
}
Note: blinking a LED
is the Hello World of
embedded software
Actuator bonus stage
Try a switched power outlet instead of a LED
(black wire = GND)
Use a multicolor LED with the breadboard, as in
http://www.ladyada.net/learn/arduino/lesson3.html
Or solder resistors to a multicolor LED, as in
http://www.instructables.com/id/Arduino-Web-LED/
A switch is a simple, digital sensor
Switches come in different forms, but all of
them in some way open or close a gap in a wire
The pushbutton switch has four legs for easier
mounting, but only two of them are needed
Note: you can also easily build your own switches,
for inspiration see e.g. http://vimeo.com/2286673
The switch
Wiring a switch with Arduino
Pushbutton switch
10K Ω resistor
5V
GND
D2 (max input 5V!)
Note: the resistor in
this setup is called
pull-down ‘cause it
pulls the pin voltage
down to GND (0V) if
the switch is open
Digital input with Arduino
int sensorPin = 2; // e.g. button switch
void setup () {
Serial.begin(9600); // setup log
pinMode(sensorPin, INPUT);
}
void loop () {
int sensorValue = digitalRead(sensorPin);
Serial.println(sensorValue); // log 0 or 1
}
Or run Arduino IDE
> File > Examples >
Digital > Button for
an example of how
to switch an LED
Open the Arduino
IDE serial monitor
to see log output
Photoresistor (LDR)
A photoresistor or LDR
(light dependent resistor) is
a resistor whose resistance
depends on light intensity
An LDR can be used as a simple, analog sensor
The orientation of an LDR does not matter
Wiring an LDR with Arduino
Photoresistor (LDR)
10K Ω resistor
5V
GND
A0
Note: this setup is a
voltage-divider, as
the 5V total voltage
is divided between
LDR and resistor to
keep 0V < A0 < 2.5V
int sensorPin = A0; // e.g. LDR
void setup () {
Serial.begin(9600); // setup log
}
void loop () {
int sensorValue = analogRead(sensorPin);
Serial.println(sensorValue); // log value
}
Analog input with Arduino
Open the Arduino
IDE serial monitor
to see log output
Note: use e.g. Excel to visualize values over time
Sensor bonus stage
Switch the LED
depending on
analog input
Read analog values from a bathroom scale
Or use sensors with other wire protocols, e.g. i2c
Connecting to the Internet
Note: in this workshop we focus on Ethernet and Wi-Fi
Connecting to the Internet
Ethernet (built-in or shield), plug it in anywhere
Wi-Fi (module), configured once per location
3G (module), configured once, easy to use
Bluetooth/BLE (module), via 3G/Wi-Fi of phone
ZigBee (module), via ZigBee gateway
USB (built-in), via desktop computer
Wiring CC3000 Wi-Fi with Arduino
CC3000 VIN to 5V
GND to GND
CLK to D13, MISO to
D12, MOSI to D11,
CS to D10, VBEN to
D5, IRQ to D3
Note: make sure to
use a reliable power
source, e.g. plug the
Arduino via USB or
use a LiPo battery
Note: open the serial monitor window to see the log
http://learn.adafruit.com/adafruit-cc3000-wifi/cc300
File > Examples > Adafruit_CC3000 > WebClient
#define WLAN_SSID "..." // set your network
#define WLAN_PASS "..." // set your password
Using CC3000 Wi-Fi with Arduino
Note: please ask for assistance to get a unique address
Add an Ethernet shield to the Arduino, plug it in
File > Examples > Ethernet > WebClient
byte mac[] = { ... }; // set a unique MAC address
IPAddress ip(...); // set a local, unique IP address
Using Ethernet with Arduino
Monitoring sensors
Pachube
Monitoring sensors
Devices read (and cache) sensor data
Devices push data to a service with POST, PUT
Some services pull data from devices with GET
Service stores measurements, to be consumed
by humans or computers (incl. other devices)
Pachube (now Xively)
The Pachube (now Xively) service lets you store,
monitor and share sensor data in open formats
PUT /v2/feeds/<your feed id>.csv HTTP/1.1rn
Host: api.xively.comrn
X-ApiKey: <your API key>rn
Content-Length: <content length>rn
rn
<sensor name>,<sensor value>
GET /v2/feeds/<feed id>.json HTTP/1.1rn
Host and X-ApiKey as above…rnrn
Note: please visit
http://xively.com/
to sign up, create a
feed with a data
stream per sensor
and get an API key
Pachube with Arduino + Ethernet
Use Xively’s template or open Arduino IDE >
Examples > Ethernet > PachubeClient
Check MAC, IP, FEED ID, API KEY
and the data stream’s name
Analog input: LDR on A0
http://xively.com/feeds/<feed-id>
Note: to send data
to xively.com make
sure your Arduino
is connected to the
Internet
Open the Arduino
IDE serial monitor
to see log output
Pachube with Arduino + CC3000
To connect an Arduino to Pachube (now Xively)
follow the steps in
http://learn.adafruit.com/adafruit-cc3000-wifi-and-x
Controlling actuators
Yaler
Controlling actuators
Service offers UI or API to control actuators
Device polls service for control data with GET
Or, service pushes control data to device with
POST or PUT
Device writes control data to actuators
Web service with Arduino
https://bitbucket.org/tamberg/iotworkshop/raw/e1
Please change the MAC address,
wait for DHCP to assign an IP and
visit the URL displayed in the log
Make sure to add
an EthernetShield
to your Arduino &
plug it into a LAN
Open the serial
monitor window
to see log output
Note: your Arduino is now a (local) Web server
The Yaler relay provides a public and stable URL
to access Web services behind a firewall or NAT
Yaler
Note: please visit
http://yaler.net/
and sign up to get
your relay domain
and API key (free)
For remote Web access with Ethernet, see
https://yaler.net/arduino
For the WiFi shield, see
https://yaler.net/arduino-wifi
And for the CC3000, see
https://yaler.net/arduino-cc3000
Yaler with Arduino
Mash-ups
Mash-ups
A mash-up combines two or more Web services
Once devices have APIs, they become scriptable
Logic moves out of device, into the Cloud, e.g.
Web-enabled LED + Yahoo Weather API =
ambient weather notification
Note: the IoT enables physical mash-ups of things
Mash-ups
HTML combining data from multiple APIs on the
Web client, using Javascript XMLHttpRequest to
get data (in JSONP, to bypass same origin policy)
Scripting (C#, Python, Go, …) glue code hosted
on a desktop or in the cloud (EC2, AppEngine …)
Mash-up platforms (IFTTT.com, Zapier.com, …)
Note: open data formats and APIs enable mash-ups
If you wonder what TCP/IP, HTTP or DNS means
- or care about the difference between protocol,
data format and API, read on...
How the Internet works
Note: protocols are layered, e.g. HTTP messages
transported in TCP/IP packets sent over Ethernet
Protocols
Parties need to agree on how to exchange data
(communicating = exchanging data according to
a protocol)
e.g. Ethernet links local computers physically,
TCP/IP is the foundation of the Internet, and
HTTP is the protocol that enables the Web
TCP/IP
IP (Internet Protocol) deals with host addressing
(each host has an IP address) and packet routing
TCP (Transmission Control Protocol): connection
oriented, reliable data stream (packets in-order,
errors corrected, duplicates removed, discarded
or lost packets resent) from client to server
Note: DHCP assigns an IP address to your device
which is mapped to the device’s MAC address
HTTP (Hypertext Transfer Protocol) enables the
distributed, collaborative system we call the Web
The client sends an HTTP request,
the server replies with a response
HTTP Message = Request|Response
Request = (GET|POST|…) Path CRLF *(Header CRLF) CRLF Body
Response = "HTTP/1.1" (200|404|…) CRLF *(Header CRLF) CRLF Body
CRLF = "rn"
(Read the spec: http://tools.ietf.org/html/rfc2616)
HTTP
Note: HTTP is human readable, i.e. it’s easy to debug
The URI (Uniform Resource Identifier) is a string
of characters used to identify a resource
http://blog.tamberg.org/2011-10-17/side-projects.html
(Read the spec: http://tools.ietf.org/html/rfc3986)
QR codes, NFC tags can contain a machine readable URI
IoT: URIs can refer to things or their physical properties
URIs
Note: good URIs can be hand-written on a napkin
and re-typed elsewhere, without any ambiguity
authority = host [‘:’ port] pathscheme
DNS
DNS (Domain Name System) maps Internet
domain names to one or more IP addresses
Try it in your desktop computer terminal, e.g.
$ nslookup google.com
173.194.35.6 …
Note: if your device doesn’t support DNS you can
connect to the server’s IP, but beware of changes
Data formats
Parties need to agree on what is valid content
(parsing = reading individual content tokens)
CSV: easy to parse, suited for tables, old school
JSON: easy to parse, de facto standard
XML: used by many services, W3C standard
Semi-structured text, e.g. Twitter’s @user, #tag
Binary formats, e.g. PNG, MP3, …
RSS
In addition to generic data formats like CSV,
JSON, XML there are refinements that add
semantics to the document
RSS (or Atom) is a data format for lists of items
Invented for blogs, RSS is great for data feeds
Note: RSS documents are also XML documents,
but not all XML documents contain valid RSS
HTML
HTML (Hypertext Markup Language) is a data
format describing how a Web page should be
structured and displayed
Look at the HTML (and Javascript) code of any
Web page with "view source" in your browser
Note: HTML documents are not always valid XML
documents, but Web browsers are very forgiving
APIs
An API (Application Programming Interface), is
an agreement between clients and providers of
a service on how to access a service, how to get
data out of it or put data into it
The UI (User Interface) of a service is made for
humans, the API is made for other computers
Note: good APIs are documented or self-explanatory
REST
REST (Representational State Transfer) is a style
of designing an API so that it is easy to use
REST APIs use HTTP methods (GET, PUT, POST,
DELETE) to let you perform actions on resources
REST APIs can be explored by following links
Note: good Web UIs are often built following the
same principles, therefore REST APIs feel natural
Sharing network connections
Most newer computer operating systems allow
sharing network connections with other devices
Mac OSX: System Preferences > Sharing > Internet
Sharing > From Wi-Fi to Ethernet
Windows 7: Control Panel > View network status and
tasks > Change adapter settings > right click Wireless
Network Connection > Properties > Sharing > [x] Allow
other network users to connect … > Local Area
Connection
Note: helpful for demos, if there’s Wi-Fi but no LAN
Debugging Web services
Chrome > Inspect Element > Network, Console
cURL for HTTP requests (http://curl.haxx.se/)
Requestbin for Webhooks (http://requestb.in/)
Fiddler (http://www.fiddler2.com/)
WireShark (http://www.wireshark.org/)
Debugging USB or Bluetooth
On Mac OSX and Linux
list connected devices with ls /dev/tty*
display output with screen /dev/tty... 9600
On Windows
list devices, fix drivers with devmgmt.msc
display serial output with PuTTY
Energy
Wall socket, Power over Ethernet (w/ adapters),
batteries (direct or Minty Boost USB charger),
LiPo batteries (also shields), solar panels, …
Low power: lets hardware sleep to save energy
Future: new battery technologies, ultra low
power hardware, energy harvesting
Note: Moore’s law does not apply to batteries
Note: MechArtLab Zürich has an OpenLab on Tuesdays
Learning more
Electronics: Ohm’s law, Kirchhoff’s current and voltage
law (KCL & KVL), Make: Electronics by Charles Platt
Interaction Design: Smart Things by Mike Kuniavsky,
Emoticomp blog post by Ben Bashford, BERG blog
Physical Computing: Making Things Talk by Tom Igoe
REST: RESTful Web Services by Leonard Richardson
Programming: read other people’s code
IoT: Designing the Internet of Things by Adrian McEwen
and Hakim Cassimally, Postscapes.com, IoTList.co
Reducing E-waste
Tired of hacking?
Donate your hardware to a local hackerspace…
e.g. MechArtLab
Hohlstrasse 52
8004 Zürich
DIY IOT FTW
Thank you

More Related Content

What's hot (20)

Arduino
ArduinoArduino
Arduino
 
Iot architecture
Iot architectureIot architecture
Iot architecture
 
Building IoT with Arduino Day One
Building IoT with Arduino Day One Building IoT with Arduino Day One
Building IoT with Arduino Day One
 
Introduction To Raspberry Pi with Simple GPIO pin Control
Introduction To Raspberry Pi with Simple GPIO pin ControlIntroduction To Raspberry Pi with Simple GPIO pin Control
Introduction To Raspberry Pi with Simple GPIO pin Control
 
Internet of Things(IOT)_Seminar_Dr.G.Rajeshkumar
Internet of Things(IOT)_Seminar_Dr.G.RajeshkumarInternet of Things(IOT)_Seminar_Dr.G.Rajeshkumar
Internet of Things(IOT)_Seminar_Dr.G.Rajeshkumar
 
Internet of things ppt
Internet of things pptInternet of things ppt
Internet of things ppt
 
Raspberry Pi
Raspberry Pi Raspberry Pi
Raspberry Pi
 
Introduction to IOT
Introduction to IOTIntroduction to IOT
Introduction to IOT
 
IoT
IoTIoT
IoT
 
Fog computing in IoT
Fog computing in IoTFog computing in IoT
Fog computing in IoT
 
PPT ON Arduino
PPT ON Arduino PPT ON Arduino
PPT ON Arduino
 
IOT ppt
IOT pptIOT ppt
IOT ppt
 
Internet of Things (IoT) - Seminar ppt
Internet of Things (IoT) - Seminar pptInternet of Things (IoT) - Seminar ppt
Internet of Things (IoT) - Seminar ppt
 
Raspberry Pi
Raspberry PiRaspberry Pi
Raspberry Pi
 
Smart home Environment using iot
Smart home Environment using iotSmart home Environment using iot
Smart home Environment using iot
 
Arduino presentation
Arduino presentationArduino presentation
Arduino presentation
 
Internet Of Things
 Internet Of Things Internet Of Things
Internet Of Things
 
Sensors in IOT
Sensors in IOTSensors in IOT
Sensors in IOT
 
Intro to Arduino
Intro to ArduinoIntro to Arduino
Intro to Arduino
 
IOT and Characteristics of IOT
IOT and  Characteristics of IOTIOT and  Characteristics of IOT
IOT and Characteristics of IOT
 

Similar to IoT with Arduino

Arduino Slides With Neopixels
Arduino Slides With NeopixelsArduino Slides With Neopixels
Arduino Slides With Neopixelssdcharle
 
Introduction to Arduino Hardware and Programming
Introduction to Arduino Hardware and ProgrammingIntroduction to Arduino Hardware and Programming
Introduction to Arduino Hardware and ProgrammingEmmanuel Obot
 
Arduino Workshop Slides
Arduino Workshop SlidesArduino Workshop Slides
Arduino Workshop Slidesmkarlin14
 
Arduino slides
Arduino slidesArduino slides
Arduino slidessdcharle
 
Multi Sensory Communication 1/2
Multi Sensory Communication 1/2Multi Sensory Communication 1/2
Multi Sensory Communication 1/2Satoru Tokuhisa
 
DeviceHub - First steps using Intel Edison
DeviceHub - First steps using Intel EdisonDeviceHub - First steps using Intel Edison
DeviceHub - First steps using Intel EdisonGabriel Arnautu
 
Arduino Development For Beginners
Arduino Development For BeginnersArduino Development For Beginners
Arduino Development For BeginnersFTS seminar
 
Oop 2014 embedded systems with open source hardware v2
Oop 2014 embedded systems with open source hardware v2Oop 2014 embedded systems with open source hardware v2
Oop 2014 embedded systems with open source hardware v2Michael Stal
 
IOT WORKSHEET 1.4.pdf
IOT WORKSHEET 1.4.pdfIOT WORKSHEET 1.4.pdf
IOT WORKSHEET 1.4.pdfMayuRana1
 
IoT Basics with few Embedded System Connections for sensors
IoT Basics with few Embedded System Connections for sensorsIoT Basics with few Embedded System Connections for sensors
IoT Basics with few Embedded System Connections for sensorssaritasapkal
 
Introducing... Arduino
Introducing... ArduinoIntroducing... Arduino
Introducing... Arduinozvikapika
 
Arduino in Agricoltura -Alessandro Matese
Arduino in Agricoltura -Alessandro MateseArduino in Agricoltura -Alessandro Matese
Arduino in Agricoltura -Alessandro MateseAlfonso Crisci
 
Lab Manual Arduino UNO Microcontrollar.docx
Lab Manual Arduino UNO Microcontrollar.docxLab Manual Arduino UNO Microcontrollar.docx
Lab Manual Arduino UNO Microcontrollar.docxRashidFaridChishti
 
teststststststLecture_3_2022_Arduino.pptx
teststststststLecture_3_2022_Arduino.pptxteststststststLecture_3_2022_Arduino.pptx
teststststststLecture_3_2022_Arduino.pptxethannguyen1618
 
Microcontroller arduino uno board
Microcontroller arduino uno boardMicrocontroller arduino uno board
Microcontroller arduino uno boardGaurav
 

Similar to IoT with Arduino (20)

Arduino Slides With Neopixels
Arduino Slides With NeopixelsArduino Slides With Neopixels
Arduino Slides With Neopixels
 
Introduction to Arduino Hardware and Programming
Introduction to Arduino Hardware and ProgrammingIntroduction to Arduino Hardware and Programming
Introduction to Arduino Hardware and Programming
 
Arduino Workshop Slides
Arduino Workshop SlidesArduino Workshop Slides
Arduino Workshop Slides
 
Arduino slides
Arduino slidesArduino slides
Arduino slides
 
Arduino
ArduinoArduino
Arduino
 
Multi Sensory Communication 1/2
Multi Sensory Communication 1/2Multi Sensory Communication 1/2
Multi Sensory Communication 1/2
 
DeviceHub - First steps using Intel Edison
DeviceHub - First steps using Intel EdisonDeviceHub - First steps using Intel Edison
DeviceHub - First steps using Intel Edison
 
Arduino Development For Beginners
Arduino Development For BeginnersArduino Development For Beginners
Arduino Development For Beginners
 
Oop 2014 embedded systems with open source hardware v2
Oop 2014 embedded systems with open source hardware v2Oop 2014 embedded systems with open source hardware v2
Oop 2014 embedded systems with open source hardware v2
 
What is Arduino ?
What is Arduino ?What is Arduino ?
What is Arduino ?
 
IOT WORKSHEET 1.4.pdf
IOT WORKSHEET 1.4.pdfIOT WORKSHEET 1.4.pdf
IOT WORKSHEET 1.4.pdf
 
IoT Basics with few Embedded System Connections for sensors
IoT Basics with few Embedded System Connections for sensorsIoT Basics with few Embedded System Connections for sensors
IoT Basics with few Embedded System Connections for sensors
 
Introducing... Arduino
Introducing... ArduinoIntroducing... Arduino
Introducing... Arduino
 
Arduino in Agricoltura -Alessandro Matese
Arduino in Agricoltura -Alessandro MateseArduino in Agricoltura -Alessandro Matese
Arduino in Agricoltura -Alessandro Matese
 
Uvais
Uvais Uvais
Uvais
 
What is arduino
What is arduinoWhat is arduino
What is arduino
 
Lab Manual Arduino UNO Microcontrollar.docx
Lab Manual Arduino UNO Microcontrollar.docxLab Manual Arduino UNO Microcontrollar.docx
Lab Manual Arduino UNO Microcontrollar.docx
 
teststststststLecture_3_2022_Arduino.pptx
teststststststLecture_3_2022_Arduino.pptxteststststststLecture_3_2022_Arduino.pptx
teststststststLecture_3_2022_Arduino.pptx
 
Microcontroller arduino uno board
Microcontroller arduino uno boardMicrocontroller arduino uno board
Microcontroller arduino uno board
 
Tech Talk IOT
Tech Talk IOTTech Talk IOT
Tech Talk IOT
 

Recently uploaded

一比一原版SDSU毕业证圣地亚哥州立大学毕业证成绩单如何办理
一比一原版SDSU毕业证圣地亚哥州立大学毕业证成绩单如何办理一比一原版SDSU毕业证圣地亚哥州立大学毕业证成绩单如何办理
一比一原版SDSU毕业证圣地亚哥州立大学毕业证成绩单如何办理kywwoyk
 
一比一原版麦考瑞大学毕业证成绩单如何办理
一比一原版麦考瑞大学毕业证成绩单如何办理一比一原版麦考瑞大学毕业证成绩单如何办理
一比一原版麦考瑞大学毕业证成绩单如何办理cnzepoz
 
NO1 Pandit Black magic/kala jadu,manpasand shadi in lahore,karachi rawalpindi...
NO1 Pandit Black magic/kala jadu,manpasand shadi in lahore,karachi rawalpindi...NO1 Pandit Black magic/kala jadu,manpasand shadi in lahore,karachi rawalpindi...
NO1 Pandit Black magic/kala jadu,manpasand shadi in lahore,karachi rawalpindi...Amil Baba Dawood bangali
 
Memory compiler tutorial – TSMC 40nm technology
Memory compiler tutorial – TSMC 40nm technologyMemory compiler tutorial – TSMC 40nm technology
Memory compiler tutorial – TSMC 40nm technologyAhmed Abdelazeem
 
NO1 Uk Amil Baba In Lahore Kala Jadu In Lahore Best Amil In Lahore Amil In La...
NO1 Uk Amil Baba In Lahore Kala Jadu In Lahore Best Amil In Lahore Amil In La...NO1 Uk Amil Baba In Lahore Kala Jadu In Lahore Best Amil In Lahore Amil In La...
NO1 Uk Amil Baba In Lahore Kala Jadu In Lahore Best Amil In Lahore Amil In La...Amil baba
 
1. WIX 2 PowerPoint for Work Experience.pptx
1. WIX 2 PowerPoint for Work Experience.pptx1. WIX 2 PowerPoint for Work Experience.pptx
1. WIX 2 PowerPoint for Work Experience.pptxlouise569794
 
F5 LTM TROUBLESHOOTING Guide latest.pptx
F5 LTM TROUBLESHOOTING Guide latest.pptxF5 LTM TROUBLESHOOTING Guide latest.pptx
F5 LTM TROUBLESHOOTING Guide latest.pptxArjunJain44
 
一比一原版UVM毕业证佛蒙特大学毕业证成绩单如何办理
一比一原版UVM毕业证佛蒙特大学毕业证成绩单如何办理一比一原版UVM毕业证佛蒙特大学毕业证成绩单如何办理
一比一原版UVM毕业证佛蒙特大学毕业证成绩单如何办理kywwoyk
 
Matrix Methods.pptxbbbbbbbbbbbbbbbbbbbbb
Matrix Methods.pptxbbbbbbbbbbbbbbbbbbbbbMatrix Methods.pptxbbbbbbbbbbbbbbbbbbbbb
Matrix Methods.pptxbbbbbbbbbbbbbbbbbbbbbjoshuaclack73
 
China Die Casting Manufacturer & Supplier - Bian Diecast
China Die Casting Manufacturer & Supplier - Bian DiecastChina Die Casting Manufacturer & Supplier - Bian Diecast
China Die Casting Manufacturer & Supplier - Bian DiecastAMshares
 
一比一原版SDSU毕业证圣地亚哥州立大学毕业证成绩单如何办理
一比一原版SDSU毕业证圣地亚哥州立大学毕业证成绩单如何办理一比一原版SDSU毕业证圣地亚哥州立大学毕业证成绩单如何办理
一比一原版SDSU毕业证圣地亚哥州立大学毕业证成绩单如何办理eemet
 
一比一原版AIS毕业证成绩单如何办理
一比一原版AIS毕业证成绩单如何办理一比一原版AIS毕业证成绩单如何办理
一比一原版AIS毕业证成绩单如何办理cnzepoz
 
一比一原版UBC毕业证成绩单如何办理
一比一原版UBC毕业证成绩单如何办理一比一原版UBC毕业证成绩单如何办理
一比一原版UBC毕业证成绩单如何办理cnzepoz
 
Aluminum Die Casting Manufacturers in China - BIAN Diecast
Aluminum Die Casting Manufacturers in China - BIAN DiecastAluminum Die Casting Manufacturers in China - BIAN Diecast
Aluminum Die Casting Manufacturers in China - BIAN DiecastAMshares
 

Recently uploaded (14)

一比一原版SDSU毕业证圣地亚哥州立大学毕业证成绩单如何办理
一比一原版SDSU毕业证圣地亚哥州立大学毕业证成绩单如何办理一比一原版SDSU毕业证圣地亚哥州立大学毕业证成绩单如何办理
一比一原版SDSU毕业证圣地亚哥州立大学毕业证成绩单如何办理
 
一比一原版麦考瑞大学毕业证成绩单如何办理
一比一原版麦考瑞大学毕业证成绩单如何办理一比一原版麦考瑞大学毕业证成绩单如何办理
一比一原版麦考瑞大学毕业证成绩单如何办理
 
NO1 Pandit Black magic/kala jadu,manpasand shadi in lahore,karachi rawalpindi...
NO1 Pandit Black magic/kala jadu,manpasand shadi in lahore,karachi rawalpindi...NO1 Pandit Black magic/kala jadu,manpasand shadi in lahore,karachi rawalpindi...
NO1 Pandit Black magic/kala jadu,manpasand shadi in lahore,karachi rawalpindi...
 
Memory compiler tutorial – TSMC 40nm technology
Memory compiler tutorial – TSMC 40nm technologyMemory compiler tutorial – TSMC 40nm technology
Memory compiler tutorial – TSMC 40nm technology
 
NO1 Uk Amil Baba In Lahore Kala Jadu In Lahore Best Amil In Lahore Amil In La...
NO1 Uk Amil Baba In Lahore Kala Jadu In Lahore Best Amil In Lahore Amil In La...NO1 Uk Amil Baba In Lahore Kala Jadu In Lahore Best Amil In Lahore Amil In La...
NO1 Uk Amil Baba In Lahore Kala Jadu In Lahore Best Amil In Lahore Amil In La...
 
1. WIX 2 PowerPoint for Work Experience.pptx
1. WIX 2 PowerPoint for Work Experience.pptx1. WIX 2 PowerPoint for Work Experience.pptx
1. WIX 2 PowerPoint for Work Experience.pptx
 
F5 LTM TROUBLESHOOTING Guide latest.pptx
F5 LTM TROUBLESHOOTING Guide latest.pptxF5 LTM TROUBLESHOOTING Guide latest.pptx
F5 LTM TROUBLESHOOTING Guide latest.pptx
 
一比一原版UVM毕业证佛蒙特大学毕业证成绩单如何办理
一比一原版UVM毕业证佛蒙特大学毕业证成绩单如何办理一比一原版UVM毕业证佛蒙特大学毕业证成绩单如何办理
一比一原版UVM毕业证佛蒙特大学毕业证成绩单如何办理
 
Matrix Methods.pptxbbbbbbbbbbbbbbbbbbbbb
Matrix Methods.pptxbbbbbbbbbbbbbbbbbbbbbMatrix Methods.pptxbbbbbbbbbbbbbbbbbbbbb
Matrix Methods.pptxbbbbbbbbbbbbbbbbbbbbb
 
China Die Casting Manufacturer & Supplier - Bian Diecast
China Die Casting Manufacturer & Supplier - Bian DiecastChina Die Casting Manufacturer & Supplier - Bian Diecast
China Die Casting Manufacturer & Supplier - Bian Diecast
 
一比一原版SDSU毕业证圣地亚哥州立大学毕业证成绩单如何办理
一比一原版SDSU毕业证圣地亚哥州立大学毕业证成绩单如何办理一比一原版SDSU毕业证圣地亚哥州立大学毕业证成绩单如何办理
一比一原版SDSU毕业证圣地亚哥州立大学毕业证成绩单如何办理
 
一比一原版AIS毕业证成绩单如何办理
一比一原版AIS毕业证成绩单如何办理一比一原版AIS毕业证成绩单如何办理
一比一原版AIS毕业证成绩单如何办理
 
一比一原版UBC毕业证成绩单如何办理
一比一原版UBC毕业证成绩单如何办理一比一原版UBC毕业证成绩单如何办理
一比一原版UBC毕业证成绩单如何办理
 
Aluminum Die Casting Manufacturers in China - BIAN Diecast
Aluminum Die Casting Manufacturers in China - BIAN DiecastAluminum Die Casting Manufacturers in China - BIAN Diecast
Aluminum Die Casting Manufacturers in China - BIAN Diecast
 

IoT with Arduino

  • 1. Internet of Things Workshop with Arduino This work by http://tamberg.org/ is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. A CC licensed workshop by @tamberg, first held 07.07.2012 at SGMK MechArtLab Zürich, Switzerland, in collaboration with Zürich IoT Meetup, Perey Research & Consulting, Thomas Brühlmann and SGMK.
  • 2. Internet Computers, connected through Internet protocols Display or manipulate documents http://blog.com/2011-09-15/todays-post.html
  • 3. Internet of Things (IoT) Computers, sensors and actuators connected through Internet protocols Measure or manipulate physical properties http://e-home.com/tamberg/kitchen/light
  • 6. IoT hardware Any Internet-connected computer with an interface to the real world (sensors, actuators) Small => can be embedded into things Small computer = microcontroller (or board), e.g. Arduino, Netduino Plus, BeagleBone, … Note: connecting your board to the Internet via a desktop PC and USB is also fine, just a bit overkill
  • 7. IoT hardware http://arduino.cc/ http://netduino.com/netduhttp://beagleboard.org/bone Note: Thanks to TCP/IP & HTTP, any client can talk to any service, no matter which hardware you choose
  • 8. IoT infrastructure services Thingspeak and Xively to store and use sensor measurements e.g. https://thingspeak.com/channels/9 Twitter allows objects to talk to humans or receive commands e.g. @twrbrdg_itself (f.k.a. @towerbridge) Yaler enables remote access to Internet-connected devices e.g. http://try.yaler.net/~arduino/led (Disclosure: I’m a founder) Zapier and IFTTT allow mash-ups of Webservices e.g. http://goo.gl/7Y8a7z
  • 9. Just a beginning Reactive buildings, flying / crawling IoT devices, underused devices selling themselves on Ebay… Connected products become service avatars, or “everything becomes a service” (e.g. car sharing, home sharing, shoe sharing) “Once it’s here it will no longer be called the Internet of Things” Open IoT Assembly 2012
  • 10. Topics of this workshop Getting started (setup and programming of IoT hardware) Measuring and manipulating (physical computing: sensors and actuators) Connecting your device to the Internet (IoT: monitoring sensors, controlling actuators) Mash-ups with Web-enabled devices (together, if time permits) How the Internet works under the hood
  • 11. Hands on Broad range of topics => learn by doing Copy&paste examples, make 'em work for you, https://bitbucket.org/tamberg/iotworkshop/get/tip.zip Focus on end-to-end results, not details Google, help each other, ask us
  • 12. Note: Once it has been programmed, your board can run on its own, without another computer Getting started The IDE (Integrated Development Environment) allows you to program your board, i.e. “make it do something new” You edit a program on your computer, then upload it to your board where it’s stored in the program memory (flash) and executed in RAM
  • 13. Getting started with Arduino To install the Arduino IDE and connect your Arduino board to your computer via USB, see http://arduino.cc/en/Guide/MacOSX or http://arduino.cc/en/Guide/Windows or http://arduino.cc/playground/Learning/Linux
  • 15. Measuring and manipulating IoT hardware has an interface to the real world GPIO (General Purpose Input/Output) pins Measure: read sensor value from input pin Manipulate: write actuator value to output pin Inputs and outputs can be digital or analog
  • 16. The resistor Resistors are the workhorse of electronics Resistance is measured in Ω (Ohm) and adds up in series; a resistors orientation doesn’t matter A resistors Ω value is color-coded right on it Note: color codes are great, but it’s easier to use a multi-meter if you’ve got one, and just measure Ω
  • 17. The LED The LED (Light Emitting Diode) is a simple, digital actuator LEDs have a short leg (-) and a long leg (+) and it matters how they are oriented in a circuit To prevent damage, LEDs are used together with a 1KΩ resistor (or anything from 300Ω to 2KΩ) + - + -Anode Cathode
  • 18. The breadboard A breadboard lets you wire electronic components without any soldering Its holes are connected “under the hood” as shown here
  • 19. Wiring a LED with Arduino The long leg of the LED is connected to pin 13, the short leg to ground (GND) Note: the additional 1K Ω resistor should be used to prevent damage to the pins / LED if it’s reversed The Ethernet Shield is not needed here +
  • 20. HIGH = digital 1 (5V) means LED is on, LOW = digital 0 (0V) means LED is off Set ledPin as wired in your LED circuit Digital output with Arduino int ledPin = 13; void setup () { pinMode(ledPin, OUTPUT); } void loop () { digitalWrite(ledPin, HIGH); delay(500); // wait 500ms digitalWrite(ledPin, LOW); delay(500); } Note: blinking a LED is the Hello World of embedded software
  • 21. Actuator bonus stage Try a switched power outlet instead of a LED (black wire = GND) Use a multicolor LED with the breadboard, as in http://www.ladyada.net/learn/arduino/lesson3.html Or solder resistors to a multicolor LED, as in http://www.instructables.com/id/Arduino-Web-LED/
  • 22. A switch is a simple, digital sensor Switches come in different forms, but all of them in some way open or close a gap in a wire The pushbutton switch has four legs for easier mounting, but only two of them are needed Note: you can also easily build your own switches, for inspiration see e.g. http://vimeo.com/2286673 The switch
  • 23. Wiring a switch with Arduino Pushbutton switch 10K Ω resistor 5V GND D2 (max input 5V!) Note: the resistor in this setup is called pull-down ‘cause it pulls the pin voltage down to GND (0V) if the switch is open
  • 24. Digital input with Arduino int sensorPin = 2; // e.g. button switch void setup () { Serial.begin(9600); // setup log pinMode(sensorPin, INPUT); } void loop () { int sensorValue = digitalRead(sensorPin); Serial.println(sensorValue); // log 0 or 1 } Or run Arduino IDE > File > Examples > Digital > Button for an example of how to switch an LED Open the Arduino IDE serial monitor to see log output
  • 25. Photoresistor (LDR) A photoresistor or LDR (light dependent resistor) is a resistor whose resistance depends on light intensity An LDR can be used as a simple, analog sensor The orientation of an LDR does not matter
  • 26. Wiring an LDR with Arduino Photoresistor (LDR) 10K Ω resistor 5V GND A0 Note: this setup is a voltage-divider, as the 5V total voltage is divided between LDR and resistor to keep 0V < A0 < 2.5V
  • 27. int sensorPin = A0; // e.g. LDR void setup () { Serial.begin(9600); // setup log } void loop () { int sensorValue = analogRead(sensorPin); Serial.println(sensorValue); // log value } Analog input with Arduino Open the Arduino IDE serial monitor to see log output Note: use e.g. Excel to visualize values over time
  • 28. Sensor bonus stage Switch the LED depending on analog input Read analog values from a bathroom scale Or use sensors with other wire protocols, e.g. i2c
  • 29. Connecting to the Internet
  • 30. Note: in this workshop we focus on Ethernet and Wi-Fi Connecting to the Internet Ethernet (built-in or shield), plug it in anywhere Wi-Fi (module), configured once per location 3G (module), configured once, easy to use Bluetooth/BLE (module), via 3G/Wi-Fi of phone ZigBee (module), via ZigBee gateway USB (built-in), via desktop computer
  • 31. Wiring CC3000 Wi-Fi with Arduino CC3000 VIN to 5V GND to GND CLK to D13, MISO to D12, MOSI to D11, CS to D10, VBEN to D5, IRQ to D3 Note: make sure to use a reliable power source, e.g. plug the Arduino via USB or use a LiPo battery
  • 32. Note: open the serial monitor window to see the log http://learn.adafruit.com/adafruit-cc3000-wifi/cc300 File > Examples > Adafruit_CC3000 > WebClient #define WLAN_SSID "..." // set your network #define WLAN_PASS "..." // set your password Using CC3000 Wi-Fi with Arduino
  • 33. Note: please ask for assistance to get a unique address Add an Ethernet shield to the Arduino, plug it in File > Examples > Ethernet > WebClient byte mac[] = { ... }; // set a unique MAC address IPAddress ip(...); // set a local, unique IP address Using Ethernet with Arduino
  • 35. Monitoring sensors Devices read (and cache) sensor data Devices push data to a service with POST, PUT Some services pull data from devices with GET Service stores measurements, to be consumed by humans or computers (incl. other devices)
  • 36. Pachube (now Xively) The Pachube (now Xively) service lets you store, monitor and share sensor data in open formats PUT /v2/feeds/<your feed id>.csv HTTP/1.1rn Host: api.xively.comrn X-ApiKey: <your API key>rn Content-Length: <content length>rn rn <sensor name>,<sensor value> GET /v2/feeds/<feed id>.json HTTP/1.1rn Host and X-ApiKey as above…rnrn Note: please visit http://xively.com/ to sign up, create a feed with a data stream per sensor and get an API key
  • 37. Pachube with Arduino + Ethernet Use Xively’s template or open Arduino IDE > Examples > Ethernet > PachubeClient Check MAC, IP, FEED ID, API KEY and the data stream’s name Analog input: LDR on A0 http://xively.com/feeds/<feed-id> Note: to send data to xively.com make sure your Arduino is connected to the Internet Open the Arduino IDE serial monitor to see log output
  • 38. Pachube with Arduino + CC3000 To connect an Arduino to Pachube (now Xively) follow the steps in http://learn.adafruit.com/adafruit-cc3000-wifi-and-x
  • 40. Controlling actuators Service offers UI or API to control actuators Device polls service for control data with GET Or, service pushes control data to device with POST or PUT Device writes control data to actuators
  • 41. Web service with Arduino https://bitbucket.org/tamberg/iotworkshop/raw/e1 Please change the MAC address, wait for DHCP to assign an IP and visit the URL displayed in the log Make sure to add an EthernetShield to your Arduino & plug it into a LAN Open the serial monitor window to see log output Note: your Arduino is now a (local) Web server
  • 42. The Yaler relay provides a public and stable URL to access Web services behind a firewall or NAT Yaler Note: please visit http://yaler.net/ and sign up to get your relay domain and API key (free)
  • 43. For remote Web access with Ethernet, see https://yaler.net/arduino For the WiFi shield, see https://yaler.net/arduino-wifi And for the CC3000, see https://yaler.net/arduino-cc3000 Yaler with Arduino
  • 45. Mash-ups A mash-up combines two or more Web services Once devices have APIs, they become scriptable Logic moves out of device, into the Cloud, e.g. Web-enabled LED + Yahoo Weather API = ambient weather notification Note: the IoT enables physical mash-ups of things
  • 46. Mash-ups HTML combining data from multiple APIs on the Web client, using Javascript XMLHttpRequest to get data (in JSONP, to bypass same origin policy) Scripting (C#, Python, Go, …) glue code hosted on a desktop or in the cloud (EC2, AppEngine …) Mash-up platforms (IFTTT.com, Zapier.com, …) Note: open data formats and APIs enable mash-ups
  • 47. If you wonder what TCP/IP, HTTP or DNS means - or care about the difference between protocol, data format and API, read on... How the Internet works
  • 48. Note: protocols are layered, e.g. HTTP messages transported in TCP/IP packets sent over Ethernet Protocols Parties need to agree on how to exchange data (communicating = exchanging data according to a protocol) e.g. Ethernet links local computers physically, TCP/IP is the foundation of the Internet, and HTTP is the protocol that enables the Web
  • 49. TCP/IP IP (Internet Protocol) deals with host addressing (each host has an IP address) and packet routing TCP (Transmission Control Protocol): connection oriented, reliable data stream (packets in-order, errors corrected, duplicates removed, discarded or lost packets resent) from client to server Note: DHCP assigns an IP address to your device which is mapped to the device’s MAC address
  • 50. HTTP (Hypertext Transfer Protocol) enables the distributed, collaborative system we call the Web The client sends an HTTP request, the server replies with a response HTTP Message = Request|Response Request = (GET|POST|…) Path CRLF *(Header CRLF) CRLF Body Response = "HTTP/1.1" (200|404|…) CRLF *(Header CRLF) CRLF Body CRLF = "rn" (Read the spec: http://tools.ietf.org/html/rfc2616) HTTP Note: HTTP is human readable, i.e. it’s easy to debug
  • 51. The URI (Uniform Resource Identifier) is a string of characters used to identify a resource http://blog.tamberg.org/2011-10-17/side-projects.html (Read the spec: http://tools.ietf.org/html/rfc3986) QR codes, NFC tags can contain a machine readable URI IoT: URIs can refer to things or their physical properties URIs Note: good URIs can be hand-written on a napkin and re-typed elsewhere, without any ambiguity authority = host [‘:’ port] pathscheme
  • 52. DNS DNS (Domain Name System) maps Internet domain names to one or more IP addresses Try it in your desktop computer terminal, e.g. $ nslookup google.com 173.194.35.6 … Note: if your device doesn’t support DNS you can connect to the server’s IP, but beware of changes
  • 53. Data formats Parties need to agree on what is valid content (parsing = reading individual content tokens) CSV: easy to parse, suited for tables, old school JSON: easy to parse, de facto standard XML: used by many services, W3C standard Semi-structured text, e.g. Twitter’s @user, #tag Binary formats, e.g. PNG, MP3, …
  • 54. RSS In addition to generic data formats like CSV, JSON, XML there are refinements that add semantics to the document RSS (or Atom) is a data format for lists of items Invented for blogs, RSS is great for data feeds Note: RSS documents are also XML documents, but not all XML documents contain valid RSS
  • 55. HTML HTML (Hypertext Markup Language) is a data format describing how a Web page should be structured and displayed Look at the HTML (and Javascript) code of any Web page with "view source" in your browser Note: HTML documents are not always valid XML documents, but Web browsers are very forgiving
  • 56. APIs An API (Application Programming Interface), is an agreement between clients and providers of a service on how to access a service, how to get data out of it or put data into it The UI (User Interface) of a service is made for humans, the API is made for other computers Note: good APIs are documented or self-explanatory
  • 57. REST REST (Representational State Transfer) is a style of designing an API so that it is easy to use REST APIs use HTTP methods (GET, PUT, POST, DELETE) to let you perform actions on resources REST APIs can be explored by following links Note: good Web UIs are often built following the same principles, therefore REST APIs feel natural
  • 58. Sharing network connections Most newer computer operating systems allow sharing network connections with other devices Mac OSX: System Preferences > Sharing > Internet Sharing > From Wi-Fi to Ethernet Windows 7: Control Panel > View network status and tasks > Change adapter settings > right click Wireless Network Connection > Properties > Sharing > [x] Allow other network users to connect … > Local Area Connection Note: helpful for demos, if there’s Wi-Fi but no LAN
  • 59. Debugging Web services Chrome > Inspect Element > Network, Console cURL for HTTP requests (http://curl.haxx.se/) Requestbin for Webhooks (http://requestb.in/) Fiddler (http://www.fiddler2.com/) WireShark (http://www.wireshark.org/)
  • 60. Debugging USB or Bluetooth On Mac OSX and Linux list connected devices with ls /dev/tty* display output with screen /dev/tty... 9600 On Windows list devices, fix drivers with devmgmt.msc display serial output with PuTTY
  • 61. Energy Wall socket, Power over Ethernet (w/ adapters), batteries (direct or Minty Boost USB charger), LiPo batteries (also shields), solar panels, … Low power: lets hardware sleep to save energy Future: new battery technologies, ultra low power hardware, energy harvesting Note: Moore’s law does not apply to batteries
  • 62. Note: MechArtLab Zürich has an OpenLab on Tuesdays Learning more Electronics: Ohm’s law, Kirchhoff’s current and voltage law (KCL & KVL), Make: Electronics by Charles Platt Interaction Design: Smart Things by Mike Kuniavsky, Emoticomp blog post by Ben Bashford, BERG blog Physical Computing: Making Things Talk by Tom Igoe REST: RESTful Web Services by Leonard Richardson Programming: read other people’s code IoT: Designing the Internet of Things by Adrian McEwen and Hakim Cassimally, Postscapes.com, IoTList.co
  • 63. Reducing E-waste Tired of hacking? Donate your hardware to a local hackerspace… e.g. MechArtLab Hohlstrasse 52 8004 Zürich

Editor's Notes

  1. Arduino Gadgeteer Beagle Bone … Aim: require no previous experience (because almost nobody understands IoT end-to-end) use simple language be resourceful provide links for further reading
  2. Das Internet der Dinge entsteht, wenn Internet-verbundene Computer mit Sensoren und Aktuatoren ausgestattet werden. Statt virtuelle Ressourcen, wie bisher im Web, werden damit physikalische Eigenschaften gemessen und manipuliert.
  3. Ein paar Beispiele Internet-verbundener Objekte (Produkte und DIY Projekte)
  4. Hier ein Internet of Things Referenzmodell Das Modell erklärt, wie solche Produkte funktionieren: Ein Gerät oder Objekt mit Sensoren und Aktuatoren erlaubt eine direkte, physische Interaktion. Da es zudem per Internet mit einem Server verbunden ist, kann ich auch virtuell damit interagieren, mittels Browser oder App - lokal, oder aus der Ferne. &amp;gt;&amp;gt; There are many such models. This one helps us to understand the previous examples. Computer (incl. keyboard / mouse / display) is considered separately (not as an IoT device). Device can have only sensor or only actuator Device / thing can be same or device embedded in otherwise dumb thing. User can be local or remote with respect to device. There can be many devices / many users. Devices can be connected to other devices rather than users. HTTP / TCP/IP is the lingua franca, decouples devices from each other and servers / services. How exactly a device is connected to the Internet (via Wifi, LAN, …) is not shown here. Draw the model on a whiteboard and refer to it during the workshop
  5. Internet of Things Hardware Jeder Internet-verbundene Computer mit Schnittstelle zur realen Welt (Sensoren / Aktuatoren) Klein =&amp;gt; Kann in Dinge eingebettet werden Kleine Computer heissen auch Mikrocontroller (oder Board), z.B. Arduino, Netduino Plus oder BeagleBone Bemerkung: solche Boards können auch via USB und einen Desktop PC mit dem Internet vebrunden werden. Das ist OK, aber es geht auch ohne.
  6. Bemerkung: Dank TCP/IP und HTTP als gemeinsame Sprache kann jeder Client mit jedem Server kommunizieren, egal welche Hardware man wählt.
  7. Internet of Things Infrastruktur Thingspeak und Xively zum Speichern von Sensor-Messwerten Twitter erlaubt Objekten mit Menschen zu sprechen oder Kommandos zu empfangen Yaler erlaubt den Fernzugriff auf Internet-verbundene Geräte (Offenlegung: Ich bin ein Gründer) Zapier und IFTTT erlauben &amp;quot;mash-ups&amp;quot; von Web Services, d.h. Verknüpfen von Online-Diensten
  8. Nur ein Anfang Reaktive Gebäude, fliegende / krabbelnde IoT Geräte, zu wenig benutzte Geräte versteigern sich selbst auf Ebay... Internet-verbundene Produkte werden &amp;quot;Service-Avatars&amp;quot;, d.h. Stellvertreter für Dienstleistungen, oder alles wird zum Service (z.B. Car-Sharing wie Mobility, Home-Sharing wie Airbnb oder Schuh-Sharing) &amp;quot;Wenn es mal hier ist, heisst es nicht mehr Internet of Things&amp;quot; &amp;gt;&amp;gt; Mike Kuniavsky Sharing: Quote from OpenIoT Assembly 2012; car: zippcar,… home: airbnb, shoes: … (Mike K.) Flying…: Quote from OpenIoT Assembly 2012 Toaster: Usman Haque
  9. Themen dieses Workshops Erste Schritte (Einrichten und programmieren von IoT Hardware) Messen und Manipulieren (Physical Computing: Sensoren und Aktuatoren) Verbinden von Geräten mit dem Internet (IoT: Sensoren überwachen, Aktuatoren fernsteuern) Mash-ups mit Internet-verbundenen Geräten (zusammen, falls genug Zeit bleibt) Wie das Internet funktioniert
  10. Hands on Viele Themen =&amp;gt; Lernen durch selbermachen Cop&amp;paste aus Beispielen, ändern, bis es läuft Auf Endresultat fokussieren, nicht Details Googeln, einander helfen, und fragen
  11. Erste Schritte Die Entwicklungsumgebung erlaubt es ein Board zu programmieren, d.h. &amp;quot;dem Gerät etwas neues beizubringen&amp;quot; Man editiert ein Programm auf dem Computer, lädt das Programm auf das Board. Dort wird es im Programmspeicher (Flash) abgelegt und im RAM ausgeführt. Bemerkung: Wenn es einmal programmiert ist, funktioniert das Board allein, ohne den Desktop-Computer.
  12. Erste Schritte mit Arduino Um die Entwicklungsumgebung zu installieren und das Arduino Board mit dem Computer zu verbinden, siehe die folgenden Links.
  13. Messen und manipulieren
  14. Messen und manipulieren IoT Hardware hat immer eine Schnittstelle zur Realität GPIO (General Purpose Input/Output) Pins Messen: Sensor-Messwert vom Input-Pin lesen Manipulieren: Aktuator Sollwert auf einen Output-Pin schreiben Inputs und Outputs önnen digital oder analog sein
  15. Der Widerstand Widerstand wird in Ohm gemessen. Widerstände in Serie können addiert werden. Die Orientierung eines Widerstandes ist egal. Der Wert eines Widerstands ist mit einem Farbcode gekennzeichnet. Bemerkung: Farbcodes sind super, aber es ist noch einfacher ein Multimeter zu verwenden um den Widerstand auszumessen.
  16. Die LED Eine LED (Leuchtdiode) ist ein einfacher digitaler Aktuator. LEDs habe ein kurzes Bein (-) und ein langes (+) und es kommt drauf an, wie eine LED in die Schaltung eingebaut wird. Um Schäden an der LED zu verhindern, wird ein Widerstand vorgeschaltet (irgendwas zwischen 300 Ohm und 2 Kilo-Ohm).
  17. Das Breadboard Ein Breadboard erlaubt es elektronische Komponenten ohne Löten zusammenzustecken Die Löcher sind unterirdisch durch Metall verbunden, wie hier angedeutet
  18. Verdrahten einer LED mit Arduino Bemerkung: der zusätzliche 1K Ohm Widerstand sollte benutzt werden um Schäden an Pins / LED zu vermeiden, falls sie verkehrt eingesteckt wird. Das längere Bein der LED ist mit Pin 13 verbunden, das kürzere mit Erde, oder Ground (GND) Der Ethernet shield wird hier nicht benötigt
  19. Digitaler Output mit Arduino Bemerkung: die blinkende LED ist das &amp;quot;Hello World&amp;quot; Programm der embedded Sofware Der LED Pin sollte entsprechend der Verdrahtung gesetzt werden, in der Schaltung HIGH bedeutet die LED ist an, LOW bedeutet die LED ist aus.
  20. Der Schalter Ein Schalter ist ein einfacher, digitaler Sensor Schalter gibt es in verschiedenen Formen, aber alle davon öffnen und schliessen eine Lücke in einem Kabel. Der Druckknopf hat vier Beine um die Montage zu vereinfachen, aber nur zwei davon werden benötigt Bemerkung: Schalter kann man auch einfach selber bauen, siehe z.B. diesen Link.
  21. Schalter Verkabeln mit Arduino Bemerkung: der Widerstand hier wird auch pull-down Widerstand genannt, weil er die Pin Spannung auf Ground (0V) runterzieht, wenn der Schalter offen ist.
  22. Digitaler Input mit Arduino Das Serial Monitor Fenster in der Arduino Entwicklungsumgebung zeigt den Log Output an Für ein Beispiel das eine LED ein- und ausschaltet, siehe Datei &amp;gt; Beispiele &amp;gt; Digital &amp;gt; Button
  23. Fotowiderstand Ein Fotowiderstand (LDR, Licht-abhängiger Widerstand) ist ein Widerstand dessen Wert von der einfallenden Lichtstärke abhängt Ein Fotowiderstand kann als einfacher analoger Sensor benutzt werden Die Orientierung eines LDR in der Schaltung ist egal
  24. LDR verkabeln mit Arduino Bemerkung: diese Schaltung heisst auch Spannungsteiler, weil die 5V Spannung zwischen dem LDR und einem Widerstanf aufgeteilt werden, damit A0 zwischen 0 und 2.5V bleibt
  25. Analoger Input mit Arduino Das Serial Monitor Fenster in der Arduino Entwicklungsumgebung zeigt den Log Output an Bemerkung: eine Reihe von Messwerten kann z.B. mit Excel einfach visualisiert werden
  26. Verbinden mit dem Internet Ethernet (eingebaut oder als Shield), überall einfach einstecken Wi-Fi (Modul), muss einmal pro Location konfiguriert werden 3G (Modul), muss ein einziges mal konfiguriert werden, einfach zu benutzen Bluetooth / Bluetooth Low Energy (BLE), via 3G oder Wi-Fi eines Smartphones ZigBee (Modul), via ZigBee Gateway USB (eingebaut), via Dekstop Computer Bemerkung: In diesem Workshop fokussieren wir auf Ethernet und Wi-Fi
  27. Verkabeln von CC3000 Wi-Fi mit Arduino Bemerkung: sicherstellen, dass eine zuverlässige Stromquelle benutzt wird, z.B. via USB oder mit einem LiPo Akku
  28. Benutzung des CC3000 Wi-Fi mit Arduino Bemerkung: Das Serial Monitor Fenster in der Arduino Entwicklungsumgebung zeigt den Log Output an &amp;gt;&amp;gt; http://learn.adafruit.com/adafruit-cc3000-wifi/cc3000-library-software http://learn.adafruit.com/adafruit-cc3000-wifi/buildtest http://learn.adafruit.com/adafruit-cc3000-wifi/webclient
  29. Benutzung von Ethernet mit Arduino Ethernet-Shield auf den Arduino stecken Datei &amp;gt; Beispiele &amp;gt; Ethernet &amp;gt; WebClient Bemerkung: Bitte uns fragen um eine MAC und IP Adresse zu bekommen &amp;gt;&amp;gt; http://learn.adafruit.com/adafruit-cc3000-wifi/cc3000-library-software http://learn.adafruit.com/adafruit-cc3000-wifi/buildtest http://learn.adafruit.com/adafruit-cc3000-wifi/webclient
  30. Sensoren überwachen
  31. Sensoren überwachen Gerät liest und speichert Sensor Daten Gerät pusht Daten auf eine online Platform mit POST, PUT Manche Services pullen (ziehen) Daten vom Gerät mit GET Platformspeichert Messwerte, die dann von Menschen oder anderen Computern (inkl. embedded Geräten) konsumiert werden &amp;gt;&amp;gt; Cosm: Supports push and pull, stores and renders content, knows format Twitter: Push only, doesn’t know anything about content format of Tweet
  32. Pachube (neu Xively) Der Dienst ermöglicht das Speichern, Anzeigen und Publizieren von Sensordaten in offenen Datenformaten Bemerkung: Bitte Xively.com besuchen um einen Account und API Key (Schlüssel) zu bekommen, der das Kreieren von Feeds ermölicht
  33. Pachube mit Arduino + Ethernet Xively bietet ein Programm Template, oder einfach in der Arduino IDE auf Beispiele &amp;gt; Ethernet &amp;gt; PachubeClient MAC, IP, FEED ID, API KEY und Feed Name einsetzen Das Serial Monitor Fenster in der Arduino Entwicklungsumgebung zeigt den Log Output an https://cosm.com/feeds/61114 http://learn.adafruit.com/adafruit-cc3000-wifi-and-xively https://api.cosm.com/v2/feeds/61114/datastreams/button.png?width=730&amp;height=100&amp;colour=%23f15a24&amp;duration=5minutes&amp;stroke_size=7&amp;scale=manual&amp;min=0&amp;max=1&amp;timezone=UTC
  34. Pachube mit Arduino + CC3000 Um den Arduino mit Pachube (neu Xively) zu verbinden, siehe Link
  35. Aktuatoren fernsteuern
  36. Aktuatoren fernsteuern Manche Platformen bieten eine Benutzerschnittstelle (User Interface, UI) oder eine Programmierschnittstelle (API) um Aktuatoren fernzusteuern Ein Gerät pollt den online Dienst um Kontrolldaten mit GET abzufragen Oder, der Dienst pusht Kontrolldaten zum Gerät mit POST oder PUT Das Gerät schreibt Kontrolldaten bzw. Sollwerte auf die Aktuatoren
  37. Web Service mit Arduino Bitte MAC Adresse ändern, warten, bis DHCP eine IP Adresse zugewiesen hat und die URL besuchen, die im Log angezeigt wird Dieses Beispiel erfordert einen Ethernet Shield auf dem Arduino, und ein eingestecktes LAN Kabel Bemerkung: der Arduino ist jetzt ein (lokaler) Web Server
  38. Yaler Das Yaler Relay ermöglicht den Fernzugriff auf Geräte hinter einem NAT Server oder Firwall, an einer öffentlichen, stabilen Adresse (URI). Bitte https://yaler.net/ besuchen, um einen Gratisaccount und API Key zu bekommen
  39. Yaler mit Arduino Falls ein Ethernet Shield verwendet wird, gibt&amp;apos;s auf https://yaler.net/arduino eine Anleitung zum Einschalten des Fernugriffs Das CC3000 Wi-Fi Modul wird noch nicht unterstützt
  40. Mash-ups
  41. Mash-ups Ein Mash-up kombiniert zwei oder mehr online Dienste Wenn Geräte einmal APIs haben, werden sie per Skript ansteuerbar Logik wander so aus dem Gerät raus, in die Cloud, z.B. Internet-verbundene LED + Yahoo Wetterdienst API = &amp;quot;Wetter-Anzeige&amp;quot; Objekt Bemerkung: Das IoT ermögliche physikalische Mash-ups
  42. Mash-ups HTML kombiniert Daten von mehreren APIs auf dem Web Client, mittels Javascript XMLHttpRequest (Daten im JSONP, um &amp;quot;Same Origin Policy&amp;quot; zu umgehen) Glue-code (Programm als Leim oder Kitt) Skripts kann auf einem Desktop Computer oder in der Cloud abgelegt werden Noch einfacher geht&amp;apos;s mit Mash-up Platfromen (IFTTT.com, Zapier.com, ...) Bemerkung: Offene Datenformate ermöglichen Mash-ups &amp;gt;&amp;gt; http://msdn.microsoft.com/en-us/library/system.net.webclient.headers.aspx (WebClient Headers) http://msdn.microsoft.com/en-us/library/d0d3595k.aspx (WebClient UploadString)
  43. Image Source : &amp;quot;Casting the Net&amp;quot;, page 56. See also The Computer Museum&amp;apos;s Timeline. http://personalpages.manchester.ac.uk/staff/m.dodge/cybergeography/atlas/historical.html
  44. http://www.websequencediagrams.com/ HTTP Browser\n(Client)-&amp;gt;Google\n(Server): GET /search?q=IoT\nHost: www.google.com Google\n(Server)--&amp;gt;Browser\n(Client): \nHTTP/ 1.1 200 OK\nContent-Length: ...\nHTML Content... Google\n(Server)--&amp;gt;Browser\n(Client): \n\n
  45. (UTF-8!)
  46. Platform knows vs. doesn’t care
  47. http://www.amazon.com/Restful-Web-Services-Leonard-Richardson/dp/0596529260
  48. Computer als Hotspot verwenden Die meisten neueren Computer erlauben es, die Netzwerkverbindung mit anderen Geräten zu teilen. Bemerkung: Nützlich für Demos, wenn es Wi-Fi hat, aber keine Kabelverbindung (LAN).
  49. http://hurl.it
  50. http://hurl.it
  51. http://learn.adafruit.com/low-power-wifi-datalogging/power-down-sleep
  52. http://journal.benbashford.com/post/2848763029