putting your device in a browser or on the web

34
Justin Mclean Web: http://www.classsoftware.com.au Mail: [email protected] Twitter: justinmclean Arduino Miniconf Putting your device in a browser or on the web Monday, 18 January 2010

Upload: justin-mclean

Post on 28-Jan-2015

106 views

Category:

Technology


0 download

DESCRIPTION

Part of the Linux Conference Australia 2010 Arduino mini conference. Explains the various ways you can connect arduinos to the web and the internet.

TRANSCRIPT

Page 1: Putting your device in a browser or on the web

Justin Mclean

Web: http://www.classsoftware.com.auMail: [email protected]: justinmclean

Arduino MiniconfPutting your device in a browser or on the web

Monday, 18 January 2010

Page 2: Putting your device in a browser or on the web

• Developing and creating web applications for 15 years

• Programming for 25 years

• Developer and trainer in Flex and ColdFusion

• Based in Sydney Australia

Who am I?

Monday, 18 January 2010

Page 3: Putting your device in a browser or on the web

Overview of the Arduino Platform

Arduino

Monday, 18 January 2010

Page 4: Putting your device in a browser or on the web

• Code in a C like high level language

• Inbuilt functions to read and set digital and analog inputs and outputs

• Includes libraries to perform common hardware or software tasks

Arduino Code

Monday, 18 January 2010

Page 5: Putting your device in a browser or on the web

Arduino IDE

Monday, 18 January 2010

Page 6: Putting your device in a browser or on the web

Led Shield Demo

Monday, 18 January 2010

Page 7: Putting your device in a browser or on the web

• Debugging can be hard

• Memory, power and speed limits

• Helps to have a little electronic knowledge

Issues

Monday, 18 January 2010

Page 8: Putting your device in a browser or on the web

How Arduinos can communicate with the outside world.

Connecting Arduinos to the Web

Monday, 18 January 2010

Page 9: Putting your device in a browser or on the web

Connection Methods• Direct to computer

• Wireless (XBee modems)

• Ethernet or WiFi

• “The Cloud”

Monday, 18 January 2010

Page 10: Putting your device in a browser or on the web

Supported Languages• Flash and Flex

• Processing

• Python

• Ruby

• Java

• C, C++, C# and Objective C

• .NET

Monday, 18 January 2010

Page 11: Putting your device in a browser or on the web

How to communicate with Arduinos via a computer

Direct Connection

Monday, 18 January 2010

Page 12: Putting your device in a browser or on the web

• Most languages can’t talk USB

• Solution: Socket to USB proxy

Direct Communication

Monday, 18 January 2010

Page 13: Putting your device in a browser or on the web

• Code Library

• Proxy to USB

• Program on arduino to USB

Layers of Communication

Monday, 18 January 2010

Page 14: Putting your device in a browser or on the web

• Standard Arduino library

• Simple binary protocol

• Based on MIDI

• Easy to extend

Firmata Protocal

Monday, 18 January 2010

Page 15: Putting your device in a browser or on the web

USB Proxy FirmataLibrary

Application Code Arduino

USBCable

TCP/IPSocket

Computer Arduino

Function Calls and Events

Code

Connection Diagram

Monday, 18 January 2010

Page 16: Putting your device in a browser or on the web

Firmata Demo

Monday, 18 January 2010

Page 17: Putting your device in a browser or on the web

• Works best with a persistent connection

• Otherwise startup time and auto reset may be issues

• Proxy must be running on computer the Arduino is connected to

Issues

Monday, 18 January 2010

Page 18: Putting your device in a browser or on the web

Using Arduino Ethernet Shields

Ethernet

Monday, 18 January 2010

Page 19: Putting your device in a browser or on the web

• Allow direct internet connection

• No computer needed

• Can act as web server or client

• Shields need a little configuration

Ethernet Shields

Monday, 18 January 2010

Page 20: Putting your device in a browser or on the web

Ethernet Shields

Monday, 18 January 2010

Page 21: Putting your device in a browser or on the web

• Web server code

• Easy to modify

Ethernet Arduino Code

Monday, 18 January 2010

Page 22: Putting your device in a browser or on the web

Ethernet Demo

Monday, 18 January 2010

Page 23: Putting your device in a browser or on the web

An easier way to connect Arduinos

Pachube

Monday, 18 January 2010

Page 24: Putting your device in a browser or on the web

• Store and share and access realtime sensor data

• Simple and secure

• API to interact with all data and services

• Graphs and maps

Pachube

Monday, 18 January 2010

Page 25: Putting your device in a browser or on the web

Pachube

Monday, 18 January 2010

Page 26: Putting your device in a browser or on the web

• Runs on Arduino with an ethernet shield

• Sends values to Pachube

• Request values via Pachube

Pachube Arduino Code

Monday, 18 January 2010

Page 27: Putting your device in a browser or on the web

• Communicates over HTTP

• Plain text (csv), XML or Jason

• REST based

• Large base of supported languages

Pachube API

Monday, 18 January 2010

Page 28: Putting your device in a browser or on the web

• Pachube can call an URL on value change

• The URL can be a dynamic

Pachube Triggers

Monday, 18 January 2010

Page 29: Putting your device in a browser or on the web

• Expose yourself to new ideas and new ways of solving problems

• Involves interaction with the real world

• Encourages creativity

• Makes you a better programmer

Why do this?

Monday, 18 January 2010

Page 30: Putting your device in a browser or on the web

It’s Fun!

Monday, 18 January 2010

Page 31: Putting your device in a browser or on the web

List of useful hardware and software sites

Useful Sites

Monday, 18 January 2010

Page 32: Putting your device in a browser or on the web

• Arduino http://www.arduino.cc for software, user forum and playground

• Ethernet Shields http://arduino.cc/en/Reference/Ethernet

• Pachhub http://www.pachube.com/

Software Sites

Monday, 18 January 2010

Page 33: Putting your device in a browser or on the web

• Mind Kits (NZ) http://www.mindkits.co.nz/

• Spark Fun (US) http://www.sparkfun.com/

• Adafruit Industries (US) http://www.adafruit.com/

• Electronic Goldmine (US) http://www.goldmine-elec.com/

Hardware Sites

Monday, 18 January 2010

Page 34: Putting your device in a browser or on the web

• Lady Ada http://www.ladyada.net/

• Evil Mad Scientist http://www.evilmadscientist.com/

• NY Resistor http://www.nycresistor.com/

• Make Zine http://makezine.com/

Other Sites

Monday, 18 January 2010