Why use another chip to control outputs? Well the answer to that is that the PIC micro-controller can only source or sink up-to 25mA for each output. While this might be fine for logic level shifting, and even small devices like LED's, you can't drive a relay, motor, piezo siren etc with a PIC.
The ULN2003 is a very cost effective chip that acts like a switch. The easiest way to explain its operation: It simply switches an earth to/from an external circuit, and can withstand a continual 500mA current drain and a maximum 50V. All this for $0.47 AUD.
The picture on the right is what the ULN2003 looks like internally.
Pins 1:7 are inputs, while pins 10:16 are high current sink drivers. Between the I/Os is an independent Darlington pair (the 'Darlington pair' behaves like a single transistor with a high current gain). When an input is driven high, the corresponding output will basically become an earth. Alternately, when the input pin is low, the output pin adopts a high impedance.
This allows external high-current circuits to be driven by small micro-controllers. There are seven channels ready to be used, and as mentioned earlier, the ULN2003 can sink up-to 500mA between all the channels.
There is only one power connection, a common ground (Pin 8). Here's an example of driving a high power LED with logic voltages via the ULN2003 (note the LED is being driven by a 12 volt source, but controlled by the logic voltage);

For inductive loads, such as motors and relays, Pin 9 is connected to the loads +V to shunt counter-electromotive force (EMF, also known as CEMF) safely. That is, if the motor was connected to +12V and then pin 16 of the ULN, then pin 9 would be connected to the same +12V source as the motor.
The ULN2003 has become my primary choice to controlling external components - its cheap, effective, and requires no operating voltages other than the common ground. Keep in mind that you will have a voltage drop of about 0.9v-1.0v over the UL2003 when in circuit.
No comments.
Please login first.
Jon share a few pictures of his collection as good test leads can make development much easier.
Jon breaks down the steps for interfacing with the DS18B20 temperature sensor
The MCP23008 ads an 8-bit port to the microcontroller using just 2 wires for an I2C interface.