Arduino Relay Tutorial for Home Automation
Arduino Relay Tutorial for Home Automation
14 T
Tutorial 14: Use of the KY-019 Relay
Objective.
Materials
1 Arduino Uno
1 cable AB
1 Breadboard
1 relay module, (or a single relay, but you need to look for the diagram of
connection).
AR
14.1 T
What is the Relay?
The relay is the element you need if you want to manage large voltages and
currents (like those you might have in the electrical network of your house). They
It's simply about an electrical switch that you can turn on and off.
sending signals from your Arduino board (or any other controller
similar). This allows you to turn the light in your room on and off
when someone enters, until making a complete smart home. The limit
here is your imagination.
Although there are many types of relays and each has a function and
a different working range. Simply put, we can say that a
A relay is basically a coil that moves a circuit.
The idea is that when you pass a small current through that
coil, you generate a magnetic field. This field attracts a small plate
metallic (the switch) that moves to open or close another circuit
independent. This allows for a small current like the one that you
with your Arduino, you can turn on or off the element you want,
in the same way as when you press the switch in your living room
AR
14.2 T
Connection.
The connection is really simple but deserves a separate chapter since you are going to
to work with hazardous materials. The steps you must follow are the
next:
Put the relay module as a switch, that is, cut the cable that
power the device and connect it through the relay.
Make sure that the cables are securely fastened and that there is no possibility of
to touch them accidentally.
Code.
14.3 T
The code is really very simple, it is to turn off and on pin 9, which in
this case sends a 5v pulse to the relay and allows it to handle higher voltages
high and turn on any common electronic device at home. With this
for example we can start to create larger applications, such as controlling
All the lights in the house, which react to some type of sensor. Like
I repeat the limit is imagination.
Question section.
2 Normally Closed, then the light bulb would have been on and to the
applying a pulse, it would have turned off executing the orders in reverse.