Do you need to control 12 V devices like fans, water pumps, sirens or LED strips with Arduino or Raspberry Pi output pins? Then you should build a simple and low cost ($2) circuit below.
It is based on an opto-isolator PC815, also called an optocoupler or photocoupler – a component which transfers electrical signals between two isolated circuits (3.3/5 V and 12 V in our case) by using light. That means these two circuits are perfectly isolated and can not affect each other, so the boards are protected from higher voltage.
- Photocoupler PC815
- NPN transistor 2N6488
- Diode 1N4007
- Resistors 270R, 560R, 1k
- 12 V power source (e.g. AC/DC adapter)
S1 – Arduino/Raspberry Pi output pin (+)
S2 – Arduino/Raspberry Pi GND pin (-)
S3 – 12 V power source positive (+)
S4 – 12 V device (fan, water pump) positive (+)
S5 – 12 V device negative (-)
S6 – 12 V power source negative (-)
Photocoupler outputs (PC815):
1 – Anode (marked with a circle)
2 – Cathode
3 – Emitter
4 – Collector
The circuit on a breadboard (with a 12 V siren connected):
With the circuit above you will be able to control devices with maximum current of 1-2 A. If you need more, then just replace the transistor for a MOSFET-based one (for example IRF3205) and then replace the R3 resistor 270R with 82R. This way you can handle up to 10 A, or even 100 A with a cooler for the transistor.