Here a simple schematic to control a pump. I haven’t tested it with RPi’s GPIO output. I just connected the resistor to 12V. However I would expect it to work but you probably have to divide the resistor by 4.

You want the resistor low enough to saturate the transistor, a BDX53B Darlington transistor, so voltage drop and power dissipation will be minimal. I bought the pump on banggood.com for 10€ number SKU235205. The BDX53B should be around 1€. It needs a high start current and then about 300mA for continues operation.

However you also want it to be as high as possible to minimize the load on your RPi.

I calculated the resistor to be 100k however that didn’t get the pump started so I lowered it tenfold. The input current is still very low and well within specs for both RPi as well as the transistor’s maximum base current.

I didn’t add a diode in parallel to the pump since the BDX53B already has one internally which can withstand 8A forward current, which should be enough.

Calculation are as follows:

- Measured pump current 300mA
- In the sheet for the BDX53B the gain for Ic for 300 mA is about 2000.
- Therefore the current through the Base would be 300 mA / 2000 = 150 µA
- R1 = Vcc – Vbe (from BDX53B spec) / Ibase = ( 12 V – 1.3 V ) / 150 µA = 75k Ω

However to get the pump started we actually need more like 3 A (I could not measure it exactly it was just a blink on my multimeter)

- Measured pump current approximately 3A
- In the sheet for the BDX53B the gain for Ic for 3A is about 5000.
- Therefore the current through the Base would be 3A / 5000 = 600 µA
- R1 = Vcc – Vbe (from BDX53B spec) / Ibase = ( 12 V – 2 V ) / 600 µA = 16 kΩ (I used 10 kΩ but 15 kΩ should do)
- For RPi (untested!) ( 3.3 – 2 ) / 600 µA = 2166 Ω (so a 2.2 kΩ resistor should work).

Would the RPi get damaged it the transistor breaks down and shorts R1 to ground:

- 3.3 V / 2000 Ω (make sure to take error in resistor into account therefore I use a lower value) = 1.6 mA

The RPi can easily deliver 1.6 mA (assuming no other ports are connected). So if the transistor breaks down it will not harm your RPi.

As always use at your own risk and verify that my calculations are correct before using it.