I have a developer background missing the electronics background. I read some threads with great interest:

  1. Using single 5V relay (jqc-3ff-s-z) - safety advice required and
  2. 5V relay (jqc-3ff-s-z)

I need to drive three relays and because I already destroyed a RPi by using too much power I was thinking to power the relay-modules by an external 5v psu Psu (Vcc), RPi and relay's ground pins all connected together. The Relay's IN-pin is directly connected to different GPIO pins (cf. image). This should be possible according one of the answers above.

Now I see the relay is always on (green led is always burning) even if I toggle the GPIO value Low <-> High. However, I see some difference in current consumption

  1. If the GPIO value is low, only 136uA is consumed.
  2. If the GPIO value is high, 4mA is consumed (I think this is safe, just below 5mA).

But, again, in both cases the relay stays ON and is not toggling when I expected it.
Can someone give me some advice/tips to 'debug' this problem? Many Thanks.



Thank you all in advance for the extensive information and answers. I try to process them, not easy. To @Joan: I can't find a schema right away. But it is the relaymodule that is visualized in the next question, exact the same (Using single 5V relay (jqc-3ff-s-z) - safety advice required).

Furthermore, I understand that the voltage is not high enough. That seems already logical to me. It also reminds me that I tried the sparkfun logical converter (https://learn.sparkfun.com/tutorials/bi-directional-logic-level-converter-hookup-guide/all) Also without result:

  • GPIO off: gave a stable relay off situation
  • GPIO on: caused the relays to vibrate (on-off and vice versa)
    cf. Fritzing scheme. (Sorry for my incompetence to provide a detailed scheme) So if anyone can help met through this set-up It's fine for me too. Already thanks a lot!

Set-up with level converter

Edit - V3 @joan,
as asked I added some pictures of the module. Hopefully you can help me out with this. Thanks already.

Module 1/3

Module 2/3

Module 3/3

Module backside

  • 1
    Ah, relay always on is a common problem. You might like to read my relay tutorial for more details: electronics.stackexchange.com/questions/505318/…. Your problem of relay always on, Rpi's high is not high enough problem is in Appendix B. Happy learning. Cheers.
    – tlfong01
    Commented Nov 23, 2020 at 13:00
  • 1
    You need to provide a link to the datasheet to what you have bought. The jqc-3ff-s-z is a class of relays which can not be driven directly from the Pi (not for long anyhow).
    – joan
    Commented Nov 23, 2020 at 13:03
  • 2
    Does this answer your question? 4 relay board weird behavior Commented Nov 23, 2020 at 13:50
  • It is quite simple to drive multiple relays from the Pi - you just need suitable circuitry. What you appear to be using are NOT relays, but relay modules. Can you use a 5V Relay Module with the Pi?
    – Milliways
    Commented Nov 23, 2020 at 21:59
  • @Dmitry, Thank you for the suggestion, but I think it is not fully usable because my module does not have the switch capability (Vcc / JDVcc). I did understand from Seamus that I am not allowed to control the 5V coil directly. So I used the level shifter (cf. picture) but then I get a vibrating on-state. If there is a solution for that I think it solves my question. Already thanks for the effort.
    – GuyH
    Commented Nov 24, 2020 at 20:21

4 Answers 4


Unfortunately there are many different relay boards out there using this particular relay but that might feature different driving electronics. So it's difficult to give a definitive answer. There are however some indications that this excellent arcticle /1/ covers this board and the problems the OP describes.

enter image description here (Image source: /1/)

I leave it to the OP to confirm that this circuit matches the board but from the pictures provided and the description of its behaviour this seems to fit.

The picture of the PCB shows that the transistor is on the high-side of the load - the relay's coil. So if this transistor is a Bipolar Junction Transistor it would be PNP. Per the OP's measurement "If the GPIO value is high, 4mA is consumed" it's safe to assume that the transistor is bipolar and not FET. This is backed up by the OP confirming "2TY" as the marking of the transistor. So according to /1/ this has the drawback:

The signal voltage needs to be near the Vcc to shut off the relay. The Vbe saturation voltage is -1.2Volt. So if fed with 5 Volt, anything lower than 5-1.2=3.8V will keep the transistor in saturation.That means that you cannot feed the circuit with 5Volt and use a 3.3 Volt microprocessor to give the input signal, because a HIGH of 3.3 Volt is not high enough to close the PNP transistor.

/1/ provides a simple solution to overcome this issue. This however will draw an additional current from the Pi's voltage regulator and might thus not work if a larger number of relais needs to be driven (side note: here and here and here it is indicated that up to 800 mA could be sourced from the 3.3V rail, so quite a number of such relay modules could be used):

That means that if you want to use it on a raspberry Pi or an ESP8266, you will have to use the 3.3 Volt pin to feed the relay. The relay is a 5 Volt type, but it will work on 3.3 Volt but at 70 ohms it draws an extra 47mA from the 3v3 LDO.

The above does not explain why it also fails using logic level converters (as the V2 edit of the question indicates).

/1/ recommends to use an additional transistor to drive the relay board from 3.3V GPIO pins. Note that this inverts the logic again.

enter image description here (Image source: /1/)

  • 1
    This is probably similar to the OP's device, but I cannot agree with your description "his excellent article". The proposed solution WOULD work (even if it includes superfluous components) BUT will draw no more current and seems to perpetuate the myth that the Pi 3.3V supply is limited to 50 mA
    – Milliways
    Commented Nov 25, 2020 at 11:31
  • PS "logic level converters" are designed to convert Logic Levels not general voltage level conversions and will not reliably source high currents.
    – Milliways
    Commented Nov 25, 2020 at 11:36
  • 1
    ASSUMING "the article" has sussed the circuitry on this generic relay, then I agree w/ @Milliways: Use the 2nd schematic (the NPN switches the PNP). Forget the first schematic, and forget the idea of driving a 5V relay w/ 3.3V. WARNING - Attempted Humor Follows: I also agree w/ Ghanima... the article is "excellent"... in the sense of Bill & Ted's Excellent Adventure :)
    – Seamus
    Commented Nov 26, 2020 at 5:24
  • 3
    @GuyH: The real problem here is your buying decision: The relay you've bought is actually "junk". Do yourself a huge favor in the future: Adopt a buying policy of No Spec Sheet - No Sale. Really - this problem is becoming epidemic - here's another recent example.
    – Seamus
    Commented Nov 26, 2020 at 5:31
  • 1
    @Seamus “Be excellent to each other.” ;-) I never thought that that word would have such an impact. But components and modules with poor spec are indeed a problem.
    – Ghanima
    Commented Nov 26, 2020 at 8:33

You've made a mistake, I'm afraid. You seem to be attempting to switch the relay coil with a GPIO pin. Unless your relay module is designed to use a 3.3V input you are at risk of breaking another RPi.

GPIO pins are for 3.3V - and ONLY 3.3V

In addition, the GPIO pins are delicate little flowers; they won't source (or sink) much current, and they don't tolerate voltages over their rated limit well at all.

Here's the rest of my answer:

  1. Get the detailed specs for your relay module (per @joan cmt); edit your question to add the details, or better still link to them so no details are left out.

  2. For clarity that will help YOU get a better answer: Create an actual schematic instead of the fritzing stuff (here's how)

  3. There are tons of how do I drive a relay question on this site. Some include schematics. Maybe read them? (1, 2, 3, and if you need more: 1,304 other results)


The correct answer to the OP's question appears to be the 2nd schematic in Ghanima's answer. I say "appears" only because this being a correct answer depends upon the accuracy/applicability of the analysis done by the author of this article.

Perhaps in a larger sense, another answer to this question, and hundreds of others seen here in RPi SE, is to follow this simple rule:


This question could have been resolved with a fraction of the time & effort expended by all involved parties if a "spec sheet" had been provided by the vendor. I recently posted a more pointed version of this view with a few more details & advice on identifying quality suppliers.

  • 1
    Thanks Seamus: I have the same feeling that it's not right to connect it directly to my Pi. But how do I have to interprete the feedback of Ghanima where he states that it's OK to connect the Relay-IN and a GPIO Pin. in the question (raspberrypi.stackexchange.com/questions/73311/…)? It's still very confusing for me
    – GuyH
    Commented Nov 24, 2020 at 12:43
  • 1
    @GuyH: Maybe Ghanima knows something we don't? :) I think that "getting away with something", and "doing it properly" are two different things. You will need to decide how you wish to proceed, and which approach to take. And given that the RPi Organization has chosen (or was compelled) NOT to disclose the details of the hardware, it is truly a "guessing game". I do not like guessing, so I stick with what I know will work.
    – Seamus
    Commented Nov 24, 2020 at 19:31
  • 1
    I can fully agree with that thought. Maybe I should turn my question around then. How can I safely control a relay with the RPi. Do you have a usable schematic. It may be using another - guaranteed working - relay module. Thank you kindly in advance for the effort.
    – GuyH
    Commented Nov 24, 2020 at 19:57
  • 2
    @GuyH: See # 3 in my answer above. I provided links to 3 (1, 2, 3...) of my answers that have schematics. Also, the results of a search on RPi SE with 1,304 other Q&A. Why don't you start there & ask questions as necessary. This is not complicated to implement; understanding the electronics is a bit more challenging, but it will come in time with minor diligence :)
    – Seamus
    Commented Nov 24, 2020 at 20:11
  • 1
    @GuyH thanks, that supports an article I found that will be of interest for you. I have posted another answer to cover that.
    – Ghanima
    Commented Nov 25, 2020 at 9:56

From the rather unclear photos you have posted the device does not have an opto-isolator but a transistor.

It is unclear why it doesn't work, however there is another type of poor module, triggered by a low level, with a PNP transistor which is not controllable from 3.3V. (This saved the manufacturer some fraction of a cent.)

Without a circuit it is not possible to be sure. It would be quite simple to trace the circuit yourself to determine what it contains.

NOTE I hope you are not planning to put mains voltage on the modules. From the detritus visible on the boards there would be inadequate isolation, even with the cutout. This is probably a cheap rip-off of some other device, as the condition of the board indicates poor manufacture.

  • It is indeed possible that it is not the best quality but it is initially used as a test. But I can't get much further so I started looking for an alternative. Is this next solution safe for the RPi you think ? (waveshare.com/wiki/RPi_Relay_Board) cf. diagram (waveshare.com/wiki/File:RPi-Relay-Board-Schematic.pdf)
    – GuyH
    Commented Nov 25, 2020 at 9:42
  • You appear to be asking me to evaluate another module with inadequate documentation (I an not about to download a PDF to analyse the circuit) but from the picture this appears to YET ANOTHER of the appalling designs with an opto-coupler (which my link in the comment addressed) . @Ghanima's guess would align with my answer above. As an Electrical Engineer with 50 years experience I don't see WHY anyone with any basic understanding would design anything so poor. If you are going to add external components you might as well build the whole thing from scratch,
    – Milliways
    Commented Nov 25, 2020 at 11:13
  • Fan control describes a simple circuit (designed for fan control) which only requires 3 simple components and will run any small device, fan, relay etc.
    – Milliways
    Commented Nov 25, 2020 at 11:14

@Ghanima: a final question: if I duplicate the workable circuit to drive multiple relays, is it allowed to share Ground (X1-1) and 5V (X1-2) as depicted in my drawing.
Or should it be different separate circuits ?, however Ground and 5V will be shared via the PSU connectors then...
PS. what is OP stands for? enter image description here

  • 1
    If you are going to do this it is ESSENTIAL that the Pi Gnd is connected. R6-R10 do nothing. You could use the Pi 5V or any other.
    – Milliways
    Commented Nov 25, 2020 at 22:57
  • 1
    GuyH, please note that follow-up questions should not be posted as answers. Please repost as a new question and link to your other question. Thanks. (BTW, OP just means "original poster", you, who posted the question).
    – Ghanima
    Commented Nov 26, 2020 at 8:59
  • @milliways, R6 through R10 prevent the transistors from dying. That is, you cannot recommend to remove them in the sense to directly connect 5V to the collectors. I take it that you want to drop the resistors and not have any connection to X1-2, i.e. open collector? But then the advise should be explicit about that.
    – Ghanima
    Commented Nov 26, 2020 at 9:03
  • @Ghanima I don't know what makes you think anything would "die". This is bog standard basic electronic design. They won't do any actual harm - just reduce efficiency. In fact given the "active low" specification ANY switch would do - there is no need to know the details of the circuit (other than voltage). If people want to discuss circuit design it is an E&E question.
    – Milliways
    Commented Nov 26, 2020 at 9:59
  • @Milliways Collector to 5V, emitter to GND, no resistors. What would be limiting I_c?
    – Ghanima
    Commented Nov 26, 2020 at 10:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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