Slide 1

Slide 1 text

DIY projects with Ruby & Pi Helio Cola @hacrods

Slide 2

Slide 2 text

hac-rods.me Hi, I am Helio Cola! • ~17 years developing SW • ~7 years since I found happiness • ~6 years full time happiness • I go by @hacrods on the internet…

Slide 3

Slide 3 text

Agenda • What is available • Buy, Install, Setup • Development Environment • Sensors & Gadgets & Projects

Slide 4

Slide 4 text

What is available

Slide 5

Slide 5 text

What is available • RaspberryPi: https://www.raspberrypi.org/ • Parallella: https://www.parallella.org/

Slide 6

Slide 6 text

What is available: RaspberryPi • RaspberryPi: https://www.raspberrypi.org/ Raspberry Pi 0 Raspberry Pi 1 Model A+ Raspberry Pi 2 Model B Raspberry Pi 3 Model B Raspberry Pi 0 W(ireless)

Slide 7

Slide 7 text

Pi 0 Pi 1 A+ Pi 2 B Pi 3 B

Slide 8

Slide 8 text

Pi Zero vs Quarter

Slide 9

Slide 9 text

Differences between the Pi’ CPU RAM Display USB Others Pi 0 1Ghz, single-core 512MB CSI (v1.2 only) and Mini HDMI USB On-The- Go ports Pi 0 W 1Ghz, single-core 512MB CSI (v1.2 only) and Mini HDMI USB On-The- Go ports 802.11n Pi 1 A+ 700Mhz 512MB HDMI One USB 2.0 Port No Ethernet Low power 0.5W & 1W Pi 2 B 900MHz quad-core 1GB CSI, DSI, Full HDMI 4 USB 2.0 ports Ethernet Pi 3 B 1.2GHz 64-bit quad-core 1GB CSI, DSI, Full HDMI 4 USB ports Ethernet, 802.11n, Bluetooth & BLE

Slide 10

Slide 10 text

Differences between the Pi’ Price Dimensions GPIO Pi 0 $5 65mm long x 30mm wide x 5mm thick HAT-compatible 40-pin header Pi 0 W $10 65mm long x 30mm wide x 5mm thick HAT-compatible 40-pin header Pi 1 A+ $24.95 65mm x 56mm 40 GPIO pins Pi 2 B $39.95 85.60mm × 56.5mm 40 GPIO pins Pi 3 B $39.95 86.9mm x 58.5mm x 19.1mm 40 GPIO pins

Slide 11

Slide 11 text

What is available: Parallella • Parallella: https://www.parallella.org/ Parallella Microserver (P1600) Parallella Desktop (P1601) Parallella Embedded (P1602)

Slide 12

Slide 12 text

The differences CPU Price RAM HDMI USB GPIO Microserver 18 cores 667 MHz (max 1 GHz) $99 1GB RAM No 1 port No Desktop 18 cores 667 MHz (max 1 GHz) $149 1GB RAM Yes 1 port 24 ports Embedded 18 cores 667 MHz (max 1 GHz) $264.94 1GB RAM Yes 1 port 48 ports

Slide 13

Slide 13 text

Buy, Install, Setup

Slide 14

Slide 14 text

Where to buy • If you are near Pimoroni • If you are near Element14 • If you are near Adafruit • If you are near “Amazon” • Otherwise: find Micro Center near you

Slide 15

Slide 15 text

What to buy • Depend of what you are trying to do • The basics: Pi3 starter kit: board, case, power supply, heatsink, and micro SDHC Pi0 (W) starter kit: board, 2 micro USB to USB adaptor/cable, 4 port USB hub, mini to full HDMI adaptor, and micro SDHC • Extras: Camera, sensors, 7” Touch screen display, Blinkt!, etc

Slide 16

Slide 16 text

Pi3 Starter kit Reference: Amazon, CanaKit Raspberry Pi 3

Slide 17

Slide 17 text

Pi0 Starter kit Reference: Amazon, Raspberry Pi Zero W Complete Starter Kit

Slide 18

Slide 18 text

Sensors Reference: Amazon, KOOKYE 16 in 1 Smart Home Sensor Modules Kit

Slide 19

Slide 19 text

7” Touch Screen display https://www.element14.com/community/docs/DOC-78156/l/raspberry-pi-7- touchscreen-display

Slide 20

Slide 20 text

Camera

Slide 21

Slide 21 text

Blinkt! https://shop.pimoroni.com/products/blinkt

Slide 22

Slide 22 text

Pi 3: Install, Setup • If your machine is Windows/Linux/Mac: https://developer.ubuntu.com/core/get-started/ installation-medias • If your machine is Linux: https://ubuntu-mate.org/raspberry-pi/

Slide 23

Slide 23 text

Pi 3: OS Download • Ubuntu Core, Ubuntu Mate, Windows 10 IoT Core Core: https://developer.ubuntu.com/core/get-started/ raspberry-pi-2-3 Mate: https://ubuntu-mate.org/download/ Windows (still on my TODO list): http://ms- iot.github.io/content/en-US/Downloads.htm

Slide 24

Slide 24 text

Pi 3: Installation on Mac • More or less these were my steps: 1. Download the image, un-archive, insert SD card 2. Run:

Slide 25

Slide 25 text

Pi 3: Setup • First boot: it will take longer • It may automatically extend the file system (Core) • Or you will have to do it manually (Mate) • Follow the instructions on the display • Configure your network • And an administrator account

Slide 26

Slide 26 text

Pi 3: On a TV

Slide 27

Slide 27 text

Pi 3: On a touch screen

Slide 28

Slide 28 text

Development Environment

Slide 29

Slide 29 text

(My) Development Environment • UbuntuMate OS: a GUI on top an Ubuntu distribution • ruby 2.1.5p273 (2014-11-13) [arm-linux-gnueabihf] • rvm & ruby 2.5 • Text Editor: vi or Mac/Atom/Git/RaspberryPi • Firefox: more than enough • A monitor or TV, keyboard and mouse

Slide 30

Slide 30 text

7” Touch Screen display

Slide 31

Slide 31 text

7” Touch Screen display

Slide 32

Slide 32 text

7” Touch Screen display

Slide 33

Slide 33 text

Sensors

Slide 34

Slide 34 text

PIR Motion Sensor

Slide 35

Slide 35 text

Smoke and Combustible Gas

Slide 36

Slide 36 text

Buzzer

Slide 37

Slide 37 text

Carbon Monoxide

Slide 38

Slide 38 text

Digital touch

Slide 39

Slide 39 text

Flame

Slide 40

Slide 40 text

Vibration

Slide 41

Slide 41 text

Temperature and Humidity

Slide 42

Slide 42 text

Sound

Slide 43

Slide 43 text

Water level

Slide 44

Slide 44 text

Motion Sensor App

Slide 45

Slide 45 text

Motion Sensor App • My Hello World for RaspberryPi 3 • Detect “movement” • Do something: • Call an API • Sound an alarm • Turn on the lights and play a music • Turn on the Camera & record it until no more presence • Reporte event + video

Slide 46

Slide 46 text

Motion Sensor App Pi3 Rails App Local at your house, AWS, Heroku, etc Pi0W Front door Pi0W Back door Pi0W Game room

Slide 47

Slide 47 text

Motion Sensor App What you will need: • Raspberry Pi3 starter kit • Camera • PIR motion sensor • 7” touch screen (optional)

Slide 48

Slide 48 text

Motion Sensor App • Ruby as usual: rvm, ruby, rack, rails, rails-api, postgres, etc. Data model

Slide 49

Slide 49 text

Motion Sensor App • CRUD admin app & api to allow events to come in

Slide 50

Slide 50 text

PIR Motion Sensor

Slide 51

Slide 51 text

PIR Motion Sensor Reference: https://cdn-learn.adafruit.com/downloads/pdf/pir-passive-infrared-proximity-motion-sensor.pdf Passive infrared Pyroelectric IR motion

Slide 52

Slide 52 text

Monitoring the sensor Reference: https://github.com/jwhitehorn/pi_piper

Slide 53

Slide 53 text

(My) Home monitoring system

Slide 54

Slide 54 text

(My) Home monitoring system experiment • Left it running on my house for 2 months • A friend came by regularly to check the house • And walked through the sensor • And I monitored everything from the other side of the globe

Slide 55

Slide 55 text

Time-Lapse Camera

Slide 56

Slide 56 text

Time-Lapse Camera • Take pictures periodically • Blink lights Reference: https://projects.raspberrypi.org/en/projects/raspberry-pi-zero-time-lapse-cam

Slide 57

Slide 57 text

Time-Lapse Camera What you will need: • Raspberry Pi0 starter kit • GPIO Hammer Header (solderless) • Blinkt (optional) • Camera • Reused cardboard box & sunglass • 5V Power pack

Slide 58

Slide 58 text

Time-Lapse Camera

Slide 59

Slide 59 text

Time-Lapse Camera

Slide 60

Slide 60 text

Time-Lapse Camera

Slide 61

Slide 61 text

Time-Lapse Camera DEMO TIME!!!

Slide 62

Slide 62 text

References http://rayhightower.com/ https://www.raspberrypi.org/ https://www.parallella.org/ https://developer.ubuntu.com/core/get-started/installation-medias https://ubuntu-mate.org/raspberry-pi/ https://developer.ubuntu.com/core/get-started/raspberry-pi-2-3 https://ubuntu-mate.org/download/ http://ms-iot.github.io/content/en-US/Downloads.htm https://www.element14.com/community/docs/DOC-78156/l/raspberry-pi-7- touchscreen-display https://cdn-learn.adafruit.com/downloads/pdf/pir-passive-infrared-proximity- motion-sensor.pdf https://codingyoda.com/Raspberry-Pi-Email-PIR-Sensor.php https://github.com/jwhitehorn/pi_piper https://projects.raspberrypi.org/en/projects/raspberry-pi-zero-time-lapse-cam http://bit.ly/k8s-rpi

Slide 63

Slide 63 text

Thank you! http://bit.ly/k8s-rpi Helio Cola @hacrods