Low active Relay Board

Thread Starter

champ1

Joined Jun 4, 2018
136
I want to interface following relay board to PIC controller This relay become active on low logic

upload_2019-3-25_17-47-13.png
The relay is active low If I connect any input IN1, IN2, IN2 and IN3 pin to ground relay would be activated so How to connect this board with microcontrolle
Code:
#include <xc.h>
#define _XTAL_FREQ 20000000 //Specify the XTAL crystall FREQ
#define  Sensor      RC0
#define  Fan         RB2
#define  ON           1
#define  Off          0
#define  High         1
void main(void)
{
    TRISB=0X00; //PORTB pins are used as Output.
    TRISC=0Xff; //PORTB pins are used as Input.
    PORTB=0X00; //Make all output of RB3 LOW
while(1)
{
    if(Sensor ==High)
    {
        Fan = ON;
        __delay_ms(1000);
    }
    else
    {
        Sensor = Off;
    }
    return;
}
}
I have written this program and it's working I have tested it with led but not working with relay because need to send 0 to relay

How to send 0 to relay ?
 

MaxHeadRoom

Joined Jul 18, 2013
30,658
Did you check to see if there is an option of connecting the input as Active Hi or Active Low?
Usually when the input shows both +5 and GND the option is to sink or source.
Max.
 

Thread Starter

champ1

Joined Jun 4, 2018
136
To cope with the active low instead of active high you invert the output signals.
Line 12: PORTB=0xFF;
Line 17: Fan = Off;
Perhaps the following code may be work
C:
#define _XTAL_FREQ 20000000 //Specify the XTAL crystal FREQ
#include <xc.h>

#define  Sensor      RC0
#define  Fan         RB2
#define  ON           1
#define  Off          1
#define  High         0
void main(void)
{
    TRISB1 = 1; //PORTB pins are used as Output.
    TRISC=0Xff; //PORTB pins are used as Input.
    PORTB=0X00; //Make all output of RB3 LOW
while(1)
{
    if(Sensor ==High)
    {
        Fan = ON;
        __delay_ms(1000);
    }
    else
    {
        Sensor = Off;
    }
  
}
}
I haven't tested code because I am outside from home
 

Thread Starter

champ1

Joined Jun 4, 2018
136
Did you check to see if there is an option of connecting the input as Active Hi or Active Low?
Usually when the input shows both +5 and GND the option is to sink or source.
Max.
I don't see the option, there is a jumper on the board but when I removed and test it with high active relay doesn't isolate
 
Top