Re: Analog switch
Ofcourse you can buy opto-isolated switch modules, but that's more expensive than DIY.
Another option: take an N channel MOSFET, and use it as a low-side switch.
This assumes a few things about your supply voltage and the type of load you
want to switch. Perhaps you could help us out here, and provide a more
detailed description of what you want. I assume it's 35 volt DC supply? Inductive?
How about something like this. Quicky values:
R1 = 220
R2 = 2.2k
R3 = 1k
For the opto-coupler, use anyone you have lying around. The BUZ11 is a cheapo
N-channel mosfet. Rds_on = 40 milli-ohm, max 50 V, 33 A.
Note: the R2, R3 voltage divider is to make sure the Gate-Drain voltage does not
exceed the maximum of 20V for this particular MOSFET. And the diode should be a fast one. This is included in case you want to drive inductive loads, as protection for the MOSFET.
Another quick remark: I just noticed I goofed up. The point that's connected to +5V should
in fact be connected to a logic gate, so you can toggle between +5V and 0V, and turn the MOSFET on and off. Will also work with 3.3V logic, BTW.