How to make your own relay module

What is a relay?

A relay in an electromagnetic device that is activated by a low voltage ranging from 3-12 v. When the electromagnet is activated it pulls a contact to make or break high voltage circuit. A simple relay looks like  following:



A sample relay module:

Note that the above circuit is directly connected to high voltage, This may sometime have issues if the are high voltage surge. So to avoid this we will introduce opto coupler . the modified schematic is as follows:

Parts Required:

  1. Relay 5v
  2. Diode IN4001
  3. Resistance – 100 ohm and 220 ohm
  4. Opto coupler – 4N35

To test this module we need to connect it to arduino as follows:

Connect DS1 to pin 7 of arduino. Provide separate voltage to opto coupler(may be from arduino)

Connect relay with some load

Use the following code:

int In1=7void setup() {
void loop() {


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.