Pololu RC Switch with Relay

Hello,

I have purchased Pololu item #: 2804 and I was looking at testing it. I have hooked up an LED where it shares the same ground of my power supply and its anode is connected to the NC pin and the COM is connected to the positive of my power supply. Now I am powering my GND VC pins from my arduino and I connected my RCIN to pin D7 of my arduino in the hopes of triggering the NC pin on and off based on this code:


void setup() {
  pinMode(7, OUTPUT);// connected to RC IN terminal of Relay

}

void loop() {

  digitalWrite(7,HIGH);// turn relay ON
  delay(3000);// keep it ON for 3 seconds

 digitalWrite(7, LOW);// turn relay OFF
 delay(5000);// keep it OFF for 5 seconds

}

Is there something that I am not understanding or doing wrong? I have not worked with relays much so any help would be appreciated.

Thanks

After some testing, I have realized that the signal I was sending the relay was invalid. I alternatively started using the servo library by arduino to send the appropriate pulses the device needs. I am still experiencing issues with getting the switch to turn on, I am however certain that the pulses are correct since the GOOD pin is high and the OUT pin is low.

Here is the code I am currently using:

#include <Servo.h>

Servo myservo;
int val;
int pin = 0;

void setup() {
  myservo.attach(3); // connected to S terminal of Relay
}

void loop() {

myservo.write(255);              // tell servo to go to position in variable 'pos'
    delay(5000);        
}

Hello.

It looks like you are only sending one pulse width in your second program, so the state of the switch will never change. Try using this for your loop:

void loop() {
  myservo.writeMicroseconds(2000);  // Send 2ms pulses for 5 seconds
  delay(5000);   
  myservo.writeMicroseconds(1000);  // Send 1ms pulses for 5 seconds
  delay(5000);     
}

If that does not work, could you post some pictures of your setup that shows all of your connections?

For future reference, if you want to operate a relay using a digital signal like in your first post, you could just use a basic relay carrier, like this product:

- Patrick

1 Like

It worked, Thank you for your feedback!

2 Likes