I am trying to get my head around how to use an Arduino Uno R3 with a Darlington Array 2003A to drive a series of small electric hobby motors.
I'm hoping someone can explain in the simplest way possible the calculations I need to do for BOTH the circuits involved (The Arduino side of the Darlington and the circuit being switched side) to make sure I neither damage the Arduino or the Darlington array by the current and voltage I use for the motors (or any other component) in the circuit being switched.
I know I could use relays or individual transistors to do the job and which in many ways might be more straightforward but the all in one size and cost of a Darlington appeals to me and I think once I have the calculations sussed it may prove to be an invaluable resource for this and any future projects so whatever arguments there may be against it's use (I keep an open mind) I would still like to understand the procedure.
My understanding (misunderstanding) so far..
The 5V outputs on the Arduino side is compatible with the Darlington inputs but I'm confused as to how I determine the resistance I need in the circuit owing to the competing needs of the Arduino and Darlington.
To protect the Arduino I should limit the current in the circuit to 20 mA. ie: all else being equal add a resistor to bring down the current from the supplied 40mA.
However.. this doesn't take account of the current already being used by the Darlington Array.
I was told that the input current required by the Darlington depends on the current in the circuit being switched (I had thought it was independent). and therefore I need to know the relationship between the current in the switched circuit to the current in the switching circuit so I can choose a resistor that does not limit or exceed the input current to below or above (respectively) that required to switch the Darlington.
Is this true ? Do I need to base the calculation of the input switching current to the Darlington on the current in the circuit that is being switched ?
If so, I know I can calculate the current from Ohms law in the circuit being switched but I'm perplexed how I can determine the required input current from this and even if I could will it exceed the safe 20mA the Arduino prefers and therefore conflict with the decision to limit the current to that amount.
You can maybe see my thinking is going round in circles. I am completely new to electronics and my knowledge is limited to Ohms law but I think my confusion is compounded by not knowing fully how the current used by the Darlington effects the current in the input circuit.
Can anyone help me adopt a methodical approach to sorting out the calculations I need to do or to correct any wrong concepts I might have.. I include a diagram to summarise my thinking and from where I am starting. (I'm ok with the circuits themselves. - Just not the order of calculations I need to do. (Image attached)
One of the design parameters of a transistor (or Darlington pair) is "Beta" or "DC Current Gain". You take the desired current flow through the transistor and divide by the Beta to get the minimum Base current you need to provide. If that is more than 20 mA you need a transistor/pair with a higher Beta. The Base acts like a diode to ground so you have a voltage drop across the diode. Call that 1V. Subtract that from the 5V logic level to get the voltage across your current limiting resistor (4V) . Calculate a resistor to give you 20 mA at 4V (200 Ohms?). It's OK to provide more than the minimum Base current.
Thank you for the really clear explanation. That explains more to me in a few sentences than all the information I've tried hunting down all over the Internet. I only have 0.00677864 BTC in total (haha) but you deserve a few fractions of a bitcoin for that !
I'm not sure I understand the second part of your explanation fully. Is the voltage drop across the diode always 1V or is that variable according to the desired current flow as well. ? If it is always the same then you are saying that as long as the calculated minimum base current is less than 20mA I can use a 200 Ohm resistor on the input side ? (since as you say - the calculation you provided gives the minimum Base current and anything higher is ok)
You take the desired current flow through the transistor and divide by the Beta to get the minimum Base current you need to provide
Silly question but I am assuming the base current only matters when the pin is being switched ? ie: there is no need to worry about it when the outputs from the Arduino are low ?
I am trying to get my head around how to use an Arduino Uno R3 with a Darlington Array 2003A to drive a series of small electric hobby motors.
Your circuit is wrong in three ways.
The ULN2003 has 2.7k input resistors built-in. You need no resistors on the inputs.
(However you can always use 1k resistors if you like - then you don't have to
remember which device you're using, pretty much any darlington driver will be
happy)
Secondly you propose adding a resistor to limit current to the GND pin of the ULN2003.
That's bad, ground is the reference, always connect grounds together without resistance.
You can limit current to each motor with a resistor in its own circuit, or collectively with
a common resistor between the motor supply and all the motors.
Thirdly you must connect pin 9 to the motor positive supply or you'll risk destroying
the chip - this pin connects all the free-wheel diode cathodes so that they can suppress
inductive voltage spikes. Because all these diodes are commoned pin 9 must be connected
to the common supply for all the motors, or if several supplies, to the highest voltage one.
Thank you for the corrections which are very much appreciated. I am on a steep learning curve and am making lots of mistakes and probably wouldn't be able to work it all out if I had only to rely on internet searches alone.
The ULN2003 has 2.7k input resistors built-in. You need no resistors on the inputs.
I noticed from the ULN2003 datasheet that there were some resistors there but for some reason (I think it was something the retailer selling the ULN2003 said to me) I ignored them for the wrong reason. Thank you for the correction. This will make things easier.
Secondly you propose adding a resistor to limit current to the GND pin of the ULN2003.
You can limit current to each motor with a resistor in its own circuit
I understand now and can see why. They need to go on the positive side of the power supply. Thanks
Thirdly you must connect pin 9 to the motor positive supply or you'll risk destroying the chip - this pin connects all the free-wheel diode cathodes so that they can suppress inductive voltage spikes.
I wasn't sure about pin 9 but given that the diode connections terminate there I can see that what you say makes sense. (This would be effectively placing a diode in parallel to each motor on their individual lines ) Thanks for pointing me in the right direction. I obviously need to read up on these things a lot more but you've told me what I need to know.
A diode junction like the base-emitter junction has about 0.6V to 0.7V drop across it over a wide range of current.
However, in a darlington configuration, the diode drops of the two transistors are in series with respect to the input. As has been pointed out, you don't need to calculate a resistor value. But if you were doing this with an array without base resistors, or just connecting two transistors in a darlington configuration, you need to realize that about 1.2 to 1.4V is dropped across those junctions, leaving 5V - 1.3V or about 3.7V dropped across the resistor.
Another thing to keep in mind- because of the way a darlington pair is connected, the collector to emitter voltage is also going to be about 1.2 to 1.4V.
Here is a method that allows the output transistor to saturate and therefore drop on the order of tenths of a volt or less. 3mA out of the Arduino pin, about 19mA into the base of the second transistor (Ie = Ib + Ic), and with a 2V red LED, about 300mA through the LED.
polymorph:
Another thing to keep in mind- because of the way a darlington pair is connected, the collector to emitter voltage is also going to be about 1.2 to 1.4V.
0.8 to 2.0V in practice - the output voltage is the sum of one transistor's Vbe and the
other's Vsat, so it can be as low as 0.8V, but in practice these are high current
devices where the base and emitter resistances become significant, so towards their
upper current handling ranges drops as high as 2V or more are often seen in datasheets.
Another thing to keep in mind- because of the way a darlington pair is connected, the collector to emitter voltage is also going to be about 1.2 to 1.4V.
This is confusing me now. Do I need to add this to the voltage in the circuit being switched ? Do I need to know this when I am using the Darlinton array or just stick with the ratings on the data sheet ?
I appreciate all the info but with my current level of understanding I need to start with a black box approach to the Darlington array if that is possible. I know a deeper understanding of the internal darlington pairs is beneficial (even essential) in the long term but for now I need to deal with the inputs and outputs.
Update: Ahh - I think I understand now. You're talking about the voltage drop so I have to maybe compensate for this when setting the voltage for the load. Thanks