connecting rias and hardware together

52
Justin Mclean, Class Software Flex and the Arduino platform Connecting Hardware to Rich Internet Applications Tuesday, 1 June 2010

Upload: justin-mclean

Post on 27-Jan-2015

121 views

Category:

Technology


0 download

DESCRIPTION

This session looks at the revolution in low cost, easy to program embedded computing and connecting it to the internet. Focusing on the Arduino open source hardware and software platform and how it can be easily connected to various RIA platforms – directly, via the ethernet or via the cloud. Topics covered range from digital and analogue input and output to creating your own Arduino web server (in under 20 lines of code). Show that it's easier than you realise to interface with hardware and that with a little knowledge you can do this.

TRANSCRIPT

Page 1: Connecting RIAs and hardware together

Justin Mclean, Class Software

Flex and the Arduino platform

Connecting Hardware toRich Internet Applications

Tuesday, 1 June 2010

Page 2: Connecting RIAs and hardware together

Who am I?

Director of Class Software for 10 + yearsDeveloping and creating web applications for 15

yearsProgramming for 25 yearsAdobe community professional in FlexAdobe certified developer and trainer in ColdFusion

and FlexBased in Sydney Australia

Tuesday, 1 June 2010

Page 3: Connecting RIAs and hardware together

Electronics Trends

Low cost componentsSmall componentsComplex components with simple standard interfaces

Tuesday, 1 June 2010

Page 4: Connecting RIAs and hardware together

Computing Trends

Easier to programUse of high level languagesSoftware toolsOpen source

Tuesday, 1 June 2010

Page 5: Connecting RIAs and hardware together

Are We There Yet?

Low cost fast devicesIt’s easy to communicate between devices and

computersCan build complex systems from off the shelf

components

Tuesday, 1 June 2010

Page 6: Connecting RIAs and hardware together

Arduino

Overview of the Arduino Platform

Tuesday, 1 June 2010

Page 7: Connecting RIAs and hardware together

Arduino Platform

Open source hardware and software platformEasy to programHardware is flexible, fast, low power and low cost

Tuesday, 1 June 2010

Page 8: Connecting RIAs and hardware together

Arduino Hardware

Comes in a number of shapes sizesLow costEasy to extendDigital inputs/outputsAnalog inputs

Tuesday, 1 June 2010

Page 9: Connecting RIAs and hardware together

Arduino Boards

Tuesday, 1 June 2010

Page 10: Connecting RIAs and hardware together

Arduino Boards

Tuesday, 1 June 2010

Page 11: Connecting RIAs and hardware together

Arduino Boards

Tuesday, 1 June 2010

Page 12: Connecting RIAs and hardware together

Arduino Boards

Tuesday, 1 June 2010

Page 13: Connecting RIAs and hardware together

Arduino Shields

Tuesday, 1 June 2010

Page 14: Connecting RIAs and hardware together

Arduino Shields

Tuesday, 1 June 2010

Page 15: Connecting RIAs and hardware together

Arduino Shields

Tuesday, 1 June 2010

Page 16: Connecting RIAs and hardware together

Arduino Shields

Tuesday, 1 June 2010

Page 17: Connecting RIAs and hardware together

Arduino Software Platform

Open source cross platform IDEAlpha but very stableUpdated frequentlyGrowing and active community

Tuesday, 1 June 2010

Page 18: Connecting RIAs and hardware together

Arduino Code

C like high level languageInbuilt functions to read and set digital and analog

inputs and outputsIncludes libraries to perform common hardware or

software tasksOnce uploaded programs are permanent

Tuesday, 1 June 2010

Page 19: Connecting RIAs and hardware together

Arduino IDE

Tuesday, 1 June 2010

Page 20: Connecting RIAs and hardware together

Led Shield Demo

Tuesday, 1 June 2010

Page 21: Connecting RIAs and hardware together

Led Shield Demo

Tuesday, 1 June 2010

Page 22: Connecting RIAs and hardware together

Issues

Debugging can be hardNo simulatorMemory, power and speed limits Helps to have a little electronics knowledge

Tuesday, 1 June 2010

Page 23: Connecting RIAs and hardware together

How Arduinos can communicate with the world

Connecting Arduinos to the Web

Tuesday, 1 June 2010

Page 24: Connecting RIAs and hardware together

Connection Methods

Direct to computer (USB)Wireless (XBee modems)Ethernet or WiFi“The Cloud”

Tuesday, 1 June 2010

Page 25: Connecting RIAs and hardware together

Supported Languages

Flash and FlexProcessingPythonRubyJavaC, C++, C# and Objective C.NET

Tuesday, 1 June 2010

Page 26: Connecting RIAs and hardware together

Flex

Flex to Arduino direct connection

Tuesday, 1 June 2010

Page 27: Connecting RIAs and hardware together

Layers of Communication

Flex to proxy via an Actionscript libraryProxy to USB communicationUSB to arduino

Tuesday, 1 June 2010

Page 28: Connecting RIAs and hardware together

Flex to Arduino

USB Proxy FirmataAS3 Glue

Flex Code Arduino

USBCable

TCP/IPSocket

Computer Arduino

Function Calls and Events

Code

Tuesday, 1 June 2010

Page 29: Connecting RIAs and hardware together

Flex Led Demo

Tuesday, 1 June 2010

Page 30: Connecting RIAs and hardware together

AS3Glue Digital Output

Create arduino instancevar arduino:Arduino = new Arduino();

Wait for firmware versionSet digital pin as output

arduino.setPinMode(pin, Arduino.OUTPUT);Turn digital output on

arduino.writeDigitalPin(pin, Arduino.HIGH);

Tuesday, 1 June 2010

Page 31: Connecting RIAs and hardware together

Danger Shield Demo

Tuesday, 1 June 2010

Page 32: Connecting RIAs and hardware together

AS3Glue Analog Input

Turn on analog reportingarduino.setAnalogPinReporting(pin, Arduino.ON);Listen for changes via event listener

arduino.addEventListener(ArduinoEvent.ANALOG_DATA, onReceiveData);

public function onReceiveData(event:ArduinoEvent):void { ....}

Tuesday, 1 June 2010

Page 33: Connecting RIAs and hardware together

Ethernet

Using Arduino Ethernet Shields

Tuesday, 1 June 2010

Page 34: Connecting RIAs and hardware together

Ethernet Shields

Allow direct internet connectionNo dedicated PC neededShields need a little configCan act as web server or client

Tuesday, 1 June 2010

Page 35: Connecting RIAs and hardware together

Ethernet Shields

Tuesday, 1 June 2010

Page 36: Connecting RIAs and hardware together

Ethernet Shields

Tuesday, 1 June 2010

Page 37: Connecting RIAs and hardware together

Ethernet Shields

Tuesday, 1 June 2010

Page 38: Connecting RIAs and hardware together

Web Servers

Simpler than you thinkA web server:

Listens for connectionsParse requestsSend back status messages/resources requested

Tuesday, 1 June 2010

Page 39: Connecting RIAs and hardware together

HTTP Requests

Start with request “GET index.html HTTP/1.1”Optional headers “Accept-Language: en”Empty lineOptional message body (POST and other requests)

Tuesday, 1 June 2010

Page 40: Connecting RIAs and hardware together

Web server codeEasy to modify

Ethernet Arduino Code

Tuesday, 1 June 2010

Page 41: Connecting RIAs and hardware together

Ethernet Demo

Tuesday, 1 June 2010

Page 42: Connecting RIAs and hardware together

Rich Internet Applications

Ideas on how and where to use this technology

Tuesday, 1 June 2010

Page 43: Connecting RIAs and hardware together

Environmental Monitoring

Indoors or outdoorsWide range of sensorsSleep mode/low power consumption

Tuesday, 1 June 2010

Page 44: Connecting RIAs and hardware together

Home Automation

Power and utilities monitoringControlling Lights and Heating/CoolingGarden watering/monitoring

Tuesday, 1 June 2010

Page 45: Connecting RIAs and hardware together

Security and Safety

Security systemsLocation reportingBike jackets

Tuesday, 1 June 2010

Page 46: Connecting RIAs and hardware together

Why do this?

Expose yourself to new ideas and new ways of solving problems

Involves interaction with the real worldEncourages creativityMakes you a better programmer

Tuesday, 1 June 2010

Page 47: Connecting RIAs and hardware together

It’s Fun!

Tuesday, 1 June 2010

Page 48: Connecting RIAs and hardware together

Questions?

Ask now, see me after session or email [email protected]

Slides and code can be found athttp://blog.classsoftware.com/

Tuesday, 1 June 2010

Page 49: Connecting RIAs and hardware together

Useful Sites

List of useful hardware and software sites

Tuesday, 1 June 2010

Page 50: Connecting RIAs and hardware together

Software Sites

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

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

Pachhub http://www.pachube.com/

Tuesday, 1 June 2010

Page 51: Connecting RIAs and hardware together

Hardware Sites

Spark Fun (US) http://www.sparcfun.com/Adafruit Industries (US) http://www.adafruit.com/Electronic Goldmine (US) http://www.goldmine-

elec.com/

Tuesday, 1 June 2010

Page 52: Connecting RIAs and hardware together

Other Sites

Lady Ada http://www.ladyada.com/Evil Mad Scientist http://www.evilmadscientist.com/NY Resistor http://www.nycresistor.com/Make Zine http://www.makezine.com/

Tuesday, 1 June 2010