Mega 2560 and multiple ULN2003

Hi All,

glad you’re here.

I need to trigger 24 latching relays from Mega2560 via ULN2003 IC’s.

I’m planning to use only 4 input pins to each IC. (max 7pins per IC)

There will be 48pins from mega to IC’s. On time for all pins is 40ms

My question:

Is there a method to power the IC’s with aux power rather than by mega?

I can also split the 24pin firing into small enough groups, if need be.

The IC data sheet seems to indicate 3.85v, .93ma per pin:

I(subI)ON- Input current for ULN2003, VI= 3.85 V 0.93mA (typ) 1.35mA (max)

About 9W for 24 pins?

I’m making iso pcb’s for this project and have them ready to cnc. I have a single relay driver cct brd brded and working,

so this “pwr to the IC’s” is the present concern.

Thanks for experienced wisdom in the matter.

Donald

Yes, it's very common to use a separate power supply, for example a 12V supply for 12V relays.

You do need a common ground.

Hi dvdDoug,
I'm using separate power supply for the relay coils but I don't know how to hook up separate supply for the IC's.

Thanks,
Donald

Hi,
The ULN2003 is a simple device. See HERE: (Scroll down to 2003)...

So there is no "chip power" like other IC's.

The signal input current as you said is nominally 3.85V at 1.35 mA max. So if the Mega puts out 4V at 1.35 Ma (AKA .00135 amps) That's about 5 Milliwatts, right? Times 48 equals about 1/4 of a watt. And not at the same time, probably.

Maybe you don't have any need for separate IC power supply..

ULN2003 and the 8 "channel" version ULN2803 are just presented as Inputs from Arduino outputs.
They have input resistors before NPN bases, limiting current to 0.93mA to 1.35mA, so no external resistor is needed.
Ports of a Mega are limited to 100 mA, 8 x 1.35mA is well under that.
If you drive 48 of these, you're still well under the 800mA that a Mega could source at one time (4 Vcc pins at 200mA each = 800mA).
And as Terry said, they are not powered from the Mega - they are really just open collector drivers that you are sending a logic signal into.

If you're really concerned, use TPIC6C595s instead, daisy chain3 or 4 of them and shift data in with SPI.transfer() or shiftOut(). Fewer Mega IO pins needed, little bit of 5V current, and will run cooler when sinking current thru the relays vs ULN2803.
http://www.digikey.com/product-search/en/integrated-circuits-ics/logic-shift-registers/2556326?k=tpic6c595&k=&pkeyword=tpic6c595&pv69=80&mnonly=0&newproducts=0&ColumnSort=0&page=1&stock=1&quantity=0&ptm=0&fid=0&pageSize=25
Use TPIC6B595 if you need more sink current
http://www.digikey.com/product-search/en/integrated-circuits-ics/logic-shift-registers/2556326?k=tpic6b595&k=&pkeyword=tpic6b595&pv1291=1207&mnonly=0&newproducts=0&ColumnSort=0&page=1&stock=1&quantity=0&ptm=0&fid=0&pageSize=25
Connect up control signals just like a 74HC595:
Mclear to +5
OE/ to GND or drive from a PWM pin
SRCLK from SCK (clkPin)
Din from MOSI (dataPin)
RCLK from SS (latchPin), outputs update on a rising edge here

// time to update outputs?
digitalWrite (ssPin, LOW);
SPI.transfer(byte0); // send out data at 4 MHz default speed
SPI.transfer(byte1); // way faster then writing to 32 outputs one at a time
SPI.transfer(byte2); // and way faster then 4 shiftOut commands
SPI.transfer(byte3); // don't forget 0.1uF cap from each Vcc pin to Gnd
digitalWrite (ssPin, HIGH);

And you can increase the SPI speed to 8 MHz for even faster updates.
And use direct port manipulation to get down to near 1uS per byte shifted out.
And for fastest yet, use some assembly to get down to just 17 clocks per byte:

PORTB = PORTB & 0b11111011; // clear D10
spdr = byte0; nop; nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop; // 17 clock transfer
spdr = byte1; nop; nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop; // 1.0625 uS/byte with SPI divisor at 2
spdr = byte2; nop; nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop; // so SPI clock is 8 MHz.  Fast!
spdr = byte3; nop; nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;
PORTB = PORTB | 0b00000100; // set D10

PORTB bit 2 is D10 on Uno, use what ever port SS pin is on the Mega.

Using A Fluke 87V, i measured .02mA at the output of IC and .06V between grnd of mega and

output of IC. I understand now that the IC is a conduit that switches on and off with the

maga pulse.

Another observation: when I use small transistors that are triggered by arduino to fire the

relays, it takes 5v from aux power for the coils. (rated at 5v), but with the IC it takes 6.5V

from aux power to fire the coils consistently.

I'm grateful for the expert info and feel good about trying this with the ULN2003A's.

When I saw Crossroads was a Brattain member, I thought it had to do with the UK but then

learned he is down the road from me in MA and Terry is a stone's throw away also.

Thanks for your time and help,

Donald

The ULN is a darlington array and has a relatively high dropout voltage of ~1volt or more depending on relay current. That means that for reliable firing you really should use a 6volt supply for 5volt relays.
If you use 5volt relays (not sure).

The TPIC6*595 has been mentioned, because it's a better solution.
Mosfet outputs (low dropout voltage) and active voltage clamps (no diodes across the relays needed).
And only three control wires for as many relays as you want.
A $2 Nano could drive a shipload of relays.

"There will be 48pins from mega to IC's." Not sure what you mean with this. Two-coil latching relays?
Leo..

Thanks Leo,
I’ll check more fully into the TPIC6*595.
Donald
P.S. the 48 pins form the maga to IC’s is because I’m using single coil latching relays and each one has 2 contact points. 48 pins from mega to the IC’s, from IC’s to the relay contacts. 48 pins have to be controlled but only one contact from each relay has to be given a 40ms pulse per switching.

Pulse right relay contact (in my case from IC) for on and left for off.

AFAIK single coil latching relays can't be driven by an ULN or a TPIC.
They have to be driven by (expensive) H-bridges.
What is the voltage/current of these relays.
Link to the datasheet.
Leo..

I have an example of a DPDT single coil latching relay that is being switched alternately to the pairs of contacts by mega through a ULN2003 exactly as desired.
This example has been running on my bench today for hours.

This is not the subject of my original question.

Donald

brodonhaas:
This is not the subject of my original question.
Donald

Just making sure that the answers already given are correct.

The ULN2003 can only sink current.
If two ULN outputs are connected to two pins of a single coil, then where is coil power coming from.
Leo..

Leo,

The initial post and the post #10 have sufficient info for my circuit.
Donald

Ok, ok, I'm sorry. I should have known that.
I suppose I have to buy a new crystal ball.

Yes, each TPIC6*595 can control four single coil latching relays in a poor man's H-bridge.
Leo..

Hi Leo,
I'm making 4 cct boards, each is a segment of a 4 battery rotation system for a motor.
I have one board working at present and when it's time to test the 4 together, we'll know more.
2 of the boards have 4 relays and two have 8.

I appreciate your knowledge and good heart.
Donald

Hi All,

My 4 battery rotation system is up and running.

In this system one battery is being charged.

One is resting and two are doing the work.

presently I'm changing position at a set time interval.

I'm interested in triggering a position change of the four batteries via a voltage sensor.

For example: a low voltage reading on battery B, would signal arduino to change to the

position that would put battery B in the charge position.

Voltage range would be between 10v and 16.5.

Any reccomendations on a simple method to incorporate a voltage reading to trigger a

programmed action.

I'm very grateful for previous help, it has been very valuable.

Donald