I have a SRD-05VDC-SL-C relay (that is, a 5V controlled relay). Inputs, on relay, are VCC,IN and GND.

Now, I wanted to try if it is working. So I plugged RPi's 5V to VCC, and GND to GND. Relay's indicator LED was now switched on.

Then I just took another cable, from the second 5V output of the RPi, and just touched it on IN, expecting that it would work (make a "click" sound and close the circuit). But it did not!

Later on, I tried it using an Arduino and a GPIO as output for the in, and it worked.

So my question is, why wouldn't it work as I assumed in the first place? That is, touching the second 5V output to relay's IN?

  • 1
    I suspect it may be negative logic with onboard pullup try touching ground wire to in instead
    – crasic
    Mar 7 '19 at 16:16
  • 1
    Hello. In addition to what @crasic said, when you say you have a SRD-05VDC-SL-C relay I think you actually have this relay on a board with those connections. Without knowing what the board is & does any attempt at answering your question is going to be an educated guess. Mar 7 '19 at 18:16
  • Guys, you are both right. Thank you very much for your answers! I guess the answer was pretty obvious after all, and I just got stuck due to inexperience. Thanks again!
    – XuUserAC
    Mar 7 '19 at 18:51

For relays in general there are some nuances with the Pi that explain why you are seeing this behavior and what you can do about it.

On the Pi's GPIO header, there are a couple of pins marked 3.3v and a couple marked for 5v. These pins are ALWAYS powered (as long as the Pi is running). You can't turn them on or off.

Then there are the rest of the GPIO pins ... which only provide 3.3v power, but you can control whether they are high or low (on or off).

This creates a challenge... most of these small relays want 5v power and either the 3.3v isn't sufficient or if the relay works it may be unreliable. (Arduino's provide 5v power natively so they don't have this issue.)

The solution is to add a transistor to the circuit. This will let you use 3.3v power to control the flow of 5v power... and the 5v power can be used to control the relay.

The transistor has 3 pins... named "collector", "emitter", and "base" (sometimes you'll see the letters "C", "E", and "B" on schematics. The transistor will let power flow from the collector to the emitter ... depending on the state of the "base".

The collector & emitter will supply the 5v power ... which will only flow when power is applied to the base (3.3v power). This way when you toggle the GPIO pin on or off, it will result in the transistor supply 5v power to the relay.

There are a few types of transistors (PnP vs. NpN) and you should probably do a web search on "how transistors work" to understand them. Or "how to use transistors to control a relay using a raspberry pi" would be a good search.

There are relay boards made specifically to be compatible with the Pi. Those boards already incorporate transistors into the circuit design -- so they correctly deal with the power needs.

This is really just the basic idea.

HOWEVER ... there are usually a few extra components added in such as diodes and or resistors for protection. If you do a web search you can find articles that explain the basics, illustrate the circuits, and also show where you should add an additional component for protection (and why).


Your question leaves out some potentially important details. I'll try to highlight those here, and hopefully allow you to verify or correct my assumptions.

First, some nomenclature: You mention VCC, but the manufacturer's spec sheet does not identify a VCC connection. Perhaps a different manufacturer does designate a VCC connection, but this is a point of confusion. A point that could result in an incorrect answer, or worse: a damaged RPi or relay.

You should be aware that our SE site for Raspberry Pi has free access to a schematic tool that allows you to pose your question without ambiguity; here's how to get started with the schematic tool.


simulate this circuit – Schematic created using CircuitLab

The schematic above documents my assumptions: I've assumed that the node you call VCC is connected to the "high side" of the relay coil (or its functional equivalent), GND is the "low side" of the relay coil and IN is the input to the relay.

If my assumptions are correct, I can't imagine why you'd hear a "click". I won't speculate further... hopefully you've gotten my point about specific questions, and the value of the schematic tool.

Just one other point in closing: Note that the spec sheet I've linked to above calls out the current requirements for driving the relay coil. Have you compared the GPIO pins ability to source/sink current against these specs? What do YOU think??

  • On these little commonly seen relay daughter boards they have relay drivers so in is a 3V3 tolerant logic input and VCC is supply . The business end are labeled NC/NO and COM.
    – crasic
    Mar 7 '19 at 23:02
  • @crasic: OK, that makes more sense. But I still maintain OP should have provided more information.
    – Seamus
    Mar 8 '19 at 0:46
  • Absolutely, no argument there
    – crasic
    Mar 8 '19 at 6:14
  • VCC is supply, GND is ground and IN is a 3v3 logic input. Turns out I should be giving 0 (gnd) to hear the "click", aka Relay is ON. I just got stuck. The answer in the comments on my post helped a lot. Thank you for your responses.
    – XuUserAC
    Mar 13 '19 at 8:22

Now, I wanted to try if it is working. So I plugged RPi's 5V to VCC, and GND to GND. Relay's indicator LED was now switched on.

Well, if the indicator LED you mentioned is NOT the power LED, but the relay switch on/off LED, then as soon as you power on the module, the relay switch is immediately on.

I guess your module is "Low Level Trigger". That means if you connect the input terminal to ground, then you should hear a click, meaning the switch is on now. And if you remove the ground signal, you should hear another click, meaning no signal is High level, so switch is on again.

The Songle xxx mark is of the blue relay switch only. The module usually has no brand name. You might like to let us know the web link of your module, then we can make a more informed guess.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.