connecting open source hardware to the web
DESCRIPTION
Talk given at the Sydney Web Standards Groups. Introduction to the Arduino platform and how to use the Arduino as a web server.TRANSCRIPT
![Page 1: Connecting open source hardware to the web](https://reader033.vdocument.in/reader033/viewer/2022051400/54c844a64a795985748b4620/html5/thumbnails/1.jpg)
Justin Mclean
Web: http://www.classsoftware.com.auMail: [email protected]: justinmclean
Connecting Open Source Hardware to the Web
Sunday, 28 February 2010
![Page 2: Connecting open source hardware to the web](https://reader033.vdocument.in/reader033/viewer/2022051400/54c844a64a795985748b4620/html5/thumbnails/2.jpg)
• Programming for 25 years
• Developing and creating web applications for 15 years
• Developer and trainer in Flex and ColdFusion
• Adode Community Professional
Who am I?
Sunday, 28 February 2010
![Page 3: Connecting open source hardware to the web](https://reader033.vdocument.in/reader033/viewer/2022051400/54c844a64a795985748b4620/html5/thumbnails/3.jpg)
Overview of the Arduino Platform
Arduino
Sunday, 28 February 2010
![Page 4: Connecting open source hardware to the web](https://reader033.vdocument.in/reader033/viewer/2022051400/54c844a64a795985748b4620/html5/thumbnails/4.jpg)
Arduino Platform• Open source hardware and software platform
• Easy to program
• Hardware is flexible, fast and low power
Sunday, 28 February 2010
![Page 5: Connecting open source hardware to the web](https://reader033.vdocument.in/reader033/viewer/2022051400/54c844a64a795985748b4620/html5/thumbnails/5.jpg)
• Comes in a number of shapes sizes
• Low cost
• Easy to extend
Arduino Hardware
Sunday, 28 February 2010
![Page 6: Connecting open source hardware to the web](https://reader033.vdocument.in/reader033/viewer/2022051400/54c844a64a795985748b4620/html5/thumbnails/6.jpg)
Arduino Boards
Sunday, 28 February 2010
![Page 7: Connecting open source hardware to the web](https://reader033.vdocument.in/reader033/viewer/2022051400/54c844a64a795985748b4620/html5/thumbnails/7.jpg)
Arduino Shields
Sunday, 28 February 2010
![Page 8: Connecting open source hardware to the web](https://reader033.vdocument.in/reader033/viewer/2022051400/54c844a64a795985748b4620/html5/thumbnails/8.jpg)
• Open source cross platform IDE
• Alpha but very stable
• Code in high level C like language
• Updated frequently
• Growing and active community
Arduino Software Platform
Sunday, 28 February 2010
![Page 9: Connecting open source hardware to the web](https://reader033.vdocument.in/reader033/viewer/2022051400/54c844a64a795985748b4620/html5/thumbnails/9.jpg)
• 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
Sunday, 28 February 2010
![Page 10: Connecting open source hardware to the web](https://reader033.vdocument.in/reader033/viewer/2022051400/54c844a64a795985748b4620/html5/thumbnails/10.jpg)
Arduino IDE
Sunday, 28 February 2010
![Page 11: Connecting open source hardware to the web](https://reader033.vdocument.in/reader033/viewer/2022051400/54c844a64a795985748b4620/html5/thumbnails/11.jpg)
Led Shield Demo
Sunday, 28 February 2010
![Page 12: Connecting open source hardware to the web](https://reader033.vdocument.in/reader033/viewer/2022051400/54c844a64a795985748b4620/html5/thumbnails/12.jpg)
• Debugging can be hard
• Memory, power and speed limits
• Helps to have a little electronic knowledge
Issues
Sunday, 28 February 2010
![Page 13: Connecting open source hardware to the web](https://reader033.vdocument.in/reader033/viewer/2022051400/54c844a64a795985748b4620/html5/thumbnails/13.jpg)
How Arduinos can communicate with the outside world.
Connecting Arduinos to the Web
Sunday, 28 February 2010
![Page 14: Connecting open source hardware to the web](https://reader033.vdocument.in/reader033/viewer/2022051400/54c844a64a795985748b4620/html5/thumbnails/14.jpg)
Connection Methods• Direct to computer
• Wireless (XBee modems)
• Ethernet or WiFi
• “The Cloud”
Sunday, 28 February 2010
![Page 15: Connecting open source hardware to the web](https://reader033.vdocument.in/reader033/viewer/2022051400/54c844a64a795985748b4620/html5/thumbnails/15.jpg)
Supported Languages• Flash and Flex
• Processing
• Python
• Ruby
• Java
• C, C++, C# and Objective C
• .NET
Sunday, 28 February 2010
![Page 16: Connecting open source hardware to the web](https://reader033.vdocument.in/reader033/viewer/2022051400/54c844a64a795985748b4620/html5/thumbnails/16.jpg)
How to communicate with Arduinos via a computer
Direct Connection
Sunday, 28 February 2010
![Page 17: Connecting open source hardware to the web](https://reader033.vdocument.in/reader033/viewer/2022051400/54c844a64a795985748b4620/html5/thumbnails/17.jpg)
• Most languages can’t talk USB
• Solution: Socket to USB proxy
Direct Communication
Sunday, 28 February 2010
![Page 18: Connecting open source hardware to the web](https://reader033.vdocument.in/reader033/viewer/2022051400/54c844a64a795985748b4620/html5/thumbnails/18.jpg)
• Code Library
• Proxy to USB
• Program on arduino to USB
Layers of Communication
Sunday, 28 February 2010
![Page 19: Connecting open source hardware to the web](https://reader033.vdocument.in/reader033/viewer/2022051400/54c844a64a795985748b4620/html5/thumbnails/19.jpg)
• Standard Arduino library
• Simple binary protocol
• Based on MIDI
• Easy to extend
Firmata Protocal
Sunday, 28 February 2010
![Page 20: Connecting open source hardware to the web](https://reader033.vdocument.in/reader033/viewer/2022051400/54c844a64a795985748b4620/html5/thumbnails/20.jpg)
USB Proxy FirmataLibrary
Application Code Arduino
USBCable
TCP/IPSocket
Computer Arduino
Function Calls and Events
Code
Connection Diagram
Sunday, 28 February 2010
![Page 21: Connecting open source hardware to the web](https://reader033.vdocument.in/reader033/viewer/2022051400/54c844a64a795985748b4620/html5/thumbnails/21.jpg)
Firmata Demo
Sunday, 28 February 2010
![Page 22: Connecting open source hardware to the web](https://reader033.vdocument.in/reader033/viewer/2022051400/54c844a64a795985748b4620/html5/thumbnails/22.jpg)
• 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
Sunday, 28 February 2010
![Page 23: Connecting open source hardware to the web](https://reader033.vdocument.in/reader033/viewer/2022051400/54c844a64a795985748b4620/html5/thumbnails/23.jpg)
Using Arduino Ethernet Shields
Ethernet
Sunday, 28 February 2010
![Page 24: Connecting open source hardware to the web](https://reader033.vdocument.in/reader033/viewer/2022051400/54c844a64a795985748b4620/html5/thumbnails/24.jpg)
• Allow direct internet connection
• No computer needed
• Can act as web server or client
• Shields need a little configuration
Ethernet Shields
Sunday, 28 February 2010
![Page 25: Connecting open source hardware to the web](https://reader033.vdocument.in/reader033/viewer/2022051400/54c844a64a795985748b4620/html5/thumbnails/25.jpg)
Ethernet Shields
Sunday, 28 February 2010
![Page 26: Connecting open source hardware to the web](https://reader033.vdocument.in/reader033/viewer/2022051400/54c844a64a795985748b4620/html5/thumbnails/26.jpg)
Web Servers• Simpler than you think
• A web server:
• Listens for connections
• Parse requests
• Send back status messages/resources requested
Sunday, 28 February 2010
![Page 27: Connecting open source hardware to the web](https://reader033.vdocument.in/reader033/viewer/2022051400/54c844a64a795985748b4620/html5/thumbnails/27.jpg)
HTTP Requests• Start with request “GET index.html HTTP/1.1”
• Optional headers “Accept-Language: en”
• Empty line
• Optional message body (POST and other requests)
Sunday, 28 February 2010
![Page 28: Connecting open source hardware to the web](https://reader033.vdocument.in/reader033/viewer/2022051400/54c844a64a795985748b4620/html5/thumbnails/28.jpg)
• Web server code
• Easy to modify
Ethernet Arduino Code
Sunday, 28 February 2010
![Page 29: Connecting open source hardware to the web](https://reader033.vdocument.in/reader033/viewer/2022051400/54c844a64a795985748b4620/html5/thumbnails/29.jpg)
Ethernet Demo
Sunday, 28 February 2010
![Page 30: Connecting open source hardware to the web](https://reader033.vdocument.in/reader033/viewer/2022051400/54c844a64a795985748b4620/html5/thumbnails/30.jpg)
• 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?
Sunday, 28 February 2010
![Page 31: Connecting open source hardware to the web](https://reader033.vdocument.in/reader033/viewer/2022051400/54c844a64a795985748b4620/html5/thumbnails/31.jpg)
It’s Fun!
Sunday, 28 February 2010
![Page 32: Connecting open source hardware to the web](https://reader033.vdocument.in/reader033/viewer/2022051400/54c844a64a795985748b4620/html5/thumbnails/32.jpg)
List of useful hardware and software sites
Useful Sites
Sunday, 28 February 2010
![Page 33: Connecting open source hardware to the web](https://reader033.vdocument.in/reader033/viewer/2022051400/54c844a64a795985748b4620/html5/thumbnails/33.jpg)
• 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
Sunday, 28 February 2010
![Page 34: Connecting open source hardware to the web](https://reader033.vdocument.in/reader033/viewer/2022051400/54c844a64a795985748b4620/html5/thumbnails/34.jpg)
• Little Bird Electronics (AUS) http://www.littlebirdelectronics.com/
• Spark Fun (US) http://www.sparkfun.com/
• Adafruit Industries (US) http://www.adafruit.com/
• Electronic Goldmine (US) http://www.goldmine-elec.com/
Hardware Sites
Sunday, 28 February 2010
![Page 35: Connecting open source hardware to the web](https://reader033.vdocument.in/reader033/viewer/2022051400/54c844a64a795985748b4620/html5/thumbnails/35.jpg)
• 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
Sunday, 28 February 2010