I've been studying the PICAXE microcontroller as a driver for a set of three 12VDC solenoid valves (though I may choose the 24V models). For reference, the controller will use a temperature sensor to determine when to actuate the solenoids, in addition to elapsed time (via the firmware).
Conceptually, the use of a relay to control each solenoid makes sense to me since they operate at a higher voltage than the microcontroller. However it has been about 20 years since I last studied electronics in high school, and I get a bit confused when I see slightly more complicated solutions to this problem.
Here is a schematic of how I thought I should build the circuit, simplified to one output pin and one solenoid for brevity.
I then found the "Standard Circuit" in the PICAXE Interfacing Circuits manual, which is represented as follows.
Why is a transistor is required to actuate the relay? Perhaps the output current of the microcontroller pin (~20mA) is insufficient to power the coil in the relay?
Finally, I became concerned with the space that three relays would occupy on my circuit board and though I might be able to use an AND gate chip as follows. The benefit being that such chips usually contain four gates, and thus replacing three relays with one smaller chip.
In this example, one gate input is fixed at 12V. Is this gate solution feasible? That is, if the two "high" inputs are different, but recognized as a high by the chip, will the output voltage generally be the max of the two inputs? I found a data sheet for the BU4081B chip, but I am having difficulty finding the answer to this question in it.