Arduino + relay

In this article we consider the work of Arduino with electromagnetic relays SH-05VDC (Figure 1). In this case, four module (each module – on a separate electrical circuit), but we will use only one relay module with four.

Figure 1 – 4-relays module SH-05VDC

Purpose relays outputs the following

VCC: (+) supply.
In1 – In4: control relays outputs 1-4.
GND: (-) supply (ground).

In our case, VCC connected to + 5V Arduino, In4 to pin 2 Arduino, GND to GND Arduino.

Figure 2 – Connection to relay to Arduino

The following sketches we will turn on and off every two seconds relay connected to the digital contact Arduino pin 2.

int Relay = 2;

void setup()
pinMode(Relay, OUTPUT);

void loop()
digitalWrite(Relay, LOW); // relay is switched
digitalWrite(Relay, HIGH); // relay off

For clarity, I connected a bulb, which is part of the network and guided by our relay:

Добавить комментарий

Этот сайт использует Akismet для борьбы со спамом. Узнайте как обрабатываются ваши данные комментариев.

Закрыть меню