VeryNoob wrote:Please see the attached image. Can anyone tell me if I have this right?
And I have two questions.
1) Are there two transistors to enable them to be properly saturated?
2) What does the diode (D1) running across the relay coil do?
Yes, you have it more-or-less right.
Without knowing the spec of either the transistors or the relay, only hand-waving
is possible, but the following might explain.
The relay requires this
much current, and the capacitor can only supply that
much current for so
long, which has to be long enough for the Pi to boot and take GPIO 7 high.
Therefore we need a gain in excess of this
. A single transistor can't be guaranteed to have that gain, but a darlington pair can.
2) Being an inductor, the relay coil stores energy. When it's switched off, the energy has to go somewhere, and without that diode the energy drives the negative end positive (how much positive depends on the inductance, the current, and stray capacitance) The diode clamps that voltage to prevent damage, and dissipates the energy