Book Image

Arduino By Example

By : Adith Jagadish Boloor, Adith Jagdish Boloor
Book Image

Arduino By Example

By: Adith Jagadish Boloor, Adith Jagdish Boloor

Overview of this book

Table of Contents (18 chapters)
Arduino by Example
Credits
About the Author
Acknowledgements
About the Reviewers
www.PacktPub.com
Preface
Index

Using relays to control appliances


Here, we learn what relays are and how they can be used to control everyday electrical/electronic appliances. Also, to make them useful, we will connect them to the Arduino and create a Blink.ino program, except this time it will be your lamp that will be turning on and off.

Understanding the basics of the relay

A relay is basically an electrical device, usually consisting of an electromagnet, which is activated by a passing of current in one circuit to open or close another circuit. You could think of it as a switch that requires current to turn on or off.

Why can't we simply connect a pin of the Arduino to the switchboard, and switch the fan on or off like we do with an LED? Well, an Arduino can output only 2-5V, whereas the fan or any other appliance in your house uses around 200-250V that comes from the electricity grid. This number is different depending on where you are from. Also, we cannot simply connect the Arduino to the switch of the fan because...