How to properly use a relay module with JD-VCC from Arduino/Raspberry?
Ask QuestionAsked 23 days agoActive todayViewed 226 times11
I got two 4-relay-modules and I am probably doing something wrong because none of them seems to work:
My first try was using a breadboard 5v power supply, connecting VCC and In1 to 5V and GND to GND. I was expecting the first relay to switch, but nothing happened. I tried with all In pins but nothing
The module seems to have some LEDs to indicate when the relay should be on, they do not light.
I also tried 3v instead of 5, and connecting to another Power supply the JD-VCC. Nothing works I tested with the multimeter and all the pins I connected are getting power, so either I am missing something (very probable) or I both boards are broken
Another thing i noticed is that if i apply 5v and GND, then all IN seems to have around 3v
The relay model: JQC3F-5VDC-C
My module is generic, and I couldn’t find the official schematics. Thank you very much @tlfong01 for pointing me to this one, that seems to be the right one: arduinorelayraspberry-pishareedit follow flagedited yesterdayasked Jun 13 at 9:02Carlos Garcia12155 bronze badges
- 4Try connecting GND to the INx pins, the board might be wirded up active low. – Turbo J Jun 13 at 9:12
- 1haha… i am such a beginner XD. Please post it as an answer. Thank you! – Carlos Garcia Jun 13 at 9:15
- 2Data sheet link to the part please. – Andy aka Jun 13 at 9:47
- 1Thanks Andy, @TurboJ answered my question. The board requires GND in the INs, and not VCC – Carlos Garcia Jun 13 at 9:49
- No, this isn’t a back-street forum where nobody cares much – you need to make sure that your question is answerable and, not supplying the data sheet means you question is lacking information. This is a Q and A site and good questions are just as important as good answers. Guessed answers that prove to be right are great but there’s still a responsibility on you to fix your question. When you have fixed it I’ll remove the downvote and close vote. Let me know when you do it. You can of course answer your own question but add the data sheet link. – Andy aka Jun 13 at 12:22
- 1@Andy aka, yes, I agree that the question needs to be fixed. Actually the OP’s relay with the JD-Vcc jumper is a bit tricky to handle. He might like to read my posts for a schematic and wiring for 3V3 Rpi and 3V3 Arduino: (1) “Forbes Low Level Trigger Relay Module with JD-Vcc jumper Basics – rpi.org.forum 2018jul14”: raspberrypi.org/forums/…, (2) “Forbes Low Level Trigger Relay Module with JD-Vcc jumper Wiring – rpi.org.forum 2018jul14”: raspberrypi.org/forums/…. Cheers. – tlfong01 Jun 27 at 13:47
- 1Please add a relevant cct diagram – probably similar to this – Russell McMahon♦ Jun 28 at 2:13
- 1If this schematic is correct, then you need to connect IN to ground, not 5V, in order to turn on the relay. – user253751 Jul 2 at 10:12
- 1@user253751 that was exactly the problem :). The first comment by Turbo solved it. If anybody writes an answer I will mark it – Carlos Garcia Jul 2 at 10:53
- 1Hi @Carlos Garcia, you are welcome. My schematic of the relay with JD-Vcc jumper and the comment of “Wiring for total optical isolation”, is a bit complicated to understand. Perhaps I should try to give an answer explaining the idea of the JD-Vcc circuit design. – tlfong01 Jul 3 at 5:50
The OP has a 4 channel relay module similar to one shown below. The module has a yellow jumper at the bottom right, marked JD-Vcc. What is it and how to use it?
The OP’s 4 channel relay module is “Low Logical Level Triggerable” (Low Trigger) with the “JD-Vcc jumper” to suit different configurations of relay power and control signal levels. One very simple wiring method is shown below.
Using the 3V3 Raspberry Pi (or 3V3 Arduino) as an example, The Songle relay switch power is from external 5V power source, Vcc is connect to Rpi’s 3V3 logic power, and IN is connected to an Rpi GPIO pin in output mode.
If signal at IN is Low (0V, Ground), then current flows (sinks) from Vcc to IN, optical coupler EL817C is activated, Songle switch is activated (energized), contact COM is connected to NO (Normal open).
If signal is High (~3V) then current sinking is too small to activate the optocoupler, therefore Songle switch is deenergized, and relay switched off.
Part A - Simple High Low Trigger Relays Without Opto Isolation Part B - High and Low trigger relay modules with optical isolation Part C - Boot time Relay Module Status, relay switch spec and misuse of NC terminal Part D - Confusion between JD-Vcc jumper and High/Low Level Select Jumper Relays Part E - Using The JD-Vcc Jumper for Total Optical Isolation / to continue, ... Part F - Discussion and Recommendation - / to continue, ... References - / to continue, ... Appendices - / to continue, ...
The simple wiring and operation described in the short answer above does not involve the JD-Vcc jumper which is a very clever electronic circuit design. The long answer below describes the JD-Vcc circuit in detail, starting from the most basic ideas of High and Low trigger relays with and without optical isolation.
Part A – Simple High and Low level trigger relay modules without optical isolation
To explain the idea of Low and High trigger relays, let us start with the no optical method and look the the respective schematics below.
Part B – High and Low trigger relay modules with optical isolation
The over simplified schematics give a rough idea of the operations of High and Low trigger circuit. Real circuits must have a “flyback diode” to absorb the energy of flyback current when switching off energizing current. An “optical isolator” is usually used to prevent/reduce EMI (ElectroMagnetic Interference) noise going back to the signal source (Raspberry Rpi). Noise usually also goes through the ground wires. That is why the “JD-Vcc jumper” coming in, to do “Total Optical Isolation” (More about his later).
I am only making an educated guess that the OP’s relay is low level triggered. There is a small chance that his module is actually High level triggered, as shown below. In this circuit, High signal activates/turns on relay switch.
Part C – Boot time Relay Module Status, relay switch spec and misuse of NC terminal
One important clarification is that whether a module is High or Low triggered, if the Rpi/Arduino is not powered, or if GPIO pin is in input mode in booting or otherwise, then no current drives or sinks to activate optocoupler, relay is always off.
A related warning to newbies is that you always use the NO pin, never the NC pin, otherwise relay is on at boot or GPIO in input mode.
Another confusion is between the “relay switch” and the “relay module”. The little blue cube is the relay switch, usually marked “Songle” or other brands like TongLing or WV. The relay module, unfortunately, almost always, has no marking of brands or model number.
One more confusing is the optocoupler.
It is important to note that the optocoupler input is only of the order of 5mA, but the Songle relay switch activating current is about 70mA. The following pictures can help clarify things a bit.
Part D – Confusion between JD-Vcc jumper and High/Low Level Select Jumper Relays
Before a detailed study of the OP’s JD-Vcc jumper relay and how to control it, it is important to differentiate between the JD-Vcc jumper and the H/L level select jumper. The schematic of the H/L select jumper relay is shown below. This relay lets the user select the relay as High level or Low level trigger.
This schematic is a test of your thorough understanding of the different kinds of relays. Note – You need to study the spec of the EL354 bidirectional input optocoupler shown in Part C above.
/ to continue, …
(1) SunFounder 4 Channel 5V Relay Module with optocoupler and JD-Vcc jumper for separate signal power (Rpi/Arduino Vcc = 3V3 or 5V) and relay switch power source (Songle relay switch JD-Vcc = 5V, 12V, or 24V)
(2) Songle SRD Seris Relay Switch Spec
(3) Forbes Low Level Trigger Relay Module with JD-Vcc jumper Basics – rpi.org.forum 2018jul14
(4) Forbes Low Level Trigger Relay Module with JD-Vcc jumper Wiring – rpi.org.forum 2018jul14
Appendix A – What does the abbreviation “JD” mean, and how to use this JD-Vcc/Vcc jumper?
Well, relay in Chinese is “繼電器” which literally means “Pass Electricity Device”. In “pinyin”, Chinese romanization, it is the following:
Jì Diàn Qì
So I guess the Chinese guy designing the circuit, uses the following abbreviation:
JD-Vcc is the pin to connect to the [external] relay (JD) power supply, while Vcc is the pin to connect to the Arduino or Raspberry Pi power rail/supply
Now, how to use the JD-Vcc jumper:
(1) If you use the same Arduino/Rpi’s 5V power supply/rail for both (a) the relay module’s control circuit, and (b) the Songle relay switch, you cap the JD-Vcc jumper, shorting the Vcc pin to the JD-Vcc pin.
(2) If you use separate power supplies, ie (a) the Arduino/Rpi’s 3V3/5V power/rail for the control circuit, and (b) external 5V/12V/24V/48V (Note 1) for the Songle relay switch, then you should not cap the JD-Vcc jumper, ie, disconnecting Vcc pin from JD-Vcc pin, otherwise something would melt down or blow up. 🙂
Note 1 – For industrial, including automobile applications, it is common to use 12V/24V power for the relays, because higher voltage means (a) less current, (b) less noise problems.
Appendix B – How to test/troubleshoot/workaround Low level triggable relays (with or without opto isolation, with or without JD-Vcc jumper)
Though the OP’s question is on his relay which is Low level trigger, optocoupled, JD-Vcc/Vcc jumper configurable power supplies, we need to know the very basics of the opto coupler (EL817C) biasing of High/Low trigger circuits.
The very sad story began in the good old happy days, when we hobbyists played with only 5V Arduino and all logical levels are sort of 5V TTL, life was easy.
It is only when 3V3 Raspberry Pi came along, and later also 3V3 Arduino (Pro Mini 328 3V3 8MHz), life has become confusing, especially for the oldies/newbies who only know about Arduino/TTL 5V logic.
To understand why all (well, almost) newbies get confused, we need to look closely the following logical level chart, showing the root cause of newbie 3V/5V sorrows.
Let us focus on the left most two columns, TTL and Arduino. In those were the days, my Arduino friends thought the imperial Arudino empire would live happily ever after, never imagined that some big guys like Rpi would soon appear. So the story goes than the Arduino engineers devised a new logical level standard/specification:
High level means at least 4.2V Low level means at most 0.8V
The result is that most devices, say actuators, including relays, solenoids, buzzers, you name it, meet this spec, with (the latter Rpi guys scary) requirement that to do something using High level, you need to give 4.2V or higher.
Of course this makes the life Rpi’s born later, very miserable, because they are weak 3V3 guys, and their High level is usually 2.4V to at most 3.2V. This is what I usually refer as the
Rpi’s High is Not High Enough Problem
Appendix C – How does the JD-Vcc Jumper solve the 3V3 Arduino/Ri’s High-Not-High Enough, Relay-always-on-can’t-turn-off problem?
The JD-Vcc circuit with separate (Vcc and JD-Vcc) power supplies solves the problem of the “Rpi’s High not High enough“, causing “Relay always on and cannot turn off“.
Explanation – If Vcc = 5V, Rpi’s High of about 3V is not High enough (needs 3.5V ~ 4.2V) to to make the sink LED current small enough to switch off the opposite photo transistor. If Vcc is decreased to 3V3, even Rpi High is still 3V, the voltage difference 3V3 – 3V = 0.3V, limiting the the sink LED current too small to active its opposite photo transistor.
Note 1 – There are a couple of other methods to solve the problem of “Rpi-High-4Not-High_Enough = Low Trig Relay Always On”. These methods include (1) Shifting Rpi High signal from 3V to 5V by NPN BJT such as 2N2222 open collector pulling up (2) converting Rpi GPIO 3V3 logic level to 5V using MOSFET pairs such as 2N7000, or TBX010x logic level shifting modules.
However, using the JD-Vcc circuit is not just solving the problem by shifting logic level, but actually killing 4 birds with one stone. To explain how one stone can kill 4 birds, we need look at the 4 birds, bird by bird. The first bird is how to turning off the always on relay by the either one of the following two tricks:
1. Change the GPIO pin from output mode to input mode, or 2. Clean up (all) the GPIO pins.
This trick or workaround is described in the following appendix.
Appendix C – How to turn off a always on (Low trig) relay (not using the JD-Vcc jumper)
This is a common Rpi/3v3 Arduino Mini Pro newbie’s sorrow. Many newbies wrongly buy a Low trigger relay designed for Arduino and found the relay always on. The following a is a short description of a real life sad story.
The photo show the Arduino relay not working with Rpi.
The schematic (not exactly matching, with extra blue LED, PNP BJT 2N5401 is actually CS9012)
The latching up problem, frying the Rpi, or shortening its life
/ to continue, …
/ to continue, …
shareeditdeleteflagedited just nowanswered Jul 3 at 6:30tlfong0118655 bronze badges
- 1Thanks for all the teaching! It’s great post 🙂 – Carlos Garcia Jul 3 at 13:07
- @Carlos Garcia, thank you very much for your kind words and encouragement. Cheers. – tlfong01 Jul 3 at 14:01
- 1That’s interesting about the “JD”. – Andrew Morton 2 days ago
- 1I love the answer! 🙂 Thanks @tlfong01 – Looking forward to the next part – Carlos Garcia yesterday
- Many thanks for your continuous encouragement again. So I write on (Appendix C). Enjoy! Cheers. – tlfong01 yesterday
Leave a Reply