25
Internet of Things (IoT) Machine-to-Machine (M2M) BarCamp Melbourne - Sunday 29th July 2012 Andy Gelme - @geekscape http://geekscape.org Connected Community HackerSpace (Melbourne) http://hackmelbourne.org Sunday, 29 July 12

BarCamp Melbourne 2012: Internet of Things

Embed Size (px)

Citation preview

Page 1: BarCamp Melbourne 2012: Internet of Things

Internet of Things (IoT)Machine-to-Machine (M2M)

BarCamp Melbourne - Sunday 29th July 2012

Andy Gelme - @geekscapehttp://geekscape.org

Connected Community HackerSpace (Melbourne)http://hackmelbourne.org

Sunday, 29 July 12

Page 2: BarCamp Melbourne 2012: Internet of Things

The future of IoT / M2M ?

• “Those who cannot remember the past are condemned to repeat it” - George Santayana

• “I skate to where the puck is going to be, not where it has been” - Wayne Gretsky (The Great One)

Sunday, 29 July 12

Page 3: BarCamp Melbourne 2012: Internet of Things

1973• Carl Hewitt (MIT): Actor model (asynchronous)

• Actors send messages to other Actors

• Actors can create new Actors

• Specific behaviour for each message received

• Guy Steele and Gerry Sussman: Scheme language

• Invented to understand the Actor model !

• Invented Call-By-Continuation

• Erlang created at Ericsson in 1986

Sunday, 29 July 12

Page 4: BarCamp Melbourne 2012: Internet of Things

Mid 1970’s• Xerox Parc (Palo Alto)

• Home Brew Computer Club (Menlo Park)

• Compare with HackerSpaces (Everywhere)

• Dawn of microprocessors

• Apple I ... now: iStuff

• Tandy TRS-80

• BBC micro ... now: ARM (processor in most phones)

• Compare with Raspberry Pi

Sunday, 29 July 12

Page 5: BarCamp Melbourne 2012: Internet of Things

8-bit micro processors vs controllers

• 1970s: 4004, SC/MP, 2650, 8080, Z-80, 6800, 6502, 6809 ...

• Clock: 1.0 to 4.0 MHz Memory: 1 Kb to 64 Kb RAM

• Storage: Cassette tape (if you were lucky)

• Networking: None (usually)

• Cost: Expensive Development environment: Challenging

• 2000s: Arduino (ARM ATMega328) ... System On a Chip ...

• Clock: 16.0 MHz Memory: 32 Kb Flash and 2 Kb RAM

• Storage: SD card (if required)

• Networking: USB, Ethernet, WiFi, Bluetooth, Mesh 802.15.4, ...

• Cost: Cheap Development environment: Easy

Sunday, 29 July 12

Page 6: BarCamp Melbourne 2012: Internet of Things

1980s

• Internet is still quite small (teenage years !)

• WWW / HTTP not for another decade (1990s)

• “The value of a network is proportional to the square of the number of connected devices / users” - Robert Metcalfe (Ethernet) and later George Gilder

• “The network is the computer” - Sun Microsystems

Sunday, 29 July 12

Page 7: BarCamp Melbourne 2012: Internet of Things

2000-01-01

• The day after Y2K ... post-apocalyptic computing :)

• WiFi for very early adopters

• Mobile phones: Resemble a brick !

• Social networking: Friendstar 2002, MySpace 2003 ...

Sunday, 29 July 12

Page 8: BarCamp Melbourne 2012: Internet of Things

MeemPlex (2000 - 201?)

Sunday, 29 July 12

Page 9: BarCamp Melbourne 2012: Internet of Things

2007 / 2008

• 2007-04-13

• Powered up my first Arduino NG

• 2008-02-23

• 2nd BarCamp Melbourne 2008 at ThoughtWorks

Sunday, 29 July 12

Page 10: BarCamp Melbourne 2012: Internet of Things

2012-07-29• Internet is now very large and diverse in all ways

• WWW / HTTP is the dominant protocol

• Designed for web pages / documents

• Request-Response (synchronous)

• ... not good for embedded devices :(

• Metcalfe’s law applied to ...

• Billions of smart phones are in the mainstream

• Social networking is mainstream

• Open Source Hardware Design !Sunday, 29 July 12

Page 11: BarCamp Melbourne 2012: Internet of Things

Now what ?

• “The future is here ... it’s just not evenly distributed” - William Gibson (1993)

Sunday, 29 July 12

Page 12: BarCamp Melbourne 2012: Internet of Things

Connecting the real world• The networking infrastructure is in place ...

• Except IPv6 :(

• Choice: Ethernet, WiFi, Bluetooth, IR, 433 MHz

• Virtual servers on the WAN (aka “the cloud”)

• Good cheap LAN servers: OpenWRT, Raspberry Pi

• Smart phones and tablets have lots of sensors !

• GPS, accelerometer, compass, light,

• They also make good user interfaces for devices :)

Sunday, 29 July 12

Page 13: BarCamp Melbourne 2012: Internet of Things

8 fallacies of distributing computing1. The network is reliable

2. Latency is zero

3. Bandwidth is infinite

4. The network is secure

5. Topology doesn’t change

6. There is one administrator

7. Transport cost is zero

8. The network is homogeneous- Peter Deutsch (1994) and James Gosling (1997)

Sunday, 29 July 12

Page 14: BarCamp Melbourne 2012: Internet of Things

Issues

• Many different development environments ...

• Arduino: IDE, C / C++, libraries, hardware

• Android: Eclipse, Java, class libraries, UI, networking

• iOS: XCode, Objective-C, libraries, UI, networking

• Web browser UI: HTML5, JavaScript, CSS

• Servers: Too many choices to mention

• Need to solve: Messaging (glue), Configuration, User Interface, Security, Failure (device or network)

Sunday, 29 July 12

Page 15: BarCamp Melbourne 2012: Internet of Things

Messaging (glue)• Devices require asynchronous events

• Synchronous request-response is a poor choice

• Can’t wait for something that may never complete

• Consider MQTT http://mqtt.org

• Publish-subscribe and topic based

• Very light-weight, good for embedded devices

• Client libraries available for many languages

Sunday, 29 July 12

Page 16: BarCamp Melbourne 2012: Internet of Things

MQTT examplehttp://github.com/geekscape/mqtt_lua

mqtt_client = MQTT.client.create(host, port, callback)mqtt_client:connect(client_id)mqtt_client:subscribe(‘topic’)while (true) do mqtt_client:handler() mqtt_client:publish(‘topic’, ‘message’)end

function callback(topic, message) print(‘topic: ‘ .. topic .. ‘, message: ‘ .. message)end

Sunday, 29 July 12

Page 17: BarCamp Melbourne 2012: Internet of Things

Configuration

• Managing lots (hundreds, thousands, millions, ...) of devices without any direct user interface is hard

• Maintain network / device configuration on local server(s) ... don’t hard code in the source !

• Distribute configuration via MQTT topics

• Self-describing devices discover their configuration and save to EEPROM

Sunday, 29 July 12

Page 18: BarCamp Melbourne 2012: Internet of Things

User interface• Having to develop N different user interfaces is

painful

• Having to change all those user interfaces every time a new device type joins your network is even more painful

• Make dynamic user interfaces incorporate an MQTT client and be driven by the same MQTT topics as the device configuration

Sunday, 29 July 12

Page 19: BarCamp Melbourne 2012: Internet of Things

Security• Obvious problems ...

• Recent: Onity hotel locks ... completely insecure

• SCADA systems connected to Internet

• How many Arduinos using secure networking ?

• IcedTea (Tiny Encryption Algorithm: 1994)

• Make sure you use XXTEA (1998)

• Vulnerable to chosen-plaintext attack

Sunday, 29 July 12

Page 20: BarCamp Melbourne 2012: Internet of Things

Failure (device or network)• A most difficult problem ...

• Network partition ... partial failure

• Eventual consistency ...

• Relativity for computing :)

• Never have exactly the same view of the world

• Leasing: Never hold on to resources forever

• Distributed garbage collection

• MQTT defines a “Last will and testament”

Sunday, 29 July 12

Page 21: BarCamp Melbourne 2012: Internet of Things

802.15.4 mesh network / IPv6

• Device needs to be cheap, sufficient memory and incorporate the radio

• ATMega128RFA01 ... Arduino compatible, 128K Flash, built-in 802.15.4 and US$5.40 in volume

• Networking stack: Atmel MAC

• Operating environment ...

• Arduino: Libraries, but no operating system or tasks

• Contiki: Light-weight O.S with proto-threads

Sunday, 29 July 12

Page 22: BarCamp Melbourne 2012: Internet of Things

Invitation

• Melbourne HackerSpace: http://hackmelbourne

• Individual and group projects, workshops, etc

• Scope for running your own group or events

• Please join our email list (see web-site for details)

• Melbourne Raspberry Jam: See http://meetup.com

• Next Saturday from 1:30 pm at the HackerSpace

Sunday, 29 July 12

Page 23: BarCamp Melbourne 2012: Internet of Things

Resouces

• This presentation: http://slideshare.net/geekscape

• Aiko platform: https://sites.google.com/site/aikoplatorm

• MQTT: http://mqtt.org

• Mosquitto MQTT server: http://mosquitto.org

• Eclipse Paho (IoT M2M): http://eclipse.org/paho

Sunday, 29 July 12

Page 24: BarCamp Melbourne 2012: Internet of Things

“Dif-tor heh smusma” - ?

Sunday, 29 July 12

Page 25: BarCamp Melbourne 2012: Internet of Things

“Live long and prosper” - Spock

Sunday, 29 July 12