So I’ve been messing around with this Arduino project where I needed to switch something beefier than those tiny LEDs, right? My coffee machine pump’s been acting up, and I thought hey maybe I can control it properly with Arduino instead of buying a new machine.

Getting Started
First thing I did was raid my electronics junk drawer. Found an old Arduino Uno covered in dust, some random wires, and this black thingy with three legs labeled IRF540. Took me forever to realize that’s the MOSFET thing everyone talks about for controlling heavy stuff.
Grabbed a screwdriver and pried open the coffee machine back panel. Saw two thick wires going to the pump – way too chunky for Arduino pins. Remembered MOSFETs are like digital switches for big loads.
The First Disaster
Hooked it up like this:
- Pushed MOSFET’s left leg into Arduino pin 9
- Middle leg wired straight to pump’s positive wire
- Stuck pump negative to power supply
Uploaded the basic blink code everybody uses for LEDs. Heard this nasty BUZZING sound and saw smoke curling up from the MOSFET. Nearly jumped outta my skin! Turned out I completely forgot the diode thing across the pump. That buzzing sound? The MOSFET throwing a fit.
Fixing My Mess
Found this old circuit board from a dead microwave. Ripped out a big fat diode that looked serious enough. Soldered it across the pump wires facing the right direction – arrow pointing away from power.

Replaced the crispy MOSFET with another one from an old PC power supply. This time I put a proper heat sink on it using binder clips and thermal paste. Looks janky but works.
Making It Work
Rewired everything:
- Arduino pin 9 to MOSFET’s gate
- MOSFET drain to pump positive
- Source to power negative
- Pump negative direct to power
- That salvaged diode across pump terminals
Changed the code to pulse every 10 seconds instead of blinking fast. Powered up holding my breath… and the pump actually clicked on for three perfect seconds! Woke up my cat when I yelled “YES!”
Now my janky setup lives behind the coffee machine, turning the pump on/off when the water sensor gets low. Still smells faintly of that first fried MOSFET though. Maybe I’ll bolt the heat sink properly tomorrow… or just enjoy my working coffee machine first.