DC motor speed ULN2803 Speed Control (was Single MCU out to Multiple ULN2004a in?)

Thread Starter


Joined Mar 5, 2016
I'm working on an LED lighting project that uses several sets (3-6) of 4 LEDs each in series. In the past, I've used ULN2004a arrays to great effect, but each line needed to behave independently. For this project however, all the aforementioned sets of LEDs are either on or off.

My question is, can I use a single signal pin on MCU like an Atmega328 to drive multiple inputs on a ULN2004a? The fewer pins I use on the MCU, the better. I can't see anything on the datasheet that stands out to me as a no-go, but I've never been too good with the nuances of transistors.


Thread Starter


Joined Mar 5, 2016
hi Prop,
Check this clip from the d/s
How many input pins do you plan to drive from one MCU pin.?

Ideally, I'd want to drive at least 4 pins on the ULN2004a, but more would be nice.

I was scouring the d/s, but I just don't know which of that is pertinent to this specific issue. I prefer to limit my MCU i/o current to 20mA, but I don't think that should pose a problem.


Joined Sep 20, 2005
You could use 74HC595 to get however many outputs you want, and you need two threepins from the microcontroller at the least, three four could provide more predictable behavior on startup or with emc issues.


Joined Jul 1, 2009
@PropForge - IMHO Just keep input to the ULN at 1mA per pin- that provides noise-immunity and is more than enough current to make the transistor array work, per the datasheet. Whether parallel or series control of the input side, it means you only need 8mA to control the ULN2004 inputs. Keep your MCU J(th) as low as reasonably achievable (ALARA), it lets it run more smoothly, cooler, and allows more current to spread around to all the pins you want to use. Your MCU has a total limit of (perhaps) 40mA output on all pins simultaneously. Your datasheet will tell you, Just bare that in mind.


Joined Dec 2, 2017
I don't think it's possible to drive a ULN2004A input pin @ 1mA @ 5 volts. (built in 10.5 k resistor)

Also depending on the drive current needed for the LEDs, you might want to use the ULN2003A instead.


Joined Jun 5, 2013
If you don’t need separate outputs, why use the ULN? A single MOSFET could drive them all. You do need a logic level MOSFET though.



Joined Jun 8, 2013
You could also use a mosfet array to drive the LEDs. Its the same as the ULN2004 but has mosfets instead of BJTs.
Then no need to worry about arduino i/o output drive capacity.

Thread Starter


Joined Mar 5, 2016
Remember... The ULN2004A is NOT TTL compatable... The ULN2003A is.. You need @ 7v to trigger the ULN2004A.
Thanks for that catch; it should have been a 2003, but I've been soldering so many 2004s, I brain-farted.

I've actually found a different way to deal with these LEDs that will actually simplify the mechanical design of this circuit.

On the subject of ULN2003s, however, another question.

My overall design requires driving a pair of small 6V motors for brief periods of time, rated at 200mA maximum draw. Prior designs I experimented with used PN2222 and diode to drive small motors with an Arduino, but considering the characteristics of the ULN2003A IC, can I just use it instead (of the PN2222 and diode)?

Thread Starter


Joined Mar 5, 2016
The ULN2803a is better for inductive loads and has a 500mA collector current on each pair.. This would be my choice.

Well, I have a few spare pins on a ULN2003 I'm using for LEDs. Is there any issue using a ULN2803 for LEDs? I'm not seeing anything in the 2803 datasheet that stands out as a no-go, and the extra cost is acceptable.

Ian Rogers

Joined Dec 12, 2012
LED's take a tiny current.. The 2003a has 250mA outputs... The 2803 is around 40 pence dearer for the extra 250mA loading.

You don't even need a ULN to drive an LED Most LED's are very visible at 7~10mA which can be a simple buffer.

Thread Starter


Joined Mar 5, 2016
Okay, so I finally got around to making a PCB to run some tests, and the LED side of things (seems to) works as intended *knocks wood).

When I got to testing the motor speed control side, though, I ran straight into a brick wall. My schematic is a bit meandering to post the entire thing but I'm using a PWM signal pin from an Arduino (328P) directly into a ULN2803 transistor array. The then runs (directly) into the negative side of a small toy 6V motor. The other side of the motor is connected to the 5V plane, and a 1N4001 flyback diode is used right at the motor terminals. See here for what I used as a sanity check. I'm just using a 9V alkaline for testing, running through a 5V switching regulator (RECOM 7805.0). Using the regulator on the Arduino netted the same results, described below.

From the Arduino, I set the pin to be an output, and the loop is literally just "analogWrite(motorPin, 127);" which to my knowledge should spin the motor at half-speed (in general). I've tried changing that value, between 1 and 255, and the motor had no change. On one occasion when I powered up the circuit it ran as intended. I turned the circuit off, then back on, and nothing. Something *is* happening though; it feels like when a stepper motor isn't being fed the correct frequency, where it feels like it's almost vibrating.

On a related note, is there any way to get a ballpark idea of how much EMI this would cause? I have a short 12-conductor FFC cable about 0.5-1 inches away from the screw terminals for this motor, that runs up to a 7-segment display, driven by a MAX7219. When trying to get this motor to work, the display was fully illuminating, without having any code sent to it, at all. I assume this is EMI, but I'm not sure. If it is, I'm unsure how to mitigate it, other than adding more separation.

Thread Starter


Joined Mar 5, 2016
I think I have everything sorted, but I wanted to double check something.

Do I *need* to connect pin 10 (COM) of the ULN2803 to VCC if I have discrete diodes already on/near the motors? If I'm understanding correctly, pin 10 being attached to VCC provides the same freewheeling effect as a reverse-biased diode for things like motors and relays. I've not had any uses leaving that pin floating other times I've used a ULN2803, but those were always for LEDs, never motors.


Joined Dec 31, 2017
Do I *need* to connect pin 10 (COM) of the ULN2803 to VCC if I have discrete diodes already on/near the motors?
Probably not necessary. Back to your previous post sounds like a code problem or the Arduino is not setup correctly.
I would test the ULN2803 with the motor connected but connect the input side directly to 5 volts. The motor should run at max speed if the 9 volt battery can handle it. You will lose about a volt through the ULN2803 so with a 5 volt regulator that's 4 volts across the motor, if not you have additional problems.