Tuesday 5 August 2014

DIY Simple Relay Circuit Board


                Here is a simple 5 V relay circuit board that can be used in your projects.

Relay:

               A relay is an electromagnetic device that works on magnetic field. If you apply proper voltage across the electromagnet (V1 and V2), the metal inside the relay will detach from ‘Normally closed' terminal and gets attached to ‘Normally open’ terminal. You can hear a small metal clink sound on successful relay action.

 

Terminals of a simple relay:

               NC and NO in the circuit represent ‘Normally Closed’ and ‘Normally Open’ respectively. To determine the NC and NO terminals, we can use the short circuit test in multimeter.

 

Components needed:


1. 5 V relay

2. SL100 Power transistor

3. Diode 1N4001

 

Circuit diagram:



 
           Both NC and NO terminals can be used for outputs. The difference can be explained in a simple way. Let us assume an LED is connected at the output.
 

When connected with Normally Open:

 
                       LED glows when the input from microcontroller is HIGH 0r 1.
                       LED turns off when the input from microcontroller is LOW 0r 0.
 

When connected with Normally Closed:

 
                       LED glows when the input from microcontroller is LOW 0r 0.
                       LED turns off when the input from microcontroller is HIGH 0r 1.

 

My Board:

 



Testing the board with GR-Sakura:


               For testing the board, GR-Sakura and an LED is used. GR-Sakura is an arduino compatible development board.

               IO29’th pin is used to drive the relay circuit.


 

Code:


#include<rxduino.h>
#include<iodefine_gcc63n.h>

main()
{
 

   pinMode(29, OUTPUT); // initializing pin29 as output
   delay(2000); // 2 sec delay
   while(1) //infinite loop
  {

  digitalWrite(29,1);  // switching ON relay – LED glows
  delay(2000);
  digitalWrite(29,0);  // switching OFF relay – LED turns off

  delay(2000);

  }
}

No comments:

Post a Comment