Connecting relay to Ardunio

Connecting relay to Ardunio

Daniil Zhuk
The findings of the microcontroller installed in the Arduino can produce a very small current - up to 20 mA, not to mention the voltage that does not exceed 5 V.

With the help of transistors, you can raise this threshold to a dozen or more amperes and up to 100 V DC, but what should you do if you need to connect an alternating voltage of a relatively large current, and it is also safe for Arduino? The solution is - a relay!

To implement the project from this article, we need the following components:
  • Arduino Uno R3
  • Single Channel Relay (250V / 10A)
  • Breadboard
  • Connection wires
BRIEF OVERVIEW OF THE MODULE

The standard relay for Arduino is a complete module, for switching the load through which it is only necessary to connect a break in the power wire to the power screw comb.

The board has LEDs that indicate the current state of the coil, and the necessary matching circuit (on a bipolar transistor) so that the module will correctly work on the circuit and the trip.

The maximum voltage, switching relay - 250V, current - up to 10A.

 

SCHEME OF CONNECTION TO ARDUINO
The relay installed on the module has 2 types of contacts to which the switched load is connected - it is normally open and normally closed. The NO contact is open until a control signal arrives at the relay, and is closed when the logic level of the signal is high. NC-contact - on the contrary, opens when giving a signal.

WORKING WITH MODULE IN ARDUINO IDE
The relay is controlled as any low-power load connected to the Arduino pins — for example, the same LED. If you connect a relay to pin 13 and load Blink, you will hear clicks of switching the relay every second. Do not forget to configure the pinMode foot output function (PIN, OUTPUT); otherwise, the construction will not work:

// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}

The relay is extremely not recommended to switch using PWM at any frequency - almost the only parameter that determines its resource is the number of switches. After its termination, the relay will begin to “stick”, switch more slowly and with difficulty, or else not switch at all. The more often you “pull” the relay, the less is its service life.

I hope you now understand how to work with the relay. Remember that you should not overload it with currents greater than half the maximum (that is, more than 5A) for a long time. Then the relay will last a long time!

Add a comment

* Comments must be approved before being displayed.