Loading... Please wait...

Relay Module

Relay Module

This example shows how to use a relay module. If you are not familiar with mains wiring and the danger associated we recommend you use this relay to drive low-voltage, low-power circuits.

Hardware Required

  • Arduino Board
  • Relay Module
  • Item to be powered through the relay


To switch on a device when it is normally off we will use the common terminal and the normally open terminal to connect the device as shown below. If we wanted to be able to actively switch off a device that was normally left on by default then we would use the common terminal and the normally closed terminals.




This diagram illustrates the current flows in three states. Firstly it shows that when there is no coil current (relay is off), then there is a circuit between the NC terminal and COM. Then when current flows there NC & COM circuit is broken and the COM and NO circuit is made. Once the current stops the coil is not energized and the NC and COM circuit is made and the COM / NO circuit is broken.



This is an image of a relay module showing markings used instead of COM/NO/NC. The COM position is the center terminal and points to the NC terminal. The other terminal is the NO terminal.
To use the relay module connect up the device as discussed above. Then connect:
  • +5V to +5V
  • GND to GND
  • IN to digital pin 2




/* sketch
turn on a device using a relay


Connect relay module as follows:


+5V to +5V
IN to digital pin 2



int relay = 2;


void setup() {
  pinMode(relay, OUTPUT);
  digitalWrite(relay, HIGH);


void loop() {




What's News


Copyright 2020 oddWires. All Rights Reserved.
 Sitemap | oddWires