Hack the way to your future home

Hack the way to your future home

Slides for my talk at the Open Tech School Conference in Dortmund, 15.08.2015

E506e5bd38075f5fe7f9e53a597c1f3a?s=128

Martin Schuhfuss

August 15, 2015
Tweet

Transcript

  1. Hack the way to your future home Open Tech School

    Conference 2015
 Dortmund Martin Schuhfuß – @usefulthink
  2. Hi!

  3. I love the idea of home-automation.

  4. That future is already there!

  5. Smart Lightbulbs Phillips Hue, Osram Lightify, GE Link, …

  6. $$$

  7. other smart home stuff Power Sockets, Lightswitches, Media Control, Windowblinds,

    Climate control, …
  8. $$$

  9. But there is hope. Nothing these things do is magic.

    It's all just simple* electronics. *(more or less, depends on who you ask)
  10. Contents • Overview of Microcontrollers and small-scale Computers • A

    (very) short introduction to Hardware-Programming • Building a WiFi-Controlled Powerstrip
  11. Computers & MCUs

  12. Arduino UNO ATMega328p MCU 16MHz / 8Bit / 2kB RAM

    1kB EEPROM / 32kB Flash no Operating System Tessel2 Mediatek MT7620n 580MHz / 64MB RAM 32MB Flash Linux / OpenWRT OS Raspberry PI2 ARMv7 QuadCore
 900MHz / 1 GB RAM SD-Card (several GB) regular Operating-System ESP12 Espressif ESP8266EX 80MHz / 64kB + 96 kB RAM 4MB Flash no Operating System Computers & MCUs Microcontroller Single board computer (any device with a display contains something like this) (comparable to a WiFi- router) (comparable to a decent smartphone)
  13. Arduino UNO Programmed in C/C++ USB (device), GPIO minimal power-consumption

    Tessel2 mainly JS/Python/Rust USB, WiFi, LAN, GPIO, … runs node.js! Raspberry PI2 It's a complete computer
 USB, LAN, GPIO, HDMI, … runs everything
 ESP12 C/C++, LUA UART, GPIO, WiFi ultra-small (15x23mm) Computers & MCUs ~25€ ~2€ ~30€ ~40€ Microcontroller Single board computer (bare module) ~10€ (prototype board)
  14. So how do they talk to other electronics?

  15. GPIO / General Purpose Input and Output / can be

    used as output or input / Logic-Levels: HIGH (on) or LOW (off) / HIGH Voltage is either 5V (Arduino) or 3.3V (all other) / communication with digital protocols like UART, I2C or SPI GPIO-Pins
  16. SWITCHING AN LED "Breadboard" Arduino UNO LED Resistor Wires Hardware-Hacking

    101
  17. Pin 9 "Breadboard" Arduino UNO LED Resistor Wires SWITCHING AN

    LED Hardware-Hacking 101
  18. DIMMING THE LED Hardware-Hacking 101 Oscilloscope LED Light

  19. USING EXTERNAL INPUT Analog Input A0 Power Supply +/- Potentiometer

    Hardware-Hacking 101
  20. ESP8266

  21. ESP8266 / tiny, versatile, has WiFi and is incredibly cheap

    / bare modules are not very beginner friendly: / soldering and additional components are required / no USB interface: needs USB to UART converter to program / development boards with USB are available (nodemcu DevKit) / best option for electronics-projects you want to keep
  22. Building a WiFi Powerstrip with the ESP12 ESP12e Screw terminals

    (220V AC) 5V USB-Charger
 (ripped apart & shrinkwrapped) Programming adapter (USB <-> Serial) Relays
 (+more stuff) "Debugging" Interface
  23. RELAYS / Mechanical Switch operated by an electromagnet / Control-

    and load-circuit are fully seperated / Switch high loads with a low control-voltage / needs additional amplification to drive the coil if used with very low power devices Magnetic Coil Switching Contacts Transistor (Amplifier) Screw Terminals
  24. SERIOUS WARNING NEVER MESS WITH MAINS-POWER (220V AC) UNLESS YOU

    KNOW PRECISELY WHAT YOU ARE DOING.
  25. THE RESULT

  26. nodemcu http://nodemcu.com/index_en.html / Firmware for the ESP8266-family running a Lua-interpreter

    / API modeled after node.js, provides Filesystem, GPIO, JSON, Networking and other modules for communication / very limited resources (around 25kB heap available after boot)
  27. Programming with nodemcu / micro HTTP-Server written in Lua /

    Rest-oriented interface for the sockets / full source-code on github:
 https://github.com/usefulthink/nodemcu-powerstrip http://nodemcu.com/index_en.html switching the relays connect to a network
 (simplified) handle http-requests
 (my implementation)
  28. How to get started?

  29. / Get an Arduino / Tessel / Raspberry / You'll

    need a Breadboard, some jumper-wires and an idea what to do / Buy from Chinese sellers, delivery takes longer but it's way cheaper / Find people to help you or join a Hackerspace* near you How to get started? *(see
  30. How to get started? Remember: There is no fairy-dust involved.

    It's all just simple electronics.
  31. Thanks! Martin Schuhfuß – m.schuhfuss@gmail.com – @usefulthink (contact me if

    you have any questions, even after the conference) https://github.com/usefulthink/ama