Contenidos
Introduction to relay 220V for Arduino
A relay is a relatively simple electromechanical device. Its operation consists of a coil that is energised (in this case to 5v) when this coil is driven generates a magnetic field that moves a metal inside and it opens or closes a circuit, i.e., as if it were an electric switch.
Principle of operation
As he has been said the relay is a mechanical system that frees two circuits. The relay works of two ways different, well normally closed or normally open:
- Normally closed (NC): the circuit is always closed until the relay will be excited. I.e. If we connect a light bulb will remain off until we have a high signal from Arduino. (the opposite of logic, high signal off signal under power).
- Normally open (NO): the circuit is open until we give a high signal, the circuit works the same as the sign of our Arduino.
Usually the relays have one or more connections of each type, according to for what you may need to use.
Characteristics of the sensor relay for Arduino
Work voltage | 5V DC |
Dimensions | 2.0 cm x 2.0 cm x 0.3 cm |
Voltage maximum | 230V |
Maximum intensity | 10A |
Connection of the relay for Arduino
The relay for Arduino prototyping design
Activated with a touch sensor, click here to find out more.
Wiring diagram of relay with an Arduino
In the schema has been added the part of connection to 220V, this tutorial is not among the basic have the danger of working with this tension. For this design will use an electric male, one of the wires connect it directly to the light bulb and the other to common relay, NC output connects to the bulb (can connect in officer and not vice versa). By safety recommend not have the Arduino connected to a PC and feed it with a feeder of mobile and whenever is did a change is disconnect from the network for work without tension. We insist that there is some danger in this circuit.
Programming of the relay
Explanation prior
This circuit will use a LED in parallel with the relay to check it and the capacitive sensor will light it or turning (as we have NO or NC connected)
Code
1 2 3 4 5 6 7 8 9 10 11 12 | TOUCH SENSOR BUTTON WITH LED FOR ARDUINO pinLED int = 13; int pinTouch = 8; void setup() {} pinMode (pinLED, OUTPUT); pinMode (pinTouch, INPUT); } void loop() {} digitalWrite (pinLED, digitalRead (pinTouch)); } |
Once programmed we will see how it changes the LED
Video of operation
Buy relays 220v for Arduino
In this link you will see a selection of several relays that you can buy at Amazon.