I got a Raspberry Pi 4B, a 12V power supply, a 12V air pump controlled by a MOSFET, a ds18b20 for feedback and a 47 Ohms, 8W resistor that we should somehow heat. Everything up to actually heating the MOSFET is done and working.

Essentially, the pump pumps air through a PVC channel, inside which is the resistor that should heat up the air to whatever temperature is set in the code, and the reading is done by the DS18B20. How can I do it on the Pi? I tried searching and it has something to do with a transistor and one of the PWM pins of the Pi, but I couldn't find any schematic.

I did find something for an Arduino, but I'm not sure if it will work exactly the same since transistors consume current and the GPIOs are heavily limited on that side. Do you know some transistors that would work with this and/or a library with a schematic example?

  • Seems to be more of an electrical question. The Pi's role is minimal.
    – joan
    Apr 6, 2023 at 11:13
  • See Tour to see how this site works and How do I ask a good question?
    – Milliways
    Apr 6, 2023 at 11:24
  • Instead of going for a PID control, you should rather try bang-bang control first. It's easier to implement and the air in the tube has greater thermal capacity than a tip of a soldering station, so there should be comparable performance w PID. It's a cool project. I did in the past control of asphalt temperature in a 3d printer...
    – maciek
    Jan 9 at 11:59

1 Answer 1


The resistor will give you a bit over 3 watts of heat. You can use an online ohm's calculator to determine the exact amount. Duplicate the MOSFET circuit for the resistor, it should work just fine. All grounds must be connected including the grounds of each power supply.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.