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

Testing our thermostat and fan


We have our hardware set up and the code ready. Now we can test the thermostat and see it in action with a device connected to the mains electricity. We will first attach a fan and then run the sketch to switch it on and off.

Attaching the fan

Ensure that your Arduino is powered down and that the fan is not plugged into the wall. Using a wire stripper and cutters, cut one side of the cable that connects the plug to the fan body. Take the end of the cable attached to the plug, and attach it to the NO point on the relay. Use a screwdriver to ensure that it is fastened correctly. Now, take the other portion of the cut cable that is attached to the fan body, and attach this to the COM point. Once again, use a screwdriver to ensure that it is fastened securely to the relay. Your connection should look as follows:

You can now reattach your Arduino to the computer via its USB cable. However, do not plug the fan into the wall yet.

Starting your thermostat application

With...