A Practical Guide to Connecting Hardware to the...
Transcript of A Practical Guide to Connecting Hardware to the...
![Page 1: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/1.jpg)
Justin Mcleanwww.classsoftware.com
A Practical Guide to Connecting Hardware to the Web
![Page 2: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/2.jpg)
• Director of Class Software for 15 years
• Developing and creating web applications for 15 years
• Programming for 25 years
• Adobe solution partner
• Adobe certified developer and trainer in Flex and ColdFusion
• Based in Sydney Australia
Who am I?
![Page 3: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/3.jpg)
• Low cost
• Small components
• Complex components with simple interfaces
Electronics Trends
![Page 4: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/4.jpg)
• Easier to program
• Use of high level languages
• Software tools
• Open source
Computing Trends
![Page 5: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/5.jpg)
• Low cost fast devices
• It’s easy to communicate between devices and computers
• Can build complex systems from off the shelf components
Are We There Yet?
![Page 6: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/6.jpg)
Overview of the Arduino Platform
Arduino
![Page 7: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/7.jpg)
Arduino Platform• Open source hardware and software platform
• Easy to program
• Hardware is flexible, fast, low power and low cost
![Page 8: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/8.jpg)
• Comes in a number of shapes sizes
• Low cost
• Easy to extend
Arduino Hardware
![Page 9: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/9.jpg)
Arduino Boards
![Page 10: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/10.jpg)
Arduino Shields
![Page 11: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/11.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
![Page 12: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/12.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
![Page 13: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/13.jpg)
Arduino IDE
![Page 14: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/14.jpg)
Led Shield Demo
![Page 15: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/15.jpg)
• Debugging can be hard
• No simulator
• Memory, power and speed limits
• Helps to have a little electronic knowledge
Issues
![Page 16: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/16.jpg)
How Arduinos communicate with the outside world
Connecting Arduinos
![Page 17: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/17.jpg)
Connection Methods• Direct to computer
• Wireless (XBee modems)
• Ethernet or WiFi
• The Cloud
![Page 18: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/18.jpg)
Supported Languages• Flex and Flash
• Processing
• Python
• Ruby
• Java
• C, C++, C# and Objective C
• .NET
![Page 19: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/19.jpg)
How to communicate with Arduinos and via PCs
Direct Connection
![Page 20: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/20.jpg)
• Most languages can’t talk USB
• Solution: Socket to USB proxy
Direct Communication
![Page 21: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/21.jpg)
• Library to communicate with proxy
• Proxy to USB communication
• USB to arduino
Layers of Communication
![Page 22: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/22.jpg)
USB Proxy FirmataLibrary
Application Code Arduino
USBCable
TCP/IPSocket
Computer Arduino
Function Calls and Events
Code
Connection Diagram
![Page 23: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/23.jpg)
• Simple binary protocol
• Based on MIDI
• Easy to extend
• Standard Arduino software library
Firmata Protocal
![Page 24: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/24.jpg)
Arduino Demo
![Page 25: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/25.jpg)
• Works best with a persistent connection
• If not persistent startup time and auto reset issues
• Solution: custom bootloader
• Needs a computer
• Proxy must be running on machine Arduino is connected to
Issues
![Page 26: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/26.jpg)
Using Arduinos with XBee modems
Xbee Modems
![Page 27: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/27.jpg)
XBee Modems• Hardware wireless modem
• Low cost
• Consume very little power
• Good range
• Easy to configure
![Page 28: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/28.jpg)
XBee Modems
![Page 29: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/29.jpg)
XBee Demo
![Page 30: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/30.jpg)
Using Arduino Ethernet Shields
Ethernet
![Page 31: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/31.jpg)
• Allow direct internet connection
• No dedicated computer needed
• Shields need a little config
• Can act as web server or client
Ethernet Shields
![Page 32: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/32.jpg)
Ethernet Shields
![Page 33: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/33.jpg)
• Web server code
• Easy to modify
Ethernet Arduino Code
![Page 34: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/34.jpg)
Ethernet Demo
![Page 35: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/35.jpg)
An easier way to connect Arduinos
Pachube
![Page 36: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/36.jpg)
• Store and share and acess realtime sensor data
• Simple and secure
• API to interact with all data and services
• Graphs and maps
Pachube
![Page 37: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/37.jpg)
Pachube
![Page 38: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/38.jpg)
• Communicates HTTP
• Plain text (csv), XML or Jason
• REST based
• Large base of supported languages
Pachube API
![Page 39: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/39.jpg)
• Runs on Arduino with ethernet shield
• Sends values to Pachube
• Request values via Pachube
Pachube Arduino Code
![Page 40: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/40.jpg)
• Call Pachube API using HTTP call
• Parse XML
• XML is in EEML format
• Display or act on values
Pachube Interaction
![Page 41: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/41.jpg)
Pachube Demo
![Page 42: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/42.jpg)
• Pachube can call an URL on value change
• The URL can be a dynamic
Pachube Triggers
![Page 43: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/43.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?
![Page 44: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/44.jpg)
It’s Fun!
![Page 46: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/46.jpg)
List of useful hardware and software sites
Useful Sites
![Page 47: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/47.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
![Page 48: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/48.jpg)
• Spark Fun (US) http://www.sparkfun.com/
• Adafruit Industries (US) http://www.adafruit.com/
• Electronic Goldmine (US) http://www.goldmine-elec.com/
Hardware Sites
![Page 49: A Practical Guide to Connecting Hardware to the Webclasssoftware.com/edgeoftheweb/edgeoftheweb.pdf · A Practical Guide to Connecting Hardware to the Web • Director of Class Software](https://reader033.fdocuments.net/reader033/viewer/2022060409/5f10103b7e708231d44743b0/html5/thumbnails/49.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