What Is the ULN2003? Relay and Stepper Motor Driver Circuit

Ürün İncelemeleri Intermediate 10 min read Published:
ULN2003 nedir: 16 bacaklı, 7 kanallı Darlington sürücü entegresi kapak görseli

The ULN2003 is a 7-channel Darlington transistor array that switches loads a microcontroller cannot drive directly, such as relays, stepper motors, solenoids and lamps. Each channel withstands up to 50 V and sinks up to 500 mA. Its inputs have a 2.7 kΩ series resistor, and its outputs have protection diodes for inductive loads. This allows it to connect to a 3.3 V or 5 V logic output without any additional components in between.

In this article we explain the internal structure of the ULN2003, its pinout, relay and stepper motor driver circuits, and what the current limits in the datasheet mean in practice. The figures are taken from the Texas Instruments ULN2003A and Toshiba ULN2003APG datasheets. Where the two manufacturers’ values differ, the source is indicated.

What does the ULN2003 do?

A microcontroller pin usually cannot supply more than a few tens of milliamperes and cannot power a 12 V or 24 V load. The ULN2003 sits between the controller and the load. The logic level at its input turns on the Darlington transistor at the output, and the load current flows through the IC to ground. Because a single 16-pin package contains seven independent channels, it replaces seven separate transistors, seven base resistors and seven protection diodes.

Typical applications listed in the TI datasheet are relay drivers, stepper and brushed DC motor drivers, lamp drivers and LED display drivers.

Internal structure: what is in one channel?

Each of the seven channels is the same circuit:

  • Darlington pair: Two cascaded NPN transistors behave like a single high-gain transistor. The Toshiba datasheet gives the current gain (hFE) as at least 1000 at 350 mA output current. This is why hundreds of milliamperes can be switched with an input current below 1 mA.
  • 2.7 kΩ input resistor: Sits between the input and the base of the first transistor. It limits the current from the logic output; no external base resistor is needed.
  • 7.2 kΩ and 3 kΩ resistors: Sit between the bases and emitters of the transistors and prevent leakage current from turning the output on by itself.
  • Protection diode: Its anode connects to the output and its cathode to the COM pin. The cathodes of the seven diodes are joined at COM.

The emitters of all channels are common and come out on pin 8. The outputs are open collector: the ULN2003 does not source current to the load, it sinks the load current to ground. For this reason, the load is always connected between the supply and the output pin.

ULN2003 pinout

ULN2003 pinout: 1-7 inputs, 8 GND, 9 COM, 10-16 outputs
ULN2003 pinout. The inputs are on one side, with the outputs directly opposite them; pin 8 is GND and pin 9 is COM.
Pin Name Function
1–7 1B–7B Inputs (Darlington bases, through a 2.7 kΩ resistor)
8 E (GND) Common emitter of all channels, connected to ground
9 COM Common cathode of the protection diodes; connected to the coil supply for inductive loads
10–16 7C–1C Outputs (open collector). Pin 16 is the output of channel 1, pin 10 the output of channel 7

The arrangement simplifies PCB layout: input 1 drives output 16, and input 7 drives output 10. The IC has no separate supply (VCC) pin.

Key parameters

Parameter TI ULN2003A Toshiba ULN2003APG
Number of channels 7 NPN Darlington 7 NPN Darlington
Output voltage (max) 50 V 50 V
Output current per channel (max) 500 mA 500 mA
Total emitter current (max) 2.5 A Not specified
Input voltage (absolute max) 30 V 30 V
Input series resistance 2.7 kΩ 2.7 kΩ
VCE(sat) at 100 mA (input current 250 µA) typ. 0.9 V, max 1.1 V typ. 0.9 V, max 1.1 V
VCE(sat) at 350 mA (input current 500 µA) typ. 1.2 V, max 1.6 V typ. 1.3 V, max 1.6 V
Input voltage required for turn-on (VCE = 2 V) 2.4 V for 200 mA, 2.7 V for 250 mA, 3 V for 300 mA 2.0 V for 200 mA, 2.6 V for 350 mA
Input current typ. 0.93 mA, max 1.35 mA at 3.85 V input typ. 0.4 mA, max 0.7 mA at 2.4 V input
Protection diode forward voltage (350 mA) typ. 1.7 V, max 2 V max 2.0 V
Switching delay typ. 0.25 µs, max 1 µs typ. turn-on 0.1 µs, turn-off 0.2 µs
Operating temperature −40 … 70 °C −40 … 85 °C

The most frequently overlooked row in the table is VCE(sat). Even when fully on, the Darlington structure holds about 1 V across itself. This voltage both reduces the voltage delivered to the load and is the source of the IC’s heating.

Relay driver circuit with the ULN2003

Schematic of a 12 V relay driver circuit with the ULN2003: GPIO to input pin 1, relay coil between output pin 16 and +12 V, COM pin connected to +12 V
Driving a relay with the ULN2003. The coil is between the supply and the output pin; COM (9) connects to the coil supply and pin 8 to the common GND.

The connection consists of four steps:

  1. Connect the microcontroller’s output pin directly to one of the inputs (for example, pin 1).
  2. Connect one end of the relay coil to the relay supply and the other end to the output opposite that input (pin 16).
  3. Connect the COM pin (9) to the relay supply.
  4. Connect pin 8 to ground. The GND terminals of the microcontroller and the relay supply must be common at this point.

When the input is logic 1, the transistor turns on, current flows through the coil and the relay energizes. When the input is logic 0, the transistor turns off.

Why is the COM pin connected to the supply?

The moment the coil current is interrupted, the coil pushes the voltage at the output pin above the supply voltage to keep the current flowing. If COM is connected to the supply, the internal diode turns on and the coil current circulates through the supply line and decays. The output voltage thus stays one diode drop above the supply. Since the diode’s forward voltage is at most 2 V at 350 mA, in a 12 V circuit the output does not exceed about 14 V and stays well below the 50 V limit.

For non-inductive loads such as LEDs or small lamps, the diodes are not needed; the TI datasheet states that the COM pin can be left floating in this case. TI also warns that the output voltage should not significantly exceed the COM voltage: if it does, the diodes stay in continuous conduction and a large current flows into COM. For this reason, if the same IC drives loads at different voltages, COM is connected to the highest load supply.

Driving a stepper motor

The second best-known use of the ULN2003 is unipolar stepper motors. In these motors the common end of the windings is connected to the motor supply, and the four coil ends are pulled to ground in sequence. The ULN2003’s outputs do this directly:

  • The four coil ends connect to four outputs.
  • The motor’s common lead or leads connect to the motor supply.
  • The COM pin also connects to the same supply, because the motor windings are an inductive load.
  • The microcontroller drives the four inputs in step sequence.

A single stepper motor uses four channels; the remaining three channels are free for a relay, LED or buzzer. In bipolar stepper motors the direction of the coil current must be reversed. Because the ULN2003 can only sink current to ground, it cannot drive these motors.

Current limits: seven channels cannot all carry 500 mA

500 mA is the limit for a single channel. All seven channels cannot carry this current at the same time, because there are two other limits:

  • Total current limit: TI specifies the total current through the common emitter pin as 2.5 A maximum.
  • Heat: Each channel dissipates power equal to the product of its current and VCE(sat). If seven channels were continuously on at 350 mA, the dissipated power would reach up to 7 × 0.35 A × 1.6 V = 3.92 W. Toshiba’s power limit for the DIP package is 1.47 W at 25 °C.

Toshiba’s recommended operating conditions show this limit clearly: in the DIP package with seven channels operating together, at 85 °C ambient and a 25 ms pulse width, the current per channel is limited to 350 mA at a 10% duty cycle and 100 mA at a 50% duty cycle. In TI’s curve for the SOIC package at 70 °C, the allowable current per channel with seven channels continuously on also drops to about 40–50 mA.

When higher current is needed, the TI datasheet states that outputs can be connected in parallel. To do this, the inputs of the same channels are also tied together.

Example calculation: seven relays energized at the same time

Assume seven 12 V relays with a coil resistance of 400 Ω all remain energized at the same time. Let the IC be in a SOIC package and let the ambient temperature reach 70 °C.

  1. Coil current: I = (Vsupply − VCE(sat)) / Rcoil = (12 − 0.9) / 400 ≈ 27.8 mA. The voltage across the coil is 11.1 V.
  2. Power dissipated in the IC: To stay on the safe side, taking 30 mA per channel and 1.1 V for VCE(sat) gives P = 7 × 0.03 A × 1.1 V ≈ 0.23 W.
  3. Allowable power: Pmax = (TJ − TA) / RθJA. TI requires the junction temperature to be kept below 125 °C and gives RθJA for the SOIC package as 88.6 °C/W: (125 − 70) / 88.6 ≈ 0.62 W.

0.23 W is below the 0.62 W limit; this load is comfortable for the ULN2003. If you repeat the same calculation with seven loads each drawing 200 mA per channel, you get 7 × 0.2 A × 1.3 V = 1.82 W, about three times the limit. With such a load, you need to reduce the number of channels, run the loads in sequence or move to separate transistors. This formula is a quick first check. TI’s duty cycle curve is more conservative; for designs close to the limit, use the value from the curve.

Using it with 3.3 V logic

The ULN2003 works with 3.3 V controllers; the TI datasheet states that the IC can be driven directly by TTL and CMOS logic operating at 5 V or 3.3 V. The point to watch is that the required input voltage rises as the output current increases. In the TI table, an input voltage of 3 V is required for 300 mA output current. Because a 3.3 V pin can drop a few hundred millivolts under load, the margin shrinks at currents of 300 mA and above. For loads below 100 mA, such as a relay coil, this is not a problem.

The input current is also low: TI gives a maximum of 1.35 mA at 3.85 V input. Even if all seven inputs are driven at once at this voltage, the load on the microcontroller port does not exceed 7 × 1.35 mA ≈ 9.5 mA.

Common mistakes

  • Leaving the COM pin floating: With an inductive load, the internal diodes cannot come into play; the voltage generated by the coil is applied to the output transistor.
  • Connecting the COM pin to ground: Because the diode’s anode is at the output, the coil current flows through the diode to ground. The relay stays energized regardless of the input signal, and the diode heats up.
  • Connecting the load between the output and ground: The ULN2003 does not source current; it sinks it. The load must be between the supply and the output.
  • Not joining the grounds: If the relay supply comes from a separate adapter, its negative terminal and the controller’s GND must meet at pin 8.
  • Ignoring the voltage drop: If a 5 V relay is powered from 5 V, the coil sees about 4 V. Check the relay’s pick-up voltage in its own datasheet.
  • Running all seven channels at full current: Increasing the total current without doing the power calculation above overheats the IC.

When is the ULN2003 not enough?

  • If the load must stay on the ground side and the supply side must be switched (high-side switching), the ULN2003 is not suitable.
  • For low-voltage, high-current loads, a 1 V drop is too much; logic-level MOSFETs run cooler in these applications.
  • Mains-voltage loads cannot be driven directly. A relay is placed in between, or a triac output stage is used; for the triac side, see our article on testing a triac.
  • If isolation is required between the control circuit and the load, an optocoupler is added in front of the inputs. Our article on optocoupler resistor calculation guides resistor selection.

Which ULN2003 should you choose?

The two products have the same pinout and do the same job; their electrical differences are given in the table above. For through-hole boards, breadboards or socket mounting, the DIP-16 ULN2003APG is suitable; for surface-mount boards, the SOIC-16 ULN2003ADR. For the thermal limit, use the value in each product’s own datasheet: Toshiba gives the power dissipation of the ULN2003APG as 1.47 W maximum at 25 °C and 0.76 W maximum at 85 °C; the junction-to-ambient thermal resistance TI gives for the SOIC package is 88.6 °C/W.

ULN2003APG,CNToshiba Semiconductor and Storage · EE00437$1.4127 In StockView
ULN2003ADRTexas Instruments · EE00819-1$0.473393 In StockView

For similar drivers, you can browse the BJT transistor arrays category.

Frequently asked questions

How many amps can the ULN2003 drive?

A single channel drives up to 500 mA. According to the TI datasheet, the total current of the seven channels cannot exceed 2.5 A, and in practice the limit is set by the IC’s heating: according to TI’s curve for the SOIC package at 70 °C, with seven channels continuously on, the current per channel should not exceed about 40–50 mA.

Does the ULN2003 have a supply pin?

No. The ULN2003 has no VCC pin; pin 8 connects to ground, and the transistors operate on the current they receive from the input signal. The COM pin (9) is not a supply input; it is the common terminal of the protection diodes.

Does the ULN2003 work with 3.3 V?

Yes. The TI datasheet states that the ULN2003A can be driven directly by 3.3 V or 5 V logic. According to the TI table, an input voltage of 2.4 V is sufficient for 200 mA output current, and 3 V for 300 mA.

Is a separate diode needed when driving a relay with the ULN2003?

Not if the COM pin is connected to the relay supply; each output has an internal protection diode. If COM is left floating, these diodes do not work.

What is the difference between the ULN2003 and the ULN2004?

The difference is in the input resistor. The resistor, which is 2.7 kΩ in the ULN2003, is 10.5 kΩ in the ULN2004. The ULN2003 is designed for TTL and 5 V CMOS logic, and the ULN2004 for CMOS and PMOS logic operating at 6–15 V.

Conclusion

The ULN2003 is the lowest-component-count way to connect loads such as relays and unipolar stepper motors to a microcontroller: the input resistors and protection diodes are inside the package. Correct use comes down to three rules: the load is connected between the supply and the output, for inductive loads the COM pin goes to the load supply, and the total power dissipation is calculated against the thermal limit of the package.

References

Products in this article

More from Ürün İncelemeleri