Arduino Relay Module

Hi guys,

I need to add two 10A relay modules to a project I need them to be on the same PCB with the rest of the project so I found this schematic online. The relay modules will be controlled by an Arduino.
Since I don’t know how to calculate the values of the components, can anyone tell me in this schematic what will be the correct value/type for the flyback diode and the transistor?

What voltage is your VCC and what relay (specific model or coil voltage/current/resistance) do you use?

For typical small relays a 1A rectifier diode 1N4007 or equivalent could be a suggestion.

Be aware that the switchoff time of the relay is lengthened by the diode; in order to compensate for this sometimes a transistor that can withstand higher voltages and a zener type diode is used, such that the reay coil voltage during the collapse of the magnetic field is higher than the 0,7V you get in the above scenario. This is mainly a factor when designing for long contact life of the relay.

I looked at a random 10A/230V relay with 12V coil voltage, and it has a current draw around 55mA nominally, so a transistor with at least 0,2A current capacity, 50V voltage rating and hfe >100 could be okay. Perhaps, if you drive the transistor directly from a microcontroller output, you could consider a darlington transistor with high hfe.
but on the other hand, if the Arduino pin is 5V, the 1k base resistor will give a base current of several mA, so even a BD139 could be enough.

There are probably thousands of alternatives here, but some more details could help.

2 Likes

I have some Panasonic ALQ305 arround here. 10A 250V and 5V coil.

You might want to use a MOSFET rather than NPN to control your relay:

The MOSFET is controlled by a MCU as well.

That relay seems to be 5A/250V AC according to:


(10A at 125V AC)

With 40mA coil current (which is fairly low for 5V) even a BC337 or equivalent would suffice, as well as a 1N4148 diode.

1 Like

This is the relay I have and a BC547 and a BC548.

I use often these very low cost Qianji JQC-3F(T73) [the Blue one’s in photo] - never had a failure/problem.

If the Arduino has 5v outputs, I trigger them directly from Arduino’s (or Atmel chips) without using Transistor/other… If the Arduino has 3v outputs, I pump up the voltage but, I prefer using 5v output devices for projects needing Relays (especially if passing through higher voltages and currents…)

The datasheet I found on that relay states 70 ohm coil resistance, which at 5V would give 71mA coil current. The datasheet for Atmel 1284 (which was the one in the project Cosmin asked about in another thread) states absolute maximum current per I/O pin to be 40mA.
While you might be lucky and have it work, I would never design it like that, rather use a driver transistor or chip.

2 Likes

I measure 74.3Ω (confirming the spec). But, I’ll leave it for you to discover the reality of V=Ri and devices… The Arduino’s that put out 5v are 40mA out capability… And, can be ‘Ganged’ for higher/additive current…

BC547 has maximum collector current of 100mA, so it is just barely enough if the coil resistance is 70 ohms or higher. If the datasheet I found is correct on the coil current of 40mA and resistance of 125 ohms, then it should work.
547 and 548 are similar but 548 has lower maximum collector - emitter voltage of 30V whereas 547 has max 45V.
Make sure to have plenty of margin to the maximum ratings when using transistors / semiconductor devides, so you don’t get failures due to tolerances and spikes too easily.

1 Like

Max 200mA for VCC and GND must be taken into account when drawing much current from the outputs.

1 Like

Thanks… “Caution’s” are good.

I’m too Old-School and have been doing this stuff since 1959 and, thus, set in my ways… and Design for the Application at hand, not for Theory of what won’t happen if not designing for the Worst-Case scenario… Different strokes/Different folks…

I’ve always used 12V relays whenever I can, seems like the 5V coils run hotter, and the current eliminates using the smaller 100 mA transistors/FETs becuase it is to close to their limit, but, sometimes you just don’t have 12 V…
Design concerns drive everything else:
Are you worried about the spike on the power supply when the relay is turned off and the inductive kick dumps power back into the supply?
Is the load on the contacts such that the slower drop time due to the diode will cause contact life concerns? (and never, never use a 1N400x rectification diode as as snubber !). I suspect that with a speaker load, the number of cycles and current make this a minor concern.
Do you want to drive the coil directly or is the cost of a transistor/FET not a problem? With a transistor/FET your input is now any logic level from 3 to 5 volts, at low-to-no (transistor to FET) current in.

FWIW, I really like the pre-biased transistors, if the input is open (and it just about always is for while until the uP wakes up and sets up the IO) you can be certain the relay will be off. Note that the resistors used in the FET design deal with this nicely, and a biased transistor (MMUN2214 type) does this too. Summarizing: what are your worries about:

  1. Spikes on the power supply line (might see a volt of spike)
  2. Drop-out speed for contact life (probably not a concern with speakers)
  3. Direct coil drive or logic level input (Any pin can drive, and you’re not using your uP as a relay driver)
    Then you can focus on specific parts. If you can, try to make sure the part you pick for the transistor/FET and snubber diode have a part with “bigger” specifications available in the same size package. If you can’t be right, be flexible.

Moved to Projects, this is not a Schematic problem

1 Like

For what it’s worth, when I need to control a relay from a microcontroller, I use a 1N4007 diode and a 2N4401 transistor. (I use Omron G5LE-1 DC5 relays, which seem similar to the Panasonic relays you have.)

I’m not claiming that this is the best; I do not have an electrical engineering degree. Just that it has worked reliably for me in a number of projects.

On the other hand, you may find it convenient to just use the same parts that you used for D2 and Q1 on the HB-UNI-Sen-POOL board you are also making. That way, there are fewer unique parts to order.

2 Likes

While it might work, my spontaneous thought would be that with two relays, the BC547 (Ic 100mA) is too close to its limits for comfort.

Any specifics on why not to use 1N400x for snubber? Speed?

Or you could just buy a module for a couple of bucks. Optoisolated even. Example:

Indeed it is speed. The 1N400X parts were designed for rectification of low frequency AC. So when you de-energize the relay, and the inductor/coil does what inductors do when you stop the flow of current, there is a big voltage spike that will occur before the diode starts to conduct.
In the design, the delay in having the snubber diode conduct means that the A2 connection to the coil could briefly rise far above 12V, which might be more than the reverse bias on the LED than it can take or might exceed the voltage rating of the transistor. When you get things working, if you have an oscilloscope you can trigger on the SPK_RELAY control line and look at the A2 to see all this happen. If you don’t have a scope, since all fun hobbies are expensive you can get a nice 2 channel 100 MHz digital scope for reasonable price.
Designers have their favorite high-speed diode, and you can see one that works OK in elekgeek’s post. Note that the design may add some noise or spike to the +12 since the diode will be dumping the energy stored in the coil back out to the 12V line. For this use case, you want to be sure the diode has a sufficient voltage rating when it’s reversed bias (taking into account what spikes might be on the +12). Most likely anything >= 50V will work. The current through the diode will be the same as the coil current, so if the coil current was 70 mA, I’d look for a diode that could conduct 150 mA or more. Don’t pinch pennies for a low volume design.
And finally take a look at a ULN2003. There are a number of parts in this series. They are relay drivers with the snubber diode built in. Note that the input voltage is 5V though. The input current is about 1 mA. You waste a lot if you just want one relay, but, it’s cheap (about $.70, and in stock at Mouser) and a good go-to part for driving relays. You could use another drive in the package to turn on the LED. And you’re ready for your next project where you might have 2 or more relays. Both DIP and SOL packages are available. There is also a ULN3803 in an 18 pin package that has 8 drivers, that’s the part I have in my cache of common chips.

2 Likes

You lost me on the way. You guys are experts since I am just hobbyist. :innocent: