Book Image

Raspberry Pi Home Automation with Arduino - Second Edition

By : Andrew K. Dennis
Book Image

Raspberry Pi Home Automation with Arduino - Second Edition

By: Andrew K. Dennis

Overview of this book

Table of Contents (16 chapters)
Raspberry Pi Home Automation with Arduino Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
4
Temperature Storage – Setting Up a Database to Store Your Results
Index

Using the humidity reading


We now have a system that reads the humidity of the room in which the Arduino is located. Based on the temperature and humidity data, we can get to know whether the room is damp or there is a chance of flooding.

It would also be useful though, if the Raspberry Pi could alert us in some manner that the room is experiencing high humidity. Perhaps, we could use this data to turn on a dehumidifier.

Adding an LED alert

We are going to start by attaching the Cooking Hacks shield to the Raspberry Pi. Once this is connected, we will attach an LED to the shield's digital pin 2. The following diagram illustrates the setup:

Connect the long pin of the LED to digital pin 2 on the Arduino bridge shield. You can use a breadboard and two wires in order to complete this setup. Next, attach the other leg of the LED to the GRD pin on the bridge shield.

Once you have the LED attached, you can consider writing an application to switch it on and off.

Blinking LED code

The following application...