Can I replace a relay with (e.g.) a transistor in this resistor ladder circuit?
One way is to just replace the relay with a MOSFET or bipolar transistor.

Put the gate/base to +5v, source/emitter to the resistor chain and the drain/collector to stereo. For the BJT approach a base resistor of 100k-1meg will be needed

The choice of bias resistor for the BJT is a compromise between getting enough base current to pass the current from the resistor switches and causing an error in the interpretation of the resistor chain.  As CupawnTae has found 200K seems to work correctly.

A MOSFET would not suffer from this problem as it does not require any gate current, however the challenge is getting device with a low enough threshold voltage so that it turns on acceptably for the larger value of the resistor chain - there will only be about 1.7V of gate bias then as the voltage at the receiver is ~3.3V and the gate voltage is 5V.  Something with &lt;1.5V gate threshold be needed.

Another way is something like this.

It relies on the output from your CPU being low when powered off.

The transistors in that case will not draw any current from the output.

Any general purpose NPN transistor should work ok.  Multiple devices in one package such as UL2003 may not work as they are configured as darlington and will probably have a saturation voltage that is too high.







simulate this circuit &ndash; Schematic created using CircuitLab