DIY Relay Module Saves Time

As any programmer could tell you, there’s significant value in automating a process that is performed often enough. The more times that process is used, the more it makes sense to automate it or at least improve its efficiency. This rule isn’t limited to software though; improvements to hardware design can also see improvements in efficiency as well. For that reason, [Hulk] designed a simple relay module in order to cut the amount of time he spends implementing this solution in his various other projects.

While driving a relay with a transistor is something fundamental, this project isn’t really about that per se. It’s about recognizing something that you do too much, and then designing that drudgery out of your projects. [Hulk] was able to design a PCB with 12 modules on it, presumably saving fabrication costs. He can then easily populate them with specific components as soon as he needs one. Another benefit of designing something like this yourself, rather than an off-the-shelf relay module, is that you can do away with any useless features you’ll never need (or add ones that aren’t available in commercial devices).

We can appreciate the efficiency gains this would make for our next project that needs a simple driver for a light, garage door opener, or any other binary electronic device. It can be a hassle to go find the correct transistor and relay, solder it all on the project board, and hope it all works. A pre-made solution solves all these issues, but we do wish the schematics were available to keep us from having to design our own. Driver boards are a pretty common project for all the different types of relays we see around here, so there is probably one available out there.

22 thoughts on “DIY Relay Module Saves Time

  1. “Another benefit of designing something like this yourself, rather than an off-the-shelf relay module, is that you can do away with any useless features you’ll never need”

    In this case safety seems to be that feature. No isolation routing and the relay output is taken to what looks like 0.1″ pin headers.

    1. The relay contact header looks like 0.2″ (5.08mm) to me. Probably to fit screw terminal blocks.

      All good for low DC voltages. If you want AC switching then a SSR would be better.

      0.2″ is OK for 120v but a bit close for 240v though I see many 240v connections pitched at 0.2″

        1. Are you legitimately asking or trolling? In case of a legitimate question, when they stated AC, it’s because of the typical use case of AC with a relay outside of industrial controls so it’s a significant portion of people controlling voltages fed from an outlet instead of from a lower than 120V AC source. So I intrepret the suggestion was more along the lines of getting it to stick in people’s heads that higher voltage (in the common situation of using an outlet’s line voltage) to use an SSR.

          As for relays in general, you do have to be careful in selecting the appropriate relay (for various reasons including maximizing the lifetime of the relay, and expected operation) whether or not it’s for AC or DC switching if you are being more particular than “just switch some time soon after I tell you to”.

          So anything related to EMR vs SSR wave-form related? Typical characteristics of them that come to mind:

          Electro-mechanical relays
          – possible EMI / transient noise / magnetically coupled interference issues
          – variations in pull-in/drop-out voltages create a high hysteresis that can affect precise timing
          Solid State relays
          – mechanical movements limits the switching time which can affect the load side wave-form
          – typically doesn’t have load level switching features
          Solid State relays
          – Lower EMI produced (generally)
          – lower hysteresis and faster switch times
          – Typically AC rated SSR’s come in Zero-Crossing (synchronous) so they wait to switch on the zero crossing of a waveform (which is nice for lots of loads but kills precision timing) , random turn-on (asynchronous) which turn on immediately without watching the AC load signal, as well as burst fire & phase angle but those are unusual in my experience and while they are wave-form related I won’t bother writing more on.

          1. SSR’s are also easier to kill, can fail with both shorts and leak modes, need heatsinks..

            For sure SSR’s have their place but they are not the end all of switching.

            Look at just about any appliance that does not use proportional control and you will see relays, not SSR’s. There is a reason for this.

        2. In addition to [Lord Binky]s comments,

          The original post was about safety (distance isolation) for higher mains voltages. I should have made it clear that by “AC” I meant mains voltage.

          In this case a SSR has additional advantages for those less experienced in mains voltage design

          Precalculated and certified distance isolation built in

          Very high, safe, certified voltage isolation

          Large physical distancing between low and high voltage sides

          Low drive currents that can often be directly connected to a uC GPIO

          Mains side screw terminal with barriers to encourage captive connections.

      1. I’m not sure SSRs are all that great a solution. They don’t wear out mechanically like a relay but they have a much worse problem. They tend to fail closed. I suppose that whether failing open or closed is better depends on application but the first one which comes to my mind is controlling a heating element and failing closed might burn one’s house down.

    1. I totally agree. Sometimes it is just easier and less expensive going with the flow. If you need to control something big, you can use an off the shelf opto coupled relay module to pull in a big contactor.

  2. Definitely building up stuff you commonly use and get tired of wiring up every time is a good thing. The other day I needed some LEDs so I could debug something I built a few weeks ago, so I made an 8 LED module that I can drop onto a breadboard (with SOT-23 NPNs, some 0805 resistors, and a few 4mm LEDs from my jar of LEDs). I don’t like the idea of driving LEDs directly, and I got tired of wiring up so many parts all the time, and it took up so much breadboard space too.

    I had tried to do this before, but on those Radio Shack boards with single-sided copper. It wasn’t as small (I used TO-92s and axial resistors), and the pads to the headers would come loose and start lifting off. And I don’t even know where it went. This time I got some double-sided plate-through boards from Amazon, and hopefully they’ll stand up to use. It’s also a project I could make boards for to get more experience with KiCad.

    Now I should make a switch input module, but a resistor pack and a big DIP switch got me going this time.

    1. The did something similar with a ULN2008 some smd resistors and LEDs on 0.1″ pitch stripboard. 8 pin right angle header and flying leads for power and ground.

      You could use a resistor network to make it simpler.

      1. To be fair, it was also SMT soldering practice, and a prototype of the circuitry for later board layout practice. The SMT parts mostly butted against each other over the 0.1″ spacing donuts.

  3. I do the same: if I’ve used a circuit more than twice I either look for a cheap commercial version or I make a bunch (or I make a schematic/layout that I can copy/paste into other layouts.) For me, it’s low-side switches like this, switching buck regulators, and low-side constant current drivers. Increasingly, arduino pro micros or esp32’s also get stuck in everything, sometimes just in case I might later want to add intelligence.

  4. Why re-invent the hot water….single relay module are available off the shelf….with opto isolation….for less than a dollar…..focus your energy and knowledge on something that doesn’t yet exist….

  5. https://xkcd.com/1205/

    says it all really…

    You really do need to look at how many times you do something. I don’t use relay boards much – maybe 20 a year – and they only cost (similar relay boards to this one, I just looked) $0.27US, and opto isolated at around $1.50US, and one with a 8266 already on it for about $2US, I’d have to be doing a LOT of them to want to build my own separate board..

    Of course, if I’m doing something else anyway, I’d put a relay directly on that board.. Opto is still nice though!

  6. I see various people rave about opto isolated relay modules available for “less than a dollar”
    No doubt those are the popular ones at the various chinese webshops. ALL the opto isolated modules i came across there are not opto isolated as both sides of the optocontroller share ground connection and not seldomly also the vcc

Leave a Reply to ROBCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.