Scripting Things Pittsburgh Perl Workshop 2011 Carnegie Mellon University Hans Scharler www.ioBridge.com @scharler
Objectives <ul><li>Introduce the “Internet of Things” </li></ul><ul><li>Learn how to Innovate </li></ul><ul><li>Answer: Wh...
The Internet of Things <ul><li>Sensors </li></ul><ul><li>Controllers </li></ul><ul><li>People </li></ul><ul><li>Buildings ...
The Internet of Things <ul><li>Is server monitoring too boring for the Internet of Things?  </li></ul><ul><li>NO…  Write a...
Innovation Source: everythingisaremix.info
Innovation Example Temperature Sensing Temperature Sensing Humidity Sensing Humidity Sensing + Twitter Tweeting Humidor
The Solution <ul><li>Perl? </li></ul>
The Benefits of Perl <ul><li>Parsing </li></ul><ul><li>String Operations </li></ul><ul><li>REGEX </li></ul><ul><li>Native ...
The Opportunity “ Imagine if we attach Perl to the emerging Internet of Things” --Hans Scharler “ Industry Leading Expert”...
Perl’s Keys to Success <ul><li>Examples written in Perl </li></ul><ul><li>CPAN module for Arduino® / ioBridge® </li></ul><...
Interface to the Real World <ul><li>Digital I/O </li></ul><ul><li>Analog </li></ul><ul><li>Serial </li></ul><ul><li>(via) ...
Digital I/O <ul><li>Digital   = Discrete States (On/Off) </li></ul><ul><li>I   = Input </li></ul><ul><li>O   = Output </li...
Digital Output <ul><li>Device generates some voltage to represent the “On” state – typically 5v </li></ul><ul><li>Device g...
Digital Output <ul><li>If something that you are hacking has a button or switch, you can just replace it with a Digital Ou...
Digital Input <ul><li>Read in voltage that represents the “On” state – typically 5v </li></ul><ul><li>Read in voltage that...
Digital Input <ul><li>Use Digital Inputs to see if something is opened / closed, up / down, or on / off </li></ul>Down Ope...
Analog Input <ul><li>Varying voltages – typically from 0 to 5v </li></ul><ul><li>Higher voltages indicate more of somethin...
Analog Input: Temperature Source: physicscentral.com Voltage Time ->
Analog Input for Sensors <ul><li>Examples of Analog Input: </li></ul><ul><ul><li>Temperature </li></ul></ul><ul><ul><li>Hu...
Serial <ul><li>Serial is a way of passing data one piece at a time between devices </li></ul><ul><li>A little more complic...
Serial <ul><li>Even more Serial Concepts… </li></ul><ul><li>RS-232 </li></ul><ul><ul><li>Short distance communication </li...
Serial-over-USB Converts USB to UART Serial
Device::SerialPort ls -la /dev/tty* use Device::SerialPort; my $port = Device::SerialPort->new(&quot;/dev/tty.usbserial&qu...
Device::SerialPort my $char = $port->lookfor(); print “$char n”; $port->write(“Hello World&quot;); Read Serial Data: Send ...
Network Protocols <ul><li>Abstraction of physical interface over network protocols </li></ul><ul><li>Serial-over-Ethernet ...
Serial over Network Serial Serial Ethernet Ethernet Now you can go a long distance over UART serial
“ ioBridge” ioBridge IO-204 Ethernet Module Relay Thermostat Temperature Sensor HTTP POST “ turn on thermostat” HTTP GET “...
How to Start <ul><li>Start small </li></ul><ul><li>Duplicate someone else's well documented project  (check Instructables....
What We Do Projects!
Internet Pet Feeders 2008  2009  2010
Projects turned Products
Platform Technologies <ul><li>Optimized TCP/IP Stack </li></ul><ul><li>Portable Client </li></ul><ul><li>Real-time Streami...
Projects turned Products
Control Heating/Cooling Based on Current Position and Weather Track Your Location With Google Latitude
iPhone Controlled Beer Cannon Mini Fridge Beer Cannon by Ryan Rusnak Over 1 million YouTube Views Demo’d Live on TV In the...
Learn more… <ul><li>My blog -  http://iamshadowlord.com </li></ul><ul><li>“ Thermd” Perl Module -  http://www.klein.com/th...
Q&A Hans Scharler [email_address] www.ioBridge.com
Upcoming SlideShare
Loading in …5
×

Scripting Things - Creating the Internet of Things with Perl

3,997 views

Published on

This talk was featured at the Pittsburgh Perl Workshop held at Carnegie Mellon University and presented by Hans Scharler of ioBridge. Learn how to interface the real-world with Perl by connecting to things using digital I/O, analog, serial, and network protocols. Hans also takes time to explain how to get started with the Internet of Things and start building projects by remixing other projects.

Published in: Technology, Business
0 Comments
6 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,997
On SlideShare
0
From Embeds
0
Number of Embeds
1,355
Actions
Shares
0
Downloads
0
Comments
0
Likes
6
Embeds 0
No embeds

No notes for slide

Scripting Things - Creating the Internet of Things with Perl

  1. 1. Scripting Things Pittsburgh Perl Workshop 2011 Carnegie Mellon University Hans Scharler www.ioBridge.com @scharler
  2. 2. Objectives <ul><li>Introduce the “Internet of Things” </li></ul><ul><li>Learn how to Innovate </li></ul><ul><li>Answer: Why Perl? </li></ul><ul><li>Interface the Real-world </li></ul><ul><li>Learn how to start a project </li></ul><ul><li>Plant some ideas </li></ul><ul><li>Answer Questions </li></ul>
  3. 3. The Internet of Things <ul><li>Sensors </li></ul><ul><li>Controllers </li></ul><ul><li>People </li></ul><ul><li>Buildings </li></ul><ul><li>Connectivity </li></ul><ul><li>Applications </li></ul>Source: The Things People Things
  4. 4. The Internet of Things <ul><li>Is server monitoring too boring for the Internet of Things? </li></ul><ul><li>NO… Write a simple script to monitor CPU and RAM utilization and push that data out to a web service to measure server uptime and performance </li></ul><ul><li>IoT is only going to work in small steps. It starts with remote server monitoring and ends with SkyNet. </li></ul>
  5. 5. Innovation Source: everythingisaremix.info
  6. 6. Innovation Example Temperature Sensing Temperature Sensing Humidity Sensing Humidity Sensing + Twitter Tweeting Humidor
  7. 7. The Solution <ul><li>Perl? </li></ul>
  8. 8. The Benefits of Perl <ul><li>Parsing </li></ul><ul><li>String Operations </li></ul><ul><li>REGEX </li></ul><ul><li>Native Serial </li></ul><ul><li>Hardware Abstraction </li></ul><ul><li>Connecting APIs </li></ul><ul><li>CPAN </li></ul>
  9. 9. The Opportunity “ Imagine if we attach Perl to the emerging Internet of Things” --Hans Scharler “ Industry Leading Expert” Source: Hans Scharler
  10. 10. Perl’s Keys to Success <ul><li>Examples written in Perl </li></ul><ul><li>CPAN module for Arduino® / ioBridge® </li></ul><ul><li>Projects that use Perl to connect things </li></ul>
  11. 11. Interface to the Real World <ul><li>Digital I/O </li></ul><ul><li>Analog </li></ul><ul><li>Serial </li></ul><ul><li>(via) Network Protocols </li></ul>
  12. 12. Digital I/O <ul><li>Digital = Discrete States (On/Off) </li></ul><ul><li>I = Input </li></ul><ul><li>O = Output </li></ul>Use Digital I/O to check if something is On / Off (input) or to turn something On / Off (output)
  13. 13. Digital Output <ul><li>Device generates some voltage to represent the “On” state – typically 5v </li></ul><ul><li>Device generates some voltage to represent the “Off” state – typically 0v </li></ul>
  14. 14. Digital Output <ul><li>If something that you are hacking has a button or switch, you can just replace it with a Digital Output / Relay to operate that device (most of the time) </li></ul>“ 1100110001101” (bark)
  15. 15. Digital Input <ul><li>Read in voltage that represents the “On” state – typically 5v </li></ul><ul><li>Read in voltage that represents the “Off” state – typically 0v </li></ul>
  16. 16. Digital Input <ul><li>Use Digital Inputs to see if something is opened / closed, up / down, or on / off </li></ul>Down Open On
  17. 17. Analog Input <ul><li>Varying voltages – typically from 0 to 5v </li></ul><ul><li>Higher voltages indicate more of something </li></ul><ul><li>Lower voltages indicate less of something </li></ul><ul><li>Used for sensors </li></ul>Source: physicscentral.com
  18. 18. Analog Input: Temperature Source: physicscentral.com Voltage Time ->
  19. 19. Analog Input for Sensors <ul><li>Examples of Analog Input: </li></ul><ul><ul><li>Temperature </li></ul></ul><ul><ul><li>Humidity </li></ul></ul><ul><ul><li>Pressure </li></ul></ul><ul><ul><li>Light Levels </li></ul></ul><ul><ul><li>Distance / Range </li></ul></ul><ul><ul><li>Volume </li></ul></ul>Source: physicscentral.com
  20. 20. Serial <ul><li>Serial is a way of passing data one piece at a time between devices </li></ul><ul><li>A little more complicated, but Serial has universal concepts: </li></ul><ul><ul><li>Databits – typically 8 </li></ul></ul><ul><ul><li>Baud Rate / Speed – typically 9,600 or 19,200 </li></ul></ul><ul><ul><li>Parity – typically “none” </li></ul></ul><ul><ul><li>Stop Bits – typically 1 </li></ul></ul>
  21. 21. Serial <ul><li>Even more Serial Concepts… </li></ul><ul><li>RS-232 </li></ul><ul><ul><li>Short distance communication </li></ul></ul><ul><ul><li>Higher voltages – old serial ports on computers and modems </li></ul></ul><ul><li>UART </li></ul><ul><ul><li>Short distance commutations </li></ul></ul><ul><ul><li>0 to 5v </li></ul></ul><ul><ul><li>Used with microcontrollers such as Arduino® </li></ul></ul><ul><li>RS-485 </li></ul><ul><ul><li>Long distance serial </li></ul></ul><ul><ul><li>Used more by industrial control systems </li></ul></ul>
  22. 22. Serial-over-USB Converts USB to UART Serial
  23. 23. Device::SerialPort ls -la /dev/tty* use Device::SerialPort; my $port = Device::SerialPort->new(&quot;/dev/tty.usbserial&quot;); $port->baudrate(19200); $port->databits(8); $port->parity(&quot;none&quot;); $port->stopbits(1); Find your serial device: Perl Setup: Settings must match on both sides
  24. 24. Device::SerialPort my $char = $port->lookfor(); print “$char n”; $port->write(“Hello World&quot;); Read Serial Data: Send Serial Data: <ul><li>See Also: </li></ul><ul><ul><li>Win32::SerialPort </li></ul></ul><ul><ul><li>Firmata for Arduino: </li></ul></ul><ul><ul><li>http://firmata.org/wiki/Download </li></ul></ul><ul><ul><li>https://github.com/amimoto/perl-firmata </li></ul></ul>
  25. 25. Network Protocols <ul><li>Abstraction of physical interface over network protocols </li></ul><ul><li>Serial-over-Ethernet </li></ul><ul><li>HTTP GET to get data from a Digital or Analog Input </li></ul><ul><li>HTTP POST / PUT to control a Digital Output </li></ul><ul><li>API to Device - “ioBridge” </li></ul>
  26. 26. Serial over Network Serial Serial Ethernet Ethernet Now you can go a long distance over UART serial
  27. 27. “ ioBridge” ioBridge IO-204 Ethernet Module Relay Thermostat Temperature Sensor HTTP POST “ turn on thermostat” HTTP GET “ temperature”
  28. 28. How to Start <ul><li>Start small </li></ul><ul><li>Duplicate someone else's well documented project (check Instructables.com or Google) </li></ul><ul><li>Break every project down to a list of basic concepts (Digital I/O, Analog, Serial, Network Protocols) </li></ul><ul><li>Transform the basic design (make a change) </li></ul><ul><li>Combine the design with other ideas (add Twitter) </li></ul><ul><li>Finish big </li></ul>
  29. 29. What We Do Projects!
  30. 30. Internet Pet Feeders 2008 2009 2010
  31. 31. Projects turned Products
  32. 32. Platform Technologies <ul><li>Optimized TCP/IP Stack </li></ul><ul><li>Portable Client </li></ul><ul><li>Real-time Streaming, Web Sockets, Comet </li></ul><ul><li>Application Design Platform </li></ul><ul><li>API Abstraction </li></ul><ul><li>Visualizations </li></ul>
  33. 33. Projects turned Products
  34. 34. Control Heating/Cooling Based on Current Position and Weather Track Your Location With Google Latitude
  35. 35. iPhone Controlled Beer Cannon Mini Fridge Beer Cannon by Ryan Rusnak Over 1 million YouTube Views Demo’d Live on TV In the June 2011 issue of Popular Science Featured on JUNKies -- TV Show on Discovery Science
  36. 36. Learn more… <ul><li>My blog - http://iamshadowlord.com </li></ul><ul><li>“ Thermd” Perl Module - http://www.klein.com/thermd </li></ul><ul><li>Arduino - http://www.arduino.cc </li></ul><ul><li>ioBridge – http://www.iobridge.com </li></ul><ul><li>Instructables – http://www.instructables.com </li></ul>
  37. 37. Q&A Hans Scharler [email_address] www.ioBridge.com

×