A ULN2004 has 16 pins and is one component. (of which 60% will remain unused and available for future expansion.
Two Relays need (a) a Transistor each (3 pins), (b) a Base Resistor each (2 pins), and (c) a Diode across the Relay coil to surpress the back-emf each (2 pins) each. The LED will require a Transistor (3 pins) and a Base Resistor (2 pins). That's eight components and a total of 19 wires to solder (and a lot more money!). So make work for yourself...
You don't need a pull-up or pull-down Resistor if your PICs initialisation is quick enough... but if you're sloppy, those Relays will need a pull-down (two more components and another four soldered joints).
The 12vDC current path goes through the Transistor and not through the PIC. The PIC is just driving the Transistors Base (through a limiting Resistor). The next question you haven't asked yet is the value of the Base Resistor. Well, how much current do you want the transistor to draw through the Emitter/Collector junction. 10k may well be good enough for your Relays which are probably around 30mA each, but you may need a lot lower value for 120mA of Backlight.
The plain vanilla 2N2222 has a gain of 100 (Datasheet). So a 10K Resistor at 5v will draw 500uA through the Base multiplied by the device gain is good for upto a 40-50mA load (simplified explaination but will suffice here). A 120mA load will require about 1.5mA through the Base... well you can do the math...





Bookmarks