O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Raspberry Pi Home Automation with Arduino - Second Edition

Book Description

Unleash the power of the most popular microboards to build convenient, useful, and fun home automation projects

In Detail

Revolutionize the way you interact with your home and become part of the rapidly growing group of hobbyists and enthusiasts by combining the powerful Raspberry Pi with an Arduino board.

Starting with an introduction to the Raspberry Pi and Arduino boards you will set up your very own home automation system through a series of exciting projects, making your life a lot easier.

Build a thermostat, a Raspberry Pi control device, a parcel delivery detector, and a water and damp detector, and then move on to more complex projects including a motor mechanism to control your curtains.

By the end of this practical guide, you will be a confident user who can program, set up, and run a wide range of applications using both the Raspberry Pi and the Arduino.

What You Will Learn

  • Set up the Raspberry Pi and the Cooking Hacks Arduino bridge shield
  • Work with electronic components to build small circuits
  • Develop applications that interact with your circuits
  • Use thermistors, FSRs, and photoresistors to monitor and control your surroundings
  • Communicate with your Raspberry Pi from an Arduino Uno via Ethernet
  • Send yourself e-mail updates when a parcel arrives at your home
  • Control your own mains power with a relay shield and even connect a motor to your Raspberry Pi
  • Build a device that checks for damp/flooding using the Arduino bridge shield and Raspberry Pi

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Table of Contents

  1. Raspberry Pi Home Automation with Arduino Second Edition
    1. Table of Contents
    2. Raspberry Pi Home Automation with Arduino Second Edition
    3. Credits
    4. About the Author
    5. About the Reviewers
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    8. 1. An Introduction to the Raspberry Pi, Arduino, and Home Automation
      1. History and background of the Raspberry Pi
      2. History and background of the Arduino
        1. Raspberry Pi to Arduino shield connection bridge
        2. Soldering
        3. Creating software for the Arduino
      3. What is home automation?
        1. History of home automation
        2. X10 – a standard is born
        3. The dot-com boom and open source – a new set of technologies
        4. Commercial products
        5. Arrival of the Raspberry Pi
      4. Summary
    9. 2. Getting Started – Setting Up Your Raspberry Pi and Arduino
      1. The SD card – our Raspberry Pi's storage device
      2. Preinstalled SD card versus a blank SD card
      3. A note on Noobs
      4. Downloading Raspbian
      5. Setting up the SD card and installing Raspbian
        1. Raspberry Pi SSH setup
      6. Arduino
        1. Installing the IDE on your Raspberry Pi
        2. A quick guide to the Arduino IDE
        3. Using the Arduino to Raspberry Pi connection bridge
      7. Summary
    10. 3. Central Air and Heating Thermostat
      1. Safety first
      2. Introducing the thermostat
      3. Setting up our hardware
        1. Adding the Ethernet shield
        2. Relays
        3. Connecting the thermistor
      4. Setting up our software
        1. Thermostat software
      5. Testing our thermostat and fan
        1. Attaching the fan
        2. Starting your thermostat application
        3. Testing the JSON response
      6. Next steps
        1. Attaching the device to your heating system or a similar appliance
          1. Adding a potentiometer
          2. Adding an LCD screen
      7. Summary
    11. 4. Temperature Storage – Setting Up a Database to Store Your Results
      1. SSH
      2. SQLite
        1. Installing SQLite Version 3.x
        2. Creating a database
          1. A table to record our temperature
          2. A table to record our rooms
        3. Writing SQL queries
        4. Creating a Python application to write to our database
          1. Checking the results
          2. Adding a cron job
      3. HTSQL
        1. Downloading HTSQL
        2. Configuring HTSQL
      4. Summary
    12. 5. Parcel Delivery Detector
      1. Wiring up the parcel sensor
        1. An introduction to resistors
          1. Pressure sensor – force-sensing resistor
          2. 10K ohm resistor
        2. Connecting the components to the Arduino
        3. Writing our software
      2. Updating the Raspberry Pi database
      3. A web-based Python application
        1. Setting up SMTP
        2. Our Python application
          1. Starting the web service
          2. Testing our application
      4. Installing the parcel detector
        1. Testing the complete setup
      5. Next steps
        1. Upgrading from Ethernet to a wireless system
        2. Checking the shipping details
        3. Replacing the pressure sensor with a camera and image recognition
      6. Summary
    13. 6. Curtain Automation – Open and Close the Curtains Based on the Ambient Light
      1. Introduction to the Arduino bridge shield
        1. Installing arduPi
          1. Photoresistors
          2. Motor shield and motors
      2. Setting up the photoresistor
      3. Wiring up the components
      4. Testing the photoresistor with software
        1. Makefiles
      5. Setting up the motor shield
      6. Wiring the components to the shield
      7. Curtain control application
        1. Pulse width modulation
        2. Threads
        3. Writing our code
      8. Connecting to your blinds/curtains
        1. Setting the timing
        2. Attaching the hardware
        3. Debugging problems
      9. Next steps
        1. Mounting the photoresistor outdoors
        2. Adding a stepper motor
      10. Summary
    14. 7. Water/Damp Detection – Check for Damp/Flooding in Sheds and Basements
      1. A brief note on dampness
      2. Damp detection system
        1. Arduino circuit
        2. Sketch code
      3. Database updates
      4. Python code
        1. Adding a cron job
      5. Using the humidity reading
        1. Adding an LED alert
          1. Blinking LED code
          2. Expanding the LED functionality
        2. Connecting a dehumidifier
      6. Water detection
      7. Summary
    15. 8. Wrapping Up
      1. A brief review of the second edition of Raspberry Pi Home Automation with Arduino
      2. Next steps
        1. The prototyping Pi Plate
        2. The wiringPi library
        3. The Gertboard
        4. Introduction to the Gertboard components
          1. GPIO PCB expansion board
          2. GPIO pins
          3. Motor controller
          4. The open collector drivers
          5. Buffered I/O
          6. Atmel ATmega microcontroller
          7. Convertors – analog to digital and digital to analog
          8. Creating software for the Gertboard
      3. Ideas for future projects
        1. Expanding the curtain automation tool to include temperature sensing
        2. Changing the motor on the curtain automation project to a stepper motor
        3. Switching lights on with a photoresistor
        4. Holiday lights from LEDs
      4. The future of home automation
        1. 3D printing
        2. RFID chips
        3. EEG headsets
      5. Summary
    16. A. References
      1. Raspberry Pi
      2. Raspberry Pi to Arduino bridge shield
      3. Linux
      4. Python
      5. C/C++
      6. Arduino
      7. SQL
      8. HTSQL
      9. Electronics
      10. Packt Publishing titles
      11. Home automation technology
      12. 3D printing
    17. Index