I tried to connect two relay modules on a 5v Arduino parallel port pin but the problem is that the current is too low for both module so they don't switch.
What can I do…

- 147,325
- 18
- 210
- 386

- 11
- 1
-
1Which realay module it is? Give a link? – Justme Jan 16 '22 at 09:58
3 Answers
Arduino cannot drive a relay directly, so you need a transistor driver to interface the Arduino and the relay. This is what you asked, similar to what @Momo sketched, but with TWO major changes - a Diode and an additional Resistor:
simulate this circuit – Schematic created using CircuitLab
- A Diode reverse-biased on the coil to protect the transistor from voltage spikes that happen when you turn the coil off. Here a 1N4004 or any other rectifier diode works.
- Transistor-driver should avoid erratic operation and require a lower current from Arduino ports. Arduino's absolute maximum is 40 mA per port, but limiting to 10 mA is recommended. I limited here to 10 mA per port, using R1 = 470R resistor. An additional R2 = 4K7 avoids the erratic operation of the relay if the Base terminal is disconnected from Arduino, or it is configured as Input (with high impedance). Transistor should drive at least 500mA and BC337 has Ic_max = 800 mA, with Beta/HFE/Gain = 100 at Ic ~400mA. See the picture below, with orange arrows. However, I would prefer to do the other solution, ahead.
As the relay is the most expensive part of your hardware, I suggest you play safer and double the driving circuit, connecting them as follows:
In this case, the required current for each Port is 5 mA (as R1 = R3 = 1K) and each BC337 transistor operates less stressed, at ~200mA. The BC337 at this current has HFE ~200 (pictured Green arrow), where (HFE * Ibase) > Ic required by relay, enabling transistor saturation and lowering Vce, as properly explained by another post here.
Driving Both relays: Port #1 and Port #2 could be connected in parallel, to the same digital Out pin of Arduino. I also added a LED on the second relay to illustrate a visual indication, in case you wish a direct visual confirmation of the relay being driven.
Relay operation with Arduino and NODEMCU at 3.3V levels:
In the future, if you wish to operate them separately you could drive them easily. In case one wishes to use ARDUINO and NODEMCU versions that are powered at 3.3V, the above driving circuit works without major modifications, except LED should be red-colored (Vforward < 2.0V) and R5 should be lowered to 150R. Then, power the "+5V" separately and use the common GND, driving terminals #1 & #2 by their 3.3V pin ports.

- 1,412
- 4
- 22
If you're talking about the usual cheap relay modules with 8 optos that are everywhere, these already have transistors, so you don't need to add them.
The arduino only drives the transistor, so its GPIOs won't be loaded.
However each 5V relay uses 70mA, so that's 560mA for one 8-relay board, and 1.12A for two.
If you use USB 5V port to power your arduino, these are limited to 500mA, so won't work.
If you use a power supply above 5V and rely on the arduino onboard regulator to provide 5V, then it can't deliver that much current, so won't work.
For 16 relays you have to use a 5V power supply that can deliver at least 1.5A. For example a 5V 2A "phone charger". Connect the 5V and GND from the supply directly to relay boards, on the supply pins in the corner, and do not route them through the arduino, because you don't want the current to run through the arduino.

- 70,433
- 3
- 83
- 203
First you need to figure out what current your relays need. Then, you should use a transistor to drive your relays. Your Arduino PIN can't handle such a current, that's why your relays won't work. You should also mention your relay's part number or give us it's datasheet so we can help you better.
EDIT
If you want to turn on both relays at the same time, it means you need 370mA. You can us BC817-40W. BC817's minimum beta is 40 which means for a collector current of 370mA, you'll need a base current of 9.25mA. For base to have this current you'll need a 0.46 kilo ohm resistance. I hope it could help.

- 120
- 10
-
https://files.seeedstudio.com/wiki/Grove-SPDT_Relay_30A/res/SLA-05VDC-SL-C_Datasheet.pdf This is datasheet SLA05DC – Haider Nezar Jan 16 '22 at 09:36
-
-
-
@HaiderNezar From part 6. COIL DATA CHART (AT20 C) you can see that your relay has a coil resistance of *27ohm* and needs a current around *185mA*. Therefore, there is no way you can supply this current with an Arduino PIN. You need a driver for your relays. I'll edit my answer to give you a schematic. – Momo Jan 16 '22 at 09:46