Arduino Relay Module

That’s the nature of Blog’s - everyone’s an expert

1 Like

Ok, if you want a cookie cutter answer:

  1. Use elekgeek’s answer.
    or
  2. Use the ULN2003
    or
  3. Buy the module hmk referred to.

It’s hard to figure out what level everyone is at, sorry I explained too much. We all started as hobbyist. I prefer the concept of expertise instead declaring that one is an expert, keeping in mind that expertise is something you get after you need it. Once you get this working, I’m sure you’ll learn from it and continue your journey.

1 Like

Therefore, keep it simple…
FYI - Back to my Post re using Arduino outputs to trigger 5v Relay Coil

(No inference made re everyone’s expertise - just wanted to repeat my way of doing it for simplicity and cost savings).

I control 5v Coil Relay’s, triggering them from 3V by Boosting using Arduino’s as a Booster (either on same device if some input is 3v or, on additional device if needing multiple line boosts).

About 2.9ish volts is sufficient input into Arduino Pin to register it as valid input signal.

Example:

Desktop-Example Using Teensy 3v Outputs into Nano input and outputting 5v (from Nano) to Relay coil - works like a charm and I’ve built handfuls of Hydroponic pump controllers this way.
All are still running after 5yrs of 24/7 use…

Sure, you can spend $1 for a Booster (10 for $10 at Amazon) but, I spend $3 for Nano clones - thus, I end up with many ports for about $0.10 per pin (or $0.20 per input/out pair’s)

ADDED:
Simple code that demo’s it… first delay is a debounce, second delay is just to see voltage on O’scope or DMM (naturally, do what’s needed for turning On/Off the ports… This code simply cycles through On/Off )

/* Voltage Booster (5v Out from Nano from 3v into Nano)
*
*/

void setup() {
pinMode(6, OUTPUT);
pinMode(5, INPUT);
digitalWrite(6, LOW);

}//end setup

void loop() {
if(digitalRead(5) == HIGH ) {
delay(5); digitalWrite(6, HIGH); delay(5000); }//end if--------
else { digitalWrite(6, LOW); }//end else--------
}//end loop--------------

2 Likes

You don’t have to apologize, I really appreciate the fact that I kidnapped you from your time to help me and explain to me, only that I would have liked to know more and to be able to have this discussion with you… not just to be a spectator. It is not your fault or yours (everyone else who participated in the discussion) that I am at a very low level of electronics. Anyway, you helped me a lot and I will take into account all the tips and I hope to choose the most suitable option.

Overall the group is pretty good but sometimes have a low tolerance for those that refuse to learn. :wink:

1 Like

I feel a little sarcasm in your answer and I feel obliged to clarify. It’s not about refusing to learn, but sometimes it’s hard to ask someone to run if he’s still learning to walk …

Learning to calculate suitable resistor values for the schematic in your first post is more on the level of learning to crawl or the first baby steps.
It’s a long way from running.

1 Like

Transistor and flyback diode were the two components asked for in the first post.
Resistor values are already given as 1k in the posted schematic.

(I’m sure someone could write something about learning to read, if we want to develop that part of the thread further…)

2 Likes

It was not about calculating resistance, because yes, this is easy even for me. It was about something else, a more complex discussion and it seems that it was misunderstood with what I wanted to say and in conclusion we better leave it like that. It is quite difficult to understand the tone and the expressions considering that we are not face to face.

Thanks for the ideas / advice and I wish you a good evening (my time in 23:12).

None intended. Enjoy the journey.

1 Like

It is sometimes a pity that more use is not made of these: :grinning: :slightly_smiling_face: :grimacing: :upside_down_face: :blush:

1 Like

Regarding the use of 1N400x as a snubber diode, someone seems to have done measurements and tests.

https://web.archive.org/web/20130923010554/http://www.cliftonlaboratories.com/diode_turn-on_time.htm

The result seems to be that the turn-on time, which is important for a snubber diode, is with good margin short enough for the risetime the voltage spike from a relay has, but the turn-off time, which is uncritical in this application, is slow.

So, in the end, 1N400x is a reliable choice as snubber diode?

It can be used and should be reliable according to the measurements in the link, as well as several other sources. It might not be the most optimal in all senses, but will do the work and protect the transistor from overvoltage. It is easily available and a well known component. It has a current rating of 1A, so it can be used with larger relays too.
1N4148 has a 200mA current rating, so for small relays that one is good too.

Now for both the problem is that the switchoff time of the relay is lengthened, and the physical speed of the relay mechanism at switchoff is lowered, which can cause long time issues with welding of the contacts and considerably shortened contact life.
To counteract that, one can use a zener diode with a voltage rating of approx. half of the transistor voltage rating in series with the 1N4148 or 1N400x, connected in the opposite polarity, that is anode of 1N400x to anode of zener.
An alternative is to use a TVS (Transient voltage suppressor) diode, which are available in bidirectional versions, with a voltage rating high enough that they will not conduct for the normal relay voltage (5V relay -> 10-15V TVS or so).
With the zener or TVS, you need to have a transistor that will withstand the nominal relay voltage + TVS clamping voltage (which is higher than the nominal voltage rating, see datasheet) + some extra margin.
So in this case a 45V rated BC547 or 337 with 5V relay and 12V TVS or zener should be okay.

Example of TVS could be the RND SMAJ11CA. There are many similar devices from various manufacturers and in various packaging. This one is surface mounted, but hole mounted versions exist too.

If you search for ‘relay flyback diode’ in your favourite search engine on the internet, you will find a lot of interesting reading on the subject.

1 Like

HMK: you’re right on the money on all accounts. Tnx for that. :grinning:
One of my go-to parts in the parts bin is the MMBZ15VDLT1G. It’s a back to back 15V TVS diode.
Geeky Footnote: I tend to drive with a PNP pulled down by the NPN or FET. Diode across the coil, one side of the coil at GND. This keep the noise on the power in (typical 12V for most of the stuff I do) down. (yeah, GND gets a little noise, every choice has trade-offs).

That’s a nice part, and a little smaller packaging and more adapted for small relays, but seems to be out of stock and available in march 2023 or november 2023 depending on where you look…

As long as the flyback diode / TVS is parallell to the relay coil, the main current stays within the coil-diode loop. Of course you can still have some noise due to parasitic coupling on the power and ground rails, but that is comparatively little.
It’s an entirely different situation if you connect the TVS across the transistor, though…

It’s always amazing that even something as simple as a relay driver has so many options depending on other aspects of the system.
Parts are crazy now, I have about 12 parts on order from big stuff (microprocessors with RF) to small stuff (switching regulator chips, biased transistors, and small passives) that are out until lat 2022 and a few until early 2023. Some groups I know of are doing a re-spin every 3-4 months based on what they can get stock on. Another group has had to “up” the microprocessor the are using to a bigger (i.e. more expensive) part in order to get them. A motherboard I use is now only available with an 8 core processor, the 4 cores is not available indefinitely. 15 years ago a bought spools of the diodes and biased transistors in a SOT-23. Recently, I ordered more biased transistors but in the really small (SC-70 IIRC) package. Hobbyist, day job, and everywhere in-between everyone comes up with a cache of the go-to parts.
So I guess here the key concept is any back to back TVS diode is a good solution that can keep the energy in a local loop and not interfere with drop out time.
I suspect the OP has a lot of items to google and learn because of this thread and that’s a good thing.

Even though the post originally started with a common relay, the whole thread was really useful to me because I learned some things that would have been difficult for me to learn on my own. In conclusion, thank you and hat off to you all!

2 Likes

On the topic of 1N400x, the company I work for produced literally hundreds of thousands of boards for one customer that used a 1N4004 as a flyback diode across the relay coils (these would have 1-3 relays, which were a mixture of 5A-rated and 40A-rated relays depending on specific style).

I don’t remember hearing the customer ever raising a concern about this part (these were used as part of a demand-response system to selectively shed certain customer loads to help manage system peak load scenarios). Guess it’s just something that shouldn’t work, but does work often enough that it’s a common default setup.

You might possibly find the EEVblog video #1409 (search on youtube for EEVblog 1409) interesting and/or entertaining. He does some measurements with the oscilloscope that illustrate some of what we have discussed above.

3 Likes