E-Book description:
The world of home automation is an exciting field that has exploded over the past
few years with many new technologies in both the commercial and open source
worlds. This book provides a gateway for those interested in learning more about
the topic and building their own projects.
With the introduction of the Raspberry Pi computer in 2012, a small and powerful
tool is now available to the home automation enthusiast, programmer, and electronic
hobbyist that allows them to augment their home with sensors and software.
Combining the Raspberry Pi with the power of the open source Arduino platform,
this book will walk you through several projects for building electronic sensors and
introduce you to software that will record this data for later use.
E-Book Author:
Andrew K. Dennis
E-Book Table of Contents:
Preface….1
Chapter 1: An Introduction to the Raspberry Pi, Arduino,
and Home Automation….7
What we will explore in this book….7
History and background of the
Raspberry Pi….8
Raspberry Pi hardware specifications….9
Dimensions….10
3.5mm analog audio jack….10
Composite RCA port….10
Two USB 2.0 ports plus one micro USB….10
HDMI port….11
SD card port….11
256 MB/512 MB SDRAM shared with GPU….11
CPU….11
GPU….11
Ethernet port….12
GPIO pins….12
History and background of Arduino….12
Raspberry Pi to Arduino shield connection bridge….13
Shield specifications….13
XBee socket….14
Power source selector….14
UART….14
Digital GPIO pins….14
Serial Peripheral Interface (SPI) pins….15
In Circuit Serial Programmer (ICSP) connector….15
Power pins….15
Analog inputs….15
Raspberry Pi GPIO connector….15
Soldering….15
Writing software for the Arduino….16
What home automation is….17
A history of home automation….17
X10 – a standard is born….18
The dot.com boom and open source – a new set of technologies….19
Commercial products….20
Arrival of the Raspberry Pi….21
Summary….21
Chapter 2: Getting Started Part 1 – Setting up Your Raspberry Pi….23
The SD card – our Raspberry Pi’s storage device….23
Pre-installed SD card versus a blank one….24
Setting up the SD card….24
Formatting our card….25
Formatting instructions for Windows 7….25
Formatting instructions for Mac OS X….26
Formatting instructions for Linux….27
BerryBoot – our tool for installing an operating system….28
Downloading the BerryBoot zip….28
Windows….28
Mac….28
Linux….29
Hooking up the Raspberry Pi….29
Downloading the right operating system….30
Installing Raspbian….31
Installation complete….34
Windows users….35
Mac and Linux users….36
Summary….37
Chapter 3: Getting Started Part 2 – Setting up Your
Raspberry Pi to Arduino Bridge Shield….39
Raspberry Pi to Arduino bridge shield….39
Checking which version of the Raspberry Pi we have….40
Setting up the Raspberry Pi to Arduino shield and LED….41
Installing the software….42
The Arduino IDE….42
A quick look at the language….43
arduPi – a library for our Raspberry Pi and Arduino shield….45
Installing arduPi….45
Leafpad – a text editor….46
Blinking LED application….48
A guide to the code….49
Compiling and running our application….50
Summary….51
Chapter 4: Our First Project – A Basic Thermometer….53
Building a thermometer….54
Setting up our hardware….54
An introduction to resistors….55
Thermistor….55
10K Ohm resistor….56
Wires….56
Breadboard….56
Connecting our components….56
Software for our thermometer….58
Geany IDE….58
Installing the IDE….58
An introduction to Makefiles….59
Thermometer code….61
Writing our application….61
Compiling and testing….68
What if it doesn’t work….69
Up and running….70
Summary….70
Chapter 5: From Thermometer to Thermostat – Building upon
Our First Project….71
Safety first….72
Introducing the thermostat….72
Setting up our hardware….73
Relays….74
Connecting the relay….74
Setting up our software….75
A program to test the relay….75
Installing screen….77
cURL….79
Thermostat code….79
Testing our thermostat and fan….85
Attaching the fan….86
Starting your thermostat application….86
Debugging problems….87
Summary….87
Chapter 6: Temperature Storage – Setting up a Database to
Store Your Results….89
SQLite….89
Installing SQLite Version 3.x….90
Creating a database….91
A table to record our temperature….91
A table to record our rooms….92
Writing some SQL….92
Apache web server….94
Setting up a basic web server….94
WSGI….97
Setting up WSGI….98
Creating a Python application to write to our database….100
Conclusion….104
HTSQL….104
Download HTSQL….105
Configuring HTSQL….106
Testing our Arduino shield with our database….108
Summary….109
Chapter 7: Curtain Automation – Open and Close the
Curtains Based on the Ambient Light….111
Photoresistors….112
Motor shield and motors….112
Setting up the photoresistor….112
Wiring up the components….113
Testing the photoresistor with software….114
Debug….117
Setting up the motor shield….117
Wiring up the components….117
Curtain control application….119
Pulse Width Modulation….119
Threads….119
Writing our code….120
Debugging problems….125
Connecting to your blinds/curtains….125
Setting the timing….125
Attaching the hardware….126
Debugging problems….126
Summary….127
Chapter 8: Wrapping up….129
A brief review of what we have learned….130
Next steps….130
Prototyping Pi Plate….131
The wiringPi library….133
The Gertboard….134
Introduction to the Gertboard components….134
GPIO PCB expansion board….135
GPIO Pins….135
Motor controller….136
Open collector driver….136
Buffered I/O….136
Atmel ATmeg chip microcontroller….137
Convertors – analog to digital and digital to analog….137
Writing software for the Gertboard….137
Ideas for next step projects….138
Expanding the curtain automation tool to include temperature sensing….138
Changing the motor on the curtain automation project to a
stepper motor….139
Switching lights on with a photoresistor….139
Holiday lights from LEDs….139
The future of home automation….139
3D printing….139
RFID chips….140
EEG headsets….140
Summary….141
Appendix: References….143
Raspberry Pi….143
Raspberry Pi to Arduino bridge shield….144
Linux….144
Python….145
C/C++….145
Arduino….145
SQL….146
HTSQL….146
Apache….146
Electronics….147
Packt Publishing titles….147
Home automation technology….147
3D printing….148
EEG headsets….148
Miscellaneous resources….149
Index….151