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

Book Description

If you have the will this book will show you the way to combine the Raspberry Pi with an Arduino board to automate your entire home. With practical projects and insightful chapters, it’s a hobbyist’s dream.

  • Learn how to dynamically adjust your living environment with detailed step-by-step examples
  • Discover how you can utilize the combined power of the Raspberry Pi and Arduino for your own projects
  • Revolutionize the way you interact with your home on a daily basis

In Detail

Low-cost and high-performing, with a massively diverse range of uses and applications, the Raspberry Pi is set to revolutionize the way we think about computing and programming. By combining the Raspberry Pi with an Arduino board you'll be able to revolutionize the way you interact with your home and become part of a rapidly growing group of hobbyists and enthusiasts.

This essential reference will guide you through a series of exciting projects that will allow you to automate your very own home. With easy-to-follow, step-by-step examples, diagrams, and explanations you will not only find it incredibly productive but also highly engaging and informative.

Assuming no prior knowledge, our detailed practical examples will guide you through building hardware and software solutions using the Raspberry Pi and Arduino. You will learn how you can use thermistors and relays to keep cool and stay in the shade whilst also utilizing electrical motors and photoresistors. These meticulously designed tutorials will form the basis of automating your entire home and getting you started with dozens of potential projects.

Table of Contents

  1. Raspberry Pi Home Automation with Arduino
    1. Table of Contents
    2. Raspberry Pi Home Automation with Arduino
    3. Credits
    4. About the Author
    5. Acknowledgement
    6. About the Reviewer
    7. www.PacktPub.com
      1. Support files, eBooks, discount offers and more
      2. Why Subscribe?
      3. Free Access for Packt account holders
    8. 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
    9. 1. An Introduction to the Raspberry Pi, Arduino, and Home Automation
      1. What we will explore in this book
      2. History and background of the Raspberry Pi
        1. Raspberry Pi hardware specifications
        2. Dimensions
        3. 3.5mm analog audio jack
        4. Composite RCA port
        5. Two USB 2.0 ports plus one micro USB
        6. HDMI port
        7. SD card port
        8. 256 MB/512 MB SDRAM shared with GPU
        9. CPU
        10. GPU
        11. Ethernet port
        12. GPIO pins
      3. History and background of Arduino
        1. Raspberry Pi to Arduino shield connection bridge
        2. Shield specifications
          1. XBee socket
          2. Power source selector
          3. UART
          4. Digital GPIO pins
          5. Serial Peripheral Interface (SPI) pins
          6. In Circuit Serial Programmer (ICSP) connector
          7. Power pins
          8. Analog inputs
          9. Raspberry Pi GPIO connector
        3. Soldering
        4. Writing software for the Arduino
      4. What home automation is
        1. A 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
      5. Summary
    10. 2. Getting Started Part 1 – Setting up Your Raspberry Pi
      1. The SD card – our Raspberry Pi's storage device
      2. Pre-installed SD card versus a blank one
      3. Setting up the SD card
        1. Formatting our card
          1. Formatting instructions for Windows 7
          2. Formatting instructions for Mac OS X
          3. Formatting instructions for Linux
      4. BerryBoot – our tool for installing an operating system
        1. Downloading the BerryBoot zip
          1. Windows
          2. Mac
          3. Linux
        2. Hooking up the Raspberry Pi
        3. Downloading the right operating system
        4. Installing Raspbian
        5. Installation complete
          1. Windows users
          2. Mac and Linux users
      5. Summary
    11. 3. Getting Started Part 2 – Setting up Your Raspberry Pi to Arduino Bridge Shield
      1. Raspberry Pi to Arduino bridge shield
        1. Checking which version of the Raspberry Pi we have
        2. Setting up the Raspberry Pi to Arduino shield and LED
        3. Installing the software
        4. The Arduino IDE
          1. A quick look at the language
        5. arduPi – a library for our Raspberry Pi and Arduino shield
        6. Installing arduPi
          1. Leafpad – a text editor
        7. Blinking LED application
          1. A guide to the code
          2. Compiling and running our application
      2. Summary
    12. 4. Our First Project – A Basic Thermometer
      1. Building a thermometer
        1. Setting up our hardware
          1. An introduction to resistors
          2. Thermistor
          3. 10K Ohm resistor
          4. Wires
          5. Breadboard
        2. Connecting our components
          1. Sanity check
      2. Software for our thermometer
        1. Geany IDE
          1. Installing the IDE
        2. An introduction to Makefiles
        3. Thermometer code
        4. Writing our application
        5. Compiling and testing
        6. What if it doesn't work
        7. Up and running
      3. Summary
    13. 5. From Thermometer to Thermostat – Building upon Our First Project
      1. Safety first
      2. Introducing the thermostat
      3. Setting up our hardware
        1. Relays
        2. Connecting the relay
      4. Setting up our software
        1. A program to test the relay
        2. Installing screen
        3. cURL
        4. Thermostat code
      5. Testing our thermostat and fan
        1. Attaching the fan
        2. Starting your thermostat application
          1. Debugging problems
      6. Summary
    14. 6. Temperature Storage – Setting up a Database to Store Your Results
      1. 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 some SQL
      2. Apache web server
        1. Setting up a basic web server
        2. WSGI
          1. Setting up WSGI
        3. Creating a Python application to write to our database
        4. Conclusion
      3. HTSQL
        1. Download HTSQL
        2. Configuring HTSQL
      4. Testing our Arduino shield with our database
      5. Summary
    15. 7. Curtain Automation – Open and Close the Curtains Based on the Ambient Light
      1. Photoresistors
      2. Motor shield and motors
      3. Setting up the photoresistor
        1. Wiring up the components
        2. Testing the photoresistor with software
        3. Debug
        4. Setting up the motor shield
        5. Wiring up the components
      4. Curtain control application
        1. Pulse Width Modulation
        2. Threads
        3. Writing our code
        4. Debugging problems
        5. Connecting to your blinds/curtains
        6. Setting the timing
        7. Attaching the hardware
        8. Debugging problems
      5. Summary
    16. 8. Wrapping up
      1. A brief review of what we have learned
      2. Next steps
        1. 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. Open collector driver
          5. Buffered I/O
          6. Atmel ATmeg chip microcontroller
          7. Convertors – analog to digital and digital to analog
          8. Writing software for the Gertboard
      3. Ideas for next step 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
    17. 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. Apache
      10. Electronics
      11. Packt Publishing titles
      12. Home automation technology
      13. 3D printing
      14. EEG headsets
      15. Miscellaneous resources
    18. Index