Your SlideShare is downloading. ×
Scripting Things - Creating the Internet of Things with Perl
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Scripting Things - Creating the Internet of Things with Perl

2,921
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 …

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
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,921
On Slideshare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
0
Comments
0
Likes
4
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

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