Raspberry Pi Pico practice problem · Raspberry Pi Pico
Transistor switch
HardBudget $17MicroPython
A BSS138 MOSFET switches a fan on VBUS. Its gate is on GP13 (with a 10 kΩ pull-down), source to ground, drain to the fan's negative lead.
Read the potentiometer on GP26: above 50 % drive the gate high, below drive it low. The test starts at 80 %, then moves to 45 %, 55 % and 20 %, so the threshold itself is checked.