ExpertAutomation and Power

Temperature-Controlled 12 V Fan

Use a temperature sensor, MOSFET, and PWM control to vary a small 12 V fan's speed as temperature rises.

Estimated time: 2โ€“4 hours ยท Skills: MOSFET gate drive, PWM, thermal thresholds, power separation

Parts from the database

Other supplies

Amazon links may be affiliate links. As an Amazon Associate, Electronics Hobby Hub earns from qualifying purchases.

Connections

  1. Power sensor from 3V3 and connect IยฒC SDA/SCL to the ESP32 bus.
  2. Switch fan low-side: fan positive to +12 V, fan negative to MOSFET drain, MOSFET source to supply ground.
  3. Connect ESP32 PWM through a small gate resistor to MOSFET gate and add a gate-to-ground pull-down; share ground between supplies.
  4. Add a fuse in the 12 V fan feed. Confirm the MOSFET is driven at 3.3 V gate and the fan accepts PWM switching.

Build steps

  1. Test the sensor reading without the fan and confirm plausible room temperature.
  2. Test fan on/off with the MOSFET at a low duty cycle before enabling temperature control.
  3. Set a start temperature and a separate stop temperature (hysteresis) to avoid rapid toggling.
  4. Use a thermometer to compare sensor placement, then tune PWM range and minimum fan speed.

Software and firmware setup

Firmware is required, but a complete ESP32 control sketch is not included yet. Run the MCP9808 library example first, then add a PWM output with separate turn-on/turn-off temperature thresholds (hysteresis). Test MOSFET switching with the fan supply fused and the fan clear of fingers; confirm your exact fan tolerates the chosen PWM method.

Test your build

The fan should remain off below the setpoint and ramp up above it without repeated chatter. A MOSFET's gate-threshold number alone does not guarantee low on-resistance; use the specified logic-drive ratings.

Troubleshooting

  • If the ESP32 resets when the fan starts, improve supply separation and grounding.
  • If fan speed control does not work, use a 4-wire PWM fan or check whether the 2-wire fan tolerates supply PWM.
  • If the MOSFET gets hot, stop and verify gate voltage, current, switching rate, and heatsinking.

Safety and limitations

Use a small fused 12 V supply, not a vehicle or mains source. Keep fingers clear of fan blades and observe MOSFET thermal limits.

Manufacturer and platform documentation

Community Notes for This Project

These are unverified visitor contributions, separate from the build guide and manufacturer specifications. Verify technical advice against the linked datasheets before relying on it.

Set up the comments service to load community notes.

Share a tip or question about this build

โ† Browse all projects