Skip to content

How to use a relay module with Arduino

 

Hello everyone, this is a tutorial on how to use a relay module with Arduino, here I used a 2 channels relay module with an Arduino Uno, you can use the same thing to control other relay modules with 4, 6 or plus channels modules.

Why using a relay? A relay permits you to easy control “high” voltage appliances, by high voltage I mean 110VAC/220VAC, depending on your relay type, it’s module that will permit you to control lights, lamps and other appliances in you house in case you want to make things automated or programmed and controlled by your Arduino.

Using a relay module is far better than a relay on its own, when used with Arduino, with module you actually control an optocoupler, which means the relay circuit that contains a coil is isolated from the Arduino circuit, of course only when powered externally, check the N.B below.


Wiring:

There’s isn’t that much going on with the straight usage, the module has multiple pins the important are GND/IN1/IN2/VCC, the first and last are for power, meanwhile the IN1/IN2 are for controlling the relays (Activate or not), the relays have also two positions, NO/NC: Normally Open and Normally Closed pins.

 

Important N.B:

Here I kept the jumper between Vcc and Jd-vcc wich mean that the optocouplers and the coils are wired together and they are powered from the arduino directly, if you are using other sensors in the same time you can may face some power issues, so you have to remove the jumper, and then wire “JdVcc” and the other “Gnd” from another power source, for example a 9V battery.


Code:


 

 

Yassine View All

Automation and Electrical Engineer, Electronics amateur trying to share my little projects.

One thought on “How to use a relay module with Arduino Leave a comment

Leave a Reply

%d bloggers like this: