Driving large numbers of relays

I am a microprocessor programmer specializing in the Zilog Z8 family. In the past I have done several boards for controlling high speed processes. I like the Z8 because of its large number of registers and on chip features. My current project will use the Z8F6421.

I am working on a board that will control greenhouses. I have no training in electronics but over the years have learned all I needed to know from app notes.

However, all my previous projects were completely digital. I now need to control a large number of relays. I have no experience or education in this area, and am having trouble understanding the information I am finding.

I originally planned to control the relays directly with GPIO pins, but now am leaning toward 74HCT574's and a 74HCT138 to multiplex the pins, since the number of needed relays grows daily.

I am looking at darlington arrays such as the ULN2803 but don't know how to determine the added resistors and diodes.

I also want the driver to drive a led which will turn on when the relay is activated, and want to use a zener to sense the presence of

24v AC voltage at the output of each relay. There will be a fuse at each relay and I see the zener at the relay end of the fuse. I plan to run the zener output into a 74HCT251 and sense AC activity with a GPIO pin.

I came to this board in the hopes of getting some detailed advice on the exact resistors and diodes needed with the ULN2803. I originally chose the ULN2803 because I planned to drive the relay directly from the GPIO pins of a 3.3v microprocessor, and purchased 3.3v coil relays for the prototype for the same reason. Advice on the best devices and best way would be appreciated now that they will be driven by the output of an HCT574.

Thanks in advance to anyone who can provide some advice.

Reply to
Loading thread data ...

Nice part:



Reply to
John Larkin

YOu shouldn't need any extra resistors or diodes. The ULN2803 should accept the outputs from the microprocessor or HCT574 directly, and includes the "catch diodes" you should have across the relay coils. Connect pin 10 to the relay supply to use the internal diodes.

Peter Bennett, VE7CEI  
peterbb4 (at) interchange.ubc.ca  
 Click to see the full signature
Reply to
Peter Bennett

Like Peter said, the ULN2803 already has the input resistors and protection diodes built in.

Place an LED in series with a resistor across the relay coil. The resistor value depends on how bright you want the LED to be, what color (since LEDs of different colors have different voltage drops) and also on the voltage across the relay when it's activated. Assuming that the relay coil will actually have 3.3V across it, a red LED will use 1.8-2V out of that 3.3V. The remaining 1.3-1.5V is to be absorbed by the resistor. So, a resistor of 220 ohms to 1k.

If you're thinking of driving the relays with the ULN2803 from

3.3V supply, remember that the ULN2803's output transistor uses up around 1V of the 3.3V, leaving about 2.3V for the relay (depending on the current drawn by the relay coil), and that may cause unreliable relay operation.

It looks like you're going to have to provide a 5V supply for the HCT574 anyway, so it's probably better to power the relays from that too. The relay coil plus the ULN2803's output transistor together need 4.3V. You can drop the 5V to 4.3V with a resistor in series with each relay coil.

The correct resistor value for that depends on the current drawn by the relay, and that depends on the coil resistance. Do you know what the coil resistance is?

Reply to

Here is an interesting part that uses an SPI four wire interface to the uP and it has 8 MOSFET outputs each capable of 350 mA or more, and RdsOn of about 1.5 ohm. Each additional bank of 8 outputs requires only one additional IO pin.

formatting link


Reply to
Paul E. Schoen

sort of a build-your-own bit array.

haw about using one or several chained 74HCT595 to multiplex the pins and just load the data in serial, especially if you don't need sub-millisecond response times.

only takes three microcontroller pins.

if you've got an unused USART or SPI you can use that, else bit-bang works fine.

the ULN2803 seems to be designed for 5V cmos it has the resistors and diodes internally, however from the datasheet it should wok OK on 3.3V CMOS as long as there are no other loads on each pin.

wire it parallel with a suitable series resistor parallel to the relay coil

you could use a blue LED with a regular diode (eg 1n914) anti-parallel instead of the zener and get a visual indicator for free.

the ULN2803 output, being a darlington doesn't go all the way to ground (goes to about 0.7V), but your relays should still function with 2.7V on the coil.

I'd consider using a shift register instead here too, pulse the latch pin during the peak of the AC and then read off the results, possibly using the same clock the 74HCT595 uses.

--- news://freenews.netfront.net/ - complaints: snipped-for-privacy@netfront.net ---

Reply to
Jasen Betts

View in Courier:

 Click to see the full signature
Reply to
John Fields

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.