Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction to Home Automation with Arduino an...

Introduction to Home Automation with Arduino and iOS

Given at CocoaHeadsDC, May 7, 2015.

Avatar for W. Dana Nuon

W. Dana Nuon

May 07, 2015
Tweet

Other Decks in Programming

Transcript

  1. H O M E A U T O M AT

    I O N I N T R O D U C T I O N T O W I T H A R D U I N O A N D I O S W. D A N A N U O N , @ W D N U O N C O C O A H E A D S D C , M A Y 7 , 2 0 1 5
  2. W H AT D I Y H O M E

    A U T O M AT I O N U S E D T O L O O K L I K E …
  3. N O W R E P L A C E

    D W I T H …
  4. @wdnuon G E T T I N G S TA

    R T E D • Arduino starter kits $25-100 on amazon.com • Official Arduino kit ~$90 • Go big for learning • Get a large breadboard • Don’t skimp on parts
  5. @wdnuon D O N ’ T F O R G

    E T ! • Needle-nose pliers for tight places • Pliers for cutting and stripping wire • Multimeter with audible feedback • Lots of jumper cables!
  6. @wdnuon P R O T O T Y P I

    N G B O A R D S • Choose boards with female risers • Easy interface with jumper cables and shields • Desolder the risers or buy boards with solder pads for permanent projects • Don’t use Adafruit Flora boards intended for wearables • Board comparison chart
  7. @wdnuon W I R E L E S S C

    O M M U N I C AT I O N • 433 Mhz: most popular band for basic devices such as switches and sensors. • Low power • Good range (w/external antenna) • Excellent signal penetration • Inexpensive: $2-3 for Tx/Rx pair • Low data rate • Basic protocols, with little or no security • Open source libraries:
 433mhzforarduino
 rc-switch
  8. @wdnuon 4 3 3 M H Z S W I

    T C H E S • Etekcity ZAP 5LX, ~$35 • 5 programmable switches • 2 wireless remotes • On or off; no dimming
  9. @wdnuon T E M P E R AT U R

    E S E N S O R S • Meade TS33C-M, $17 • Temperature and humidity • Weather-resistant • Long battery life
  10. @wdnuon R E D B E A R L A

    B B L E S H I E L D • Popular (lots of support) • iOS framework and sample apps • Arduino libraries:
 nRF8001
 ble-sdk-arduino • Inexpensive ($20-25):
 redbearlab.com/bleshield/
 makershed.com
 store-usa.arduino.cc
  11. @wdnuon B L A C K W I D O

    W L O N G R A N G E B L E S H I E L D • Long range (up to 450 m) • Customizable • Expensive ($79) • Good tutorial on raywenderlich.com
  12. @wdnuon A R D U I N O I D

    E I N S TA L L AT I O N 1. Install latest Arduino IDE in /Applications folder. 2. Install latest Java JRE, from the Terminal:
 java —version 3. Open Arduino.app. 4. Plug in Arduino board. 5. Run Blink test sketch.
  13. @wdnuon E M B E D X C O D

    E I N S TA L L AT I O N 1. Use Xcode instead of the Arduino IDE, which requires Java. 2. Uninstall Java, if preferred. 3. Download and run installer from
 http://embedxcode.weebly.com 4. Create a container folder to hold Arduino projects. 5. Edit ~/Library/Arduino15/preferences.txt to point to container folder:
 sketchbook.path=/Users/me/work/Arduino
  14. @wdnuon L O C A L D E V E

    L O P M E N T C O N F I G U R AT I O N 1. Create a Libraries folder for shared local libraries inside the container folder from previous step 4. 2. Copy library folders from projects to top-level Libraries folder. 3. Be sure to copy; aliases or symlinks don't work. 4. Remove documentation, examples, and any other unnecessary files to speed up compilation. • Don’t use spaces and special characters in projects name and path!
  15. @wdnuon C R E AT I N G A N

    E W A R D U I N O P R O J E C T 1. File > New > Project... 2. Select OS X > embedXcode > embedXcode Local Library 3. Select board type. 4. Use ino extension. 5. Ensure board is plugged in. 6. Build. 7. Verify board LED is blinking.
  16. @wdnuon A D D I N G S H A

    R E D L I B R A R I E S 1. Add #include <Header.h> lines as usual in source files. 2. Core System Libraries reside in:
 /Applications/Arduino.app/Contents/Java/libraries/ 3. Add libraries to Makefile: • APP_LIBS_LIST = for Core System Libraries. • USER_LIBS_LIST = for User libraries. • For fastest compilation, include only necessary libraries. • Names must match library folder names, use spaces as delimiters • Default value of 0 means include no libraries for compiling. • Leave blank to include all libraries (slowest, potential conflicts).
  17. L O O K M O M — N O

    W I R E S !
  18. @wdnuon L I T T L E B I T

    S • http://littleBits.cc • Over 60 modules • Snaps together with magnets • Modulo • Kickstarter project • Four modules per base • Daisy chain bases
  19. @wdnuon M O D U L O • Kickstarter project

    • Est. delivery: Nov 2015 • Four modules per base • Daisy chain bases together for larger projects • Limited modules currently in development
  20. @wdnuon A R D U I N O R E

    S O U R C E S • arduino.cc • adafruit.com • Instructables.com • StackOverflow.com • SparkFun.com • SeeedStudio.com
  21. L O C A L V S . C L

    O U D S O L U T I O N S
  22. @wdnuon L O C A L • Isolation increases security

    • Immune from service disruptions/internet outages • Cannot access remotely over the internet • Cannot integrate with cloud services such as IFTTT.com • Wireless options: • 315/433/915 Mhz RF • Bluetooth LE • WiFi (as long as no hub or router is connected to the internet)
  23. @wdnuon C L O U D • Convenience of remote

    access over the internet • Plug-and-play home automation without having to tinker with electronics • Many commercial products and services require a cloud account: • Google (Dropcam and Nest) • Lutron Caséta • SmartThings • Wink • Privacy and security implications: • Your home is exposed to the internet and vulnerable to attack • Network activity alone can reveal occupancy patterns • Data mining: do you trust third-parties with your data? • Security vulnerabilities can let thieves know when you’re home (or not). • Disruptions due to internet outages, third-party service downtime, DDoS attacks, etc.
  24. @wdnuon W I N K H U B • Inexpensive

    ($0-50) hub from Quirky.com or Home Depot • Requires cloud account • Wink app available on App Store • Interfaces with wide array of devices: locks, thermostats, Dropcam, GE Link, Lutron Caséta • Slow and buggy
  25. @wdnuon W I N K H U B I N

    T E R N A L S • Freescale 450 MHz ARM9 SoC • 128 MB NAND Flash • Wi-Fi, Z-wave, ZigBee, Bluetooth LE, Lutron, Kidde antennas • Custom embedded Linux • Early versions rootable • H T T P : / / S TAT U S B I T S . B L O G S P O T. C O M / 2 0 1 4 / 0 7 / W I N K - H U B - T E A R D O W N . H T M L
  26. @wdnuon G A R A G E M AT E

    4 . 0 • Inexpensive Bluetooth LE garage door control • $35 DIY kit, $50 fully assembled • Control with GarageMate app or write your own • Simple operation via Core Bluetooth:
 - Automation I/O Core Service (0x1815)
 - Digital Output Core Characteristic (0x2A57) • http://btmate.com
  27. @wdnuon W E M O W I F I G

    A R A G E D O O R O P E N E R • ~$60 DIY project • WiFi provided by gutting a Belkin WEMO switch • Integrates with IFTTT (and therefore Apple Watch)
  28. @wdnuon G A R A G E I O •

    Integration with IFTTT and Apple Watch • Wifi-enabled, no pairing required • Requires cloud account for all users (owner and guests) • Allows remote operation over the internet • Blackbox (hub) costs $199-219 • http://garageio.com
  29. @wdnuon AT T R I B U T I O

    N S " H A L 9 0 0 0 " B Y C RY T E R I A - O W N W O R K . L I C E N S E D U N D E R C C B Y 3 . 0 V I A W I K I M E D I A C O M M O N S - H T T P S : / / C O M M O N S . W I K I M E D I A . O R G / W I K I / F I L E : H A L 9 0 0 0 . S V G # / M E D I A / F I L E : H A L 9 0 0 0 . S V G