I'm trying to get the Arduino to control multiple 12V relays - some of which will have 240V AC load, the others 24V DC load.
What I want to do is to use a ULN2003 to drive the relays and, in turn, drive the ULN via the digital IO pins from the arduino. I'd also like to include an LED for each relay to indicate it's status.
This is the first time I've ever done this, so am seeking some feedback on the schematic.
(Apologies for the incorrect image link - forgot my home server was password protected ).
My questions are:
Am I correct in assuming I just rinse and repeat the red outlined section for each relay?
By my reading, the ULN2003 includes a suppression diode on chip, so I don't need to include one, right?
Is that the correct wiring for the LED and resistor?
If I'm using a basic LED, 1.8-2.2VDC forward drop, Max current: 20mA (LED - Basic Red 5mm - COM-09590 - SparkFun Electronics) I'm assuming that I need to add something else into the LED portion to limit the voltage as well as current?
As I need to drive at least 12 relays, can I just replicate this board and combine both of their grounds back to the arduino?
I'm assuming that I need to add something else into the LED portion to limit the voltage as well as current?
No, the resistor does that for you. Let's say you have 2V drop in the LED, then as a ballpark estimate the resistance should be (12V-2V)/10mA = 1k. 10mA is usually plenty to light an LED...use 4.7k if you really want 20mA.
Should be OK on the replication.
The only thing to watch out for is maximum power dissipation on the ULN2003 devices. You didn't tell us how much current each relay uses, or how many you plan to have on at once. The ULN2003 output dissipates V*I power (where V is its on-voltage...close to 0 but not 0).
--
The Rugged Motor Driver: two H-bridges, more power than an L298, fully protected
Thanks again. I write software for a living and it's been a long time since I've done any sort of electronic work for a living - but that was all calibration, not design - so I feel like a bit of a dunce.
Which end up coming out to ~0.08A per relay. I shouldn't need to have more than 6 relays on at a time. If needs be, I can stagger the which ones between the two ICs to ensure I've only ever got 3 on per IC at any one time.
Looking at the data sheet for the ULN2003A, it's rated at 0.5A for the collector current, so it shouldn't be a problem.
No, the resistor does that for you. Let's say you have 2V drop in the LED, then as a ballpark estimate the resistance should be (12V-2V)/10mA = 1k. 10mA is usually plenty to light an LED...use 4.7k if you really want 20mA.
Not to be a pratt, I just want to make sure I'm not going batty with my calculations
Wouldn't a 4.7k resistor drop the current to 2mA, whereas a 510 ohm resistor would bring it up to 20mA? (Not that I'm going to do that, a 1k driving 10mA is just fine).
I think you may find that the LED will not turn off when expected with 12V of reverse bias - many are only good for 5v.
You may have to move it to the input side of the ULN2003.
CrossRoads:
I think you may find that the LED will not turn off when expected with 12V of reverse bias - many are only good for 5v.
You may have to move it to the input side of the ULN2003.
I think I'm understanding what you're telling me. By placing the LED and resistor where it is, it's parallel to the relay and will suffer from the reversed bias voltage spike generated by the relay turning off and collapsing it's magnetic field?
Would it be enough to just throw another diode between the resistor and the led that has a better rating than the led to handle the reverse bias? My thing with moving the LED to the input side is that the arduino will be barely enough to drive 1 LED and input collector and will quickly become more complex.
... and then my thought process went on a bit further ...
I was thinking that I'd have to go more complex and have individual transistors for each LED and drive them off the 12V rail, but what's stopping me from going:
5V in from arduino -> ULN2003 -> drive LED -> ULN2003 -> drive relay? (I'll draw another attempted schematic tomorrow when I have access). Would certainly make for an easier routed PCB.
Here's what I intended to say about your monitoring LED:
Per the ULN2003 datasheet, input current will be around 1.2mA at 5V, the arduino can handle that and driving an LED at the same time.
What I have seen in my experimenting is that with a simple open collector driver as shown, a single LED would look partially turned on with a 12V source even when the base was grounded. 2 LEDs would also look turned. For my design, I had to use 5V to get them turned off.
With the ULN2003, which is an open collector driver also with 2 added reverse bias diodes added for protection, I don't know if that will happen. Just don't be surprised if it is.
(I drew a motor symbol here, was thinking of a different circuit, but its still a coil either way).
Grumpy_Mike:
But you can't have them all pulling that at the same time. About 650mA is the total you can get away with so with 8 all on at the same time you are just about alright.
Yes you're right. What I didn't show in my diagram is that there'll be 2 ULN2003s driving the required amount of relays, giving me a total of 14 outputs. Of these I'll only need a maximum of 6 on at any time. With a little bit of thought, I can stagger the relays so when the required 6 are on, I'll only be running 3 concurrently off each IC.
CrossRoads:
With the ULN2003, which is an open collector driver also with 2 added reverse bias diodes added for protection, I don't know if that will happen. Just don't be surprised if it is.
I get you. I'll experiment with the bread board before I layout a PCB
Thank you both for your input. I'm genuinely appreciative.