Pages

Tuesday, 2 June 2015

2 RELAY BOARD

   12V

OVERVIEW


The board has two relay driven by TTL circuit . The board works on 12V but the input signal can come directly from microcontroller output working at 5V to control relays. Each relay can switch variety of AC or DC high voltage, high current loads working at 110V or 220V AC mains like lights, fans, motors and such. The status of relay is indicated by individual LEDs.


FEATURES

  • LED indication of relay on & power 
  • Design based on highly proven TTL  as driver
  • Direct input  5V microcontroller for relay control
  • High Current (8A) Capability.
  • AC or DC Operating Voltages.
  • No Leakage Current.
  • Eliminates costly isolation relays and wiring.
  • High quality PCB FR4 Grade with FPT Certified.

CIRCUIT DIAGRAM

SCHEMATIC



CONNECTION DIAGRAM


CODE:

1.     ATMEL


#include<reg51.h>

#define LCD_PORTP2
sbitrs=P3^5;
sbit en=P3^7;
sbitD7=P2^7;
sbitrw=P3^6;

#define RELAY P1

void busy();
void CMD_WRT(unsigned char);
void LCD_WRT(unsigned char *);
void DATA_WRT(unsigned char);
void DELAY();
void main()
 {
 unsigned char CMD[]={0x38,0x0f,0x01,0x06,0x80},TEMP,i;
 for(i=0;i<=2;i++)
   {
    TEMP=CMD[i];
CMD_WRT(TEMP);
   }

  RELAY=0x00;
  while(1)
  {
CMD_WRT(0X01);
CMD_WRT(0X80);
LCD_WRT("2 RELAY BOARD");
  DELAY();
  DELAY();
  RELAY=0x01;
CMD_WRT(0X01);
CMD_WRT(0X80);
LCD_WRT("1st RELAY ON");
  DELAY();
  DELAY();
  DELAY();
  DELAY();
  RELAY=0x00;
  RELAY=0x02;
CMD_WRT(0X01);
CMD_WRT(0X80);
LCD_WRT("2nd RELAY ON");
}
 }
void busy()
{
D7=1;
rs=0;
rw=1;
        while(D7!=0)
        {
                en=0;
                en=1;
        }
}

void CMD_WRT(unsigned char val)
{
        busy();
LCD_PORT=val;
rs=0;
rw=0;
        en=1;
        en=0;
}

void LCD_WRT(unsigned char *string)
{
        while(*string)
DATA_WRT(*string++);
}
void DATA_WRT(unsigned char ch)
{
        busy();
LCD_PORT = ch;
rs=1;
rw=0;
        en=1;
        en=0;
}
void DELAY()
{
        unsigned int X=600000,Y=600000;
        while(X--);
        while(Y--);
}


2.     PIC

sbitLCD_RS at RB4_bit;
sbitLCD_EN at RB5_bit;
sbitLCD_D4 at RB0_bit;
sbitLCD_D5 at RB1_bit;
sbitLCD_D6 at RB2_bit;
sbitLCD_D7 at RB3_bit;

sbitLCD_RS_Direction at TRISB4_bit;
sbitLCD_EN_Direction at TRISB5_bit;
sbitLCD_D4_Direction at TRISB0_bit;
sbitLCD_D5_Direction at TRISB1_bit;
sbitLCD_D6_Direction at TRISB2_bit;
sbitLCD_D7_Direction at TRISB3_bit;

char RELAY at PORTD;

void main() {
PORTD=0x00;
Lcd_Init();                        // Initialize LCD
Lcd_Cmd(_LCD_CLEAR);               // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF);          // Cursor off
Lcd_Out_Cp("2 RELAY BOARD");
RELAY=0x00;
  while(1)
  {
  RELAY=0x01;
Lcd_Cmd(_LCD_CLEAR);               // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF);          // Cursor off
Lcd_Out_Cp("1st RELAY ON");
Delay_ms(1000);                     // You can change the moving speed here
  RELAY=0x00;
  RELAY=0x02;
Lcd_Cmd(_LCD_CLEAR);               // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF);          // Cursor off
Lcd_Out_Cp("2nd RELAY ON");
Delay_ms(1000);                     // You can change the moving speed here
  RELAY=0x00;
  }

}