diy technology for the internet of things
DESCRIPTION
These are the slides for the presentation that I gave at ICMEAE in Cuernavaca, Mexico on November 20th, 2014. This includes an example using Spark Core.TRANSCRIPT
DIY Technology for the Internet of Things
Dr. Simon Monk
Simon Monk
• Full-‐;me Author -‐ Open Source Hardware and Electronics
Objec;ves
• What is the Internet of Things (IoT)? • Where is IoT going • Making IoT devices? • An example technology: the Spark Core
What is the Internet of Things?
• First there was the Internet – Websites serve knowledge – Browsers are the terminal nodes of the network
• Now the Internet of Things – IoT devices can be terminal nodes – Websites control hardware – Devices talk to users and other machines using the Internet
IoT Examples • Home automa;on – Smart thermostats (Nest and similar) – Ligh;ng, access control
• Automo;ve • Personal – Health and ac;vity monitoring (on your wrist) – Keeping an eye on distant loved-‐ones
• Sensor Networks – Radia;on monitoring following Fukushima disaster
• Energy Management – Smart appliances
Nest
• Smart Learning Thermostat
• WiFi enabled remote control from Smartphone app
• Nest account allows link to ‘The Cloud’
RunKeeper
• Uses Smartphone as IoT device but data stored in ‘The Cloud’
• Tracks running or cycling using GPS
Safecast • In response to Fukushima – Official informa;on inadequate – It filled the informa;on gap – Crowd-‐sourced solu;on in place reassuring people very quickly
• Hacker Space, OSH (Open Source Hardware) Design, Data CC 0 (Completely free to all)
• Watching the planet – Global warming, tsunami, magnetometry
Safecast Hardware
• Geiger Counters all sold out • Data logging Geiger Counter • HackerSpace First Genera;on
• Hang device out of car window (GPS)
• Arduino, off-‐the-‐shelf modules
Safecast So^ware
• Hardware no good unless data gathered and visualised.
Energy Management
• Smart Meters – Send usage data to server every few minutes – Eventually con;nuously variable energy pricing – Automa;c control of non ;me-‐cri;cal appliances • Run washing machine when demand low • Boost freezer to low temperature at low demand
Where is IoT Going?
• Gartner Report on IoT 2014 Predicts – 36.2% growth in 2015 – Home and Automo;ve will drive growth – Inexpensive devices are the biggest enabler of IoT takeup
Technology for IoT
• WiFi enabled Microcontrollers • Cellular modem technology
IoT on WiFi
• Problem
– WiFi is power hungry
• Solu;on
– Power Management of device (sleep when not needed)
IoT on WiFi
• Problem
– WiFi needs password to connect to LAN (Local Area Network)
• Solu;on
– One-‐;me configura;on
• Temporary WLAN run by device
IoT on WiFi
• On LAN communica;ng with Internet
• Send requests to IoT device from Internet (E.g. Open Door!)
• Allow IoT device to send data to cloud (E.g. Temperature is 20C)
IoT on WiFi (Security)
• Hacking gets physical! • An ahack on your actual home?
• Cloud Programming of IoT Device!
• Authen;ca;on Tokens • SSL
IoT on WiFi (Data Ownership)
• Physical Data Collected – E.g. Energy usage – Is the home empty? – Targeted marke;ng of products – The Cloud knows you too well? – Health data – Smart TV viewing habits
DIY IoT
• Arduino + WiFi shield – Looks old fasioned
• Arduino Yun – Expensive
• Spark Core – Designed for IoT
IoT with Spark Core
• WiFi • ARM Cortex M3 (72MHz) • 128kB Flash • USB2.0 • 12 bit ADC • USART, SPI & I2C • Breadboard Friendly • 18 I/O pins (3V) logic
IoT with Spark Core
• Configura;on Smartphone App
• USB Configura;on • Registers with Cloud • Built-‐in Firmware works with Smartphone App to control pins
• Program from the Cloud
IoT with Spark Core • Example Project – Buzzy Bee
Test Hardware
Custom Program
• Cloud IDE • Flash over Internet
• Arduino C • Func;ons and Variables
• REST interface
Test with curl
Make a Web Page (head) <html>!<head>!<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript" charset="utf-8"></script>!!<script>!var accessToken = "64a329ab1ddfaabc01838f744c0e5e243eee";!var url = "https://api.spark.io/v1/devices/55ff6b065075551487/buzz";!!function buzz()!{!
!$.post(url, {params: 1, access_token: accessToken });!} !!function noBuzz()!{!
!$.post(url, {params: 0, access_token: accessToken });!
} !</script>!</head>!!
Make a Web Page (body) <body>!<h1>Buzzy Bee</h1> !!<h2 onClick="buzz()">BUZZ</h2>!<h2 onClick="noBuzz()">NO BUZZ</h2>!</body>!</html>!
Try it Live!
• hhp://monkmakes.com/buzz.html
IoT with Spark Core • Example Project – Light Sensor • Hardware
IoT with Spark Core • Example Project – Light Sensor • So^ware int light = 0.0;!!void setup(){! Spark.variable("light", &light, INT);!}!!void loop() {! light = analogRead(lightSensorPin);!}!
IoT with Spark Core
IoT with Spark Core (Web Page) function getLight()!{!
!$.getJSON(url, gotResult);!!after()!
} !!function gotResult(result) !{!
!!!$("#light").html(result.result);!
}!!setInterval(getLight, 1000);!!!<h2 style="font-size:40pt;"id="light">-</h2>!
Try it Live!
• hhp://monkmakes.com/light.html
IoT Encapsulated
• Low cost Module • All WiFi wrapped up • Simplifies design and shortens product development ;mes
• Many products can benefit from adding IoT capability
Summary
• More and more devices are being connected to the Internet
• With low-‐cost modules that can act as a microcontroller with IoT almost for free, adding it to a product becomes feasible
• The Open Source movement is changing aptudes to who owns data – slowly
Contact
• Twiher: @simonmonk2 • Web: www.monkmakes.com • Email: [email protected]
• Blog: www.doctormonk.com