Driving relays with Digital IO board

237 views
Skip to first unread message

Alex K

unread,
Jul 30, 2022, 7:26:45 PM7/30/22
to RC2014-Z80
I am hoping to use my RC2014 to drive a basic 8 bit lights display. I have already assembled and familiarized myself with the Digital I/O board, and written a couple simple basic programs. The goal is to trigger relays, which I'll install to complete the power circuits on light boards with their own adequate power supplies. 

I have some relays which on the output side I'm all set (NO, NC, COM), and the input is pretty straight forward too, IN, V+, V-. There is a jumper for high/low to toggle, and reading the information about the Digital IO board leads me to presume I would want to leave that on High for toggling. 

If I'm thinking correctly I would wire the relays V+/V- to the same 5v power supply as my machine (I have a regulated 3A meanwell 5v supply which I use for USB powered projects like this) or the 2 pin 5v output header on my Pro backplane, and then wire the output pins of the 74LS374 straight to the IN terminal on the relay, skipping the resistor and LED. Or, in a perfect world, as opposed to omitting the LEDs, I could install a 8 row pin header piggybacked on the back of the digital IO board, on the outside pads of the 330 resistors, leaving me output pins to wire to the relay inputs. Does this sound sane?

Douglas Miller

unread,
Jul 30, 2022, 8:24:10 PM7/30/22
to RC2014-Z80
I don't believe a 74LS374 can drive relays, you probably will need some sort of open-collector buffer such as 7406. Check the current draw on the relay coils, you may not be able to use 'LS' buffers. Also, make certain to decouple the relay coils with a reverse-biased diode or you will likely fry the TTL outputs. You may also have issues with the relay coils or contacts inducing glitches back into the digital logic - depending on the voltage/current of the lights.

Others may have better advice, but that has been my experience driving relays.

Alex K

unread,
Jul 30, 2022, 8:36:52 PM7/30/22
to RC2014-Z80
Thanks Douglas.

The relays I am using seem to be intended to be driven by detecting high/low on a circuit, like a logic probe. Using a logic probe at the points in question they toggle high as expected. So perhaps I am making some incorrect assumption. 

I'll check the stats of the relay but I guess what I'm trying to say is the signal pin itself isn't technically "driving" the relay. I think it just toggles hi/lo and the voltage pull for the relay itself would be from VCC. My apologies if my ignorance leads to incorrect terminology.  

Douglas Miller

unread,
Jul 30, 2022, 8:59:48 PM7/30/22
to RC2014-Z80
If the relays have digital inputs (I'm not aware of any, but I have not looked), then they could probably be driven by the 74LS374 outputs directly. Conventional relays have a coil, and many 5V relays are low current such that open-collector TTL can typically drive them fine.

The thing is that the current going through the relay coil also goes through the transistor on the TTL output. The 74LS374 outputs are not capable of driving that much current, usually. Also, because of the coil inductance, when you turn off the relay there will be a large backward spike that can damage TTL, so you need the diode to suppress that. Typically, in TTL the "low" output transistor has more current capability (and less series resistance) than the "high" one (open-collector outputs have no "high" transistor), so you typically drive something like an LED off the "low" state, which means you are "active low" (logic "0") on the outputs. I'm not sure how this digital I/O board operates, but if you want to turn on lights when the output is high (logic "1"), then you'll need an inverter such as the 7406 anyway.

You might post the details of the type of relay you have.

Earth Person

unread,
Jul 30, 2022, 9:02:00 PM7/30/22
to RC2014-Z80
Greetings,

I've seen ULN2803A's (along with ULN2801A, ULN2802A, ULN2804A) driving relays. There is some good info here:


Also may want to find some of the ULN280XA's.  ULN28xA.fm (st.com)

Sincerely,

William Harrington 

Douglas Miller

unread,
Jul 30, 2022, 9:09:30 PM7/30/22
to RC2014-Z80
The ULN28xx devices seem to be basically high-current equivalents of open-collector TTL, although they are basically transistor arrays and so need additionally components to properly "mate" with TLL. At least that's what I gather from the datasheet. If the relays are low enough current, I would suggest going with something like a 74'06 just to keep it simple. The ULN28xx do contain 8 drivers, though, so that may be better than using 74'06 which only contains 6 drivers per package.

Alex K

unread,
Jul 30, 2022, 9:26:14 PM7/30/22
to RC2014-Z80
Screenshot_20220730-212219_Amazon Shopping.jpg
These are the relay modules I have laying around, and I figured the lights with their own power could be toggled with the Common/NO terminals. 

Douglas Miller

unread,
Jul 30, 2022, 9:43:00 PM7/30/22
to RC2014-Z80
I see, it is a relay module, not a bare relay. And it seems to have the drive circuitry built-in. I can't find a proper datasheet for it, but it looks like something that a 74LS374 could drive directly.

Dave White

unread,
Jul 31, 2022, 12:35:41 AM7/31/22
to RC2014-Z80
That module has the drive transistor and protection diode included. No problem driving from TTL.

Phil G

unread,
Jul 31, 2022, 6:32:25 AM7/31/22
to RC2014-Z80
>>If I'm thinking correctly I would wire the relays V+/V- to the same 5v power supply as my machine
Those modules probably have a schottky across the coil but even so...  I would suggest a separate supply for the relays, common ground obviously, relays are highly inductive and on switching will put spikes on your main 5v rail, best avoided.
Cheers
Phil

Douglas Miller

unread,
Jul 31, 2022, 11:05:34 AM7/31/22
to RC2014-Z80
Looking at the datasheet for the relays used in the modules, the coils are rated at 71.4 mA. So, absolute minimum, you'd need a relay power supply able to deliver more than 572 mA. There may be variation in coil resistance (thus current), so you might need to add a safety factor. Perhaps just go for at least 1000 mA.

Additionally, what little data I could find on the relay module said "trigger current 5mA". Not sure how to interpret that. The 74LS374 outputs are rated at 2.6 mA for the "high" logic level (and 24 mA for "low" - plenty). If the module really wants to draw 5 mA, and that is from the "high" logic level, then you may have issues. It really depends on the circuitry surrounding the inputs. It may also dictate how you jumper the modules (if I understand the "high"/"low" jumper correctly - the English translation is not good).

Andrew Valencia

unread,
Jul 31, 2022, 11:59:29 AM7/31/22
to RC2014-Z80
I had a slightly related experience using one of these recently.  I came across:


(for my purposes the Emitter Darlington circuit drove the relay module nicely)

Alex K

unread,
Jul 31, 2022, 12:08:01 PM7/31/22
to RC2014-Z80
I can use a separate 5V supply with adequate amperage, and connect the grounds, that's no issue. Thank you for the current draw info.

It sounds like trigger low might work, I can also check the specs for the HCT chip as that's what came with my board (I should have LS series ones in hand too). 

Alex K

unread,
Aug 1, 2022, 12:23:51 AM8/1/22
to RC2014-Z80
I found a different relay module which should require less current and claims to be controllable with TTL logic. I'll probably wait to have one on hand as opposed to having a greater potential of pushing output limits of the 74LS/HCT chip(s). As a bonus it's got 8 relays which will be perfect if it works. 

SainSmart 8-Channel Relay Module https://a.co/d/6JJJqm5

Chris Brunner

unread,
Aug 1, 2022, 9:29:49 AM8/1/22
to rc201...@googlegroups.com
I've used the ULN2803A chips for quite a few relay projects because it has all the circuitry you need for driving them: https://www.ti.com/lit/ds/symlink/uln2803a.pdf?ts=1659274307160&ref_url=https%253A%252F%252Fwww.google.com%252F

I frequently use them paired with an MCP23017 I2C GPIO expander. That combination allows me to control up to 16 5VDC relays over I2C.  I don't see any reason you couldn't drive your relays through the ULN2803 from the Digital I/O board.  I have an SC126 with an SC129 Digital I/O board I could test with to confirm.  Still waiting on the relays to arrive though but I might still have a couple in a parts bin somewhere.

--
You received this message because you are subscribed to the Google Groups "RC2014-Z80" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rc2014-z80+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rc2014-z80/b167f7a0-eee2-42b8-9ee0-fd6102a6e904n%40googlegroups.com.

Alex K

unread,
Aug 1, 2022, 10:06:50 AM8/1/22
to RC2014-Z80
That ULN2803 IC looks very useful, I went ahead and ordered a couple. If I have an issue getting this relay module to trigger with the TTL logic from the digital IO board, putting one of those in the mix seems like a nice next step.

-Alex

Alex K

unread,
Aug 2, 2022, 10:29:12 PM8/2/22
to RC2014-Z80
I can confirm the Sainsmart 8 channel relay module works with the digital IO board. I took an extra 20 pin socket and bent out the 8 output pins to disconnect them from the LEDs, attached wires, and jumped the 8 wires in numerical order to the relay module.

The documentation for the module said for best isolation to remove the jumper which powers the relays from the same VCC as the signal connection. So I did this, and powered the relay module directly from its own PSU.

This is an active low module so the docs say that you want to connect vcc and the signal lines from your project to the input block on the relay module (removing the jumper separated the relay VCC input from the RC2014 VCC already). It also says for best isolation not to connect the ground, so, I didn't. I took 5V for the signal input from the 5V aux output of the RC2014 pro backplane. And it works great! Thanks everyone for the help.

20220802_202717.jpg
Reply all
Reply to author
Forward
0 new messages