Is it possible to use a transistor to act as an relay? What I mean by that is using a 3V battery to control the gate so that a separate 12V battery can let its current flow to other parts of the circuit. Or must a transistor use only a single power supply? Some examples would be great.
Yes it is, but there are some differences.
- In a relay, generally the actuation coil and the switching contacts are electrically isolated from each other -- so (for example) the coil can be driven from a safe-to-touch circuit, while the contacts may be switching the mains voltage.
- In a transistor, you'll need the supplies to have a common point -- typically this would be the negative supply of each.
- Transistors are generally much more delicate than relays. Small overloads or overvoltage will destroy them, and they might fail short-circuited
- A MOSFET will be easier to drive than a bipolar (e.g. NPN) device. In a bipolar device you'll need provide sufficient base current to saturate the device. This will require knowing the maximum load current (and dividing by the worst-case beta). In a MOSFET, you can just apply sufficient gate voltage -- 3 V will usually work, but the FET will work better with a higher voltage.
- Relays work as well with AC loads as DC loads; transistors don't. A MOSFET has an internal body diode which will always conduct if the drain voltage is lower than the source voltage. A bipolar device will also conduct in this case (it's a little more complex and depends on the voltages involved).
- Relays may have normally-open and normally-closed contacts -- a transistor is closer to a normally-open switch.