Monday, 27 July 2015

Inside of a SRD-05VDC-SL-C relay and how to wire it up?

In this post you'll be able to see how does a SRD-05VDC-SL-C relay looks like from inside and how to wire it up?

  • Ok, first let me show you the pins and views from up and down and from different angle.
view from top and bottom

Front view and pins NO,COM and NC

You might be thinking why did I break the plastic case? 
Well, actually I was working on a project "open and close an electricdoor". For that project I was needed something that can turn the motor both ways. So I though let me use 4 relays 2 for turning one direction and another 2 for other direction. But after setting everything up. I noticed something is not right. And that is when ever Arduino starts, it gives connection to every single relay. So all the relays was giving connection to the motor (negative and positive) at once which and I never wanted that.

Any way, so I though it would be better if I give connection to the main coil directly (you might need to use other method if connect it directly, otherwise you might burn your arduino board). That's why I broke the plastic case to find out which pin is for the coil.

How to wire SRD-05VDC-SL-C with Arduino?
It is very simple. Just connect the GND pin of relay to GND pin of Arduino. And VCC pin to VCC pin and for the IN pin connect to the pin that you choose in the  sketch. For example pin3 in the sketch below.


int relay = 3;

// the setup routine runs once when you press reset:
void setup() {               
  // initialize the digital pin as an output.
  pinMode(relay, OUTPUT);  
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(relay, HIGH); 
  delay(500);             
  digitalWrite(relay, LOW);  
  delay(500); 

}


Note: Please keep in mind for some reason "HIGH" in relay means "off" I don't know why, but you can still change high to low and low to high if you need to.

Where are the coil pins of SRD-05VDC-SL-C?
In the second picture at the top of this page. You can see two red circles, those are the pins of coil. The right hand side pin is connected direct to the GND pin.

That's all for this post and watch the video to see the relay in action. Thanks a lot :)




1 comment: