By Kevin McAleer, 6 Minutes
Page last updated November 24, 2026

By the end of this lesson you will be able to explain why a Pico GPIO pin can never drive a motor directly, and what a flyback diode and a motor driver protect against.
It is tempting to plug a motor wire into a GPIO pin and call pin.value(1). At best nothing happens. At worst you damage the Pico. Let’s see why, because understanding this is the difference between copying wiring and designing it.
A GPIO pin is a signal, not a power supply. It is happy with a few milliamps. A Pico pin drives 4 mA by default and 12 mA at most, and the whole chip has a limit too.
A little TT gear motor spinning freely might draw 150 to 250 mA. Pressed against a wall, or with the wheel held, it can draw an amp or more. That is the stall current, and it is the number your driver and battery must be able to handle.
# How many GPIO pins would we need to power ONE motor?
gpio_limit_ma = 12 # the most a Pico pin should supply
motor_running_ma = 200 # a typical TT motor, no load
motor_stalled_ma = 1000 # the same motor with the wheel held
print(motor_running_ma / gpio_limit_ma) # about 17 pins, just to spin it freely
print(motor_stalled_ma / gpio_limit_ma) # about 83 pins, if it jams
Obviously that is not going to work. A driver takes a tiny signal from the Pico and uses it to switch a much larger current from a separate battery.
A motor is also a generator. Spin the shaft and it produces a voltage, which is how a bicycle dynamo works. While the motor runs, it makes a voltage that opposes the supply: the back-EMF (electromotive force). That is why a running motor draws less current than a stalled one.
The nasty part comes when you switch the motor off. A motor is also a coil, and a coil resists changes in current. Cut the power suddenly and the coil pushes back with a sharp voltage spike, often many times the supply voltage, trying to keep the current flowing.
Switch closes -> current builds up slowly through the coil
Switch opens -> coil resists the change
-> voltage spike across the switch (inductive kick)
That spike can punch through a transistor, or couple back into the Pico and cause a random reset.
A flyback diode is wired across the motor, backwards, so it does nothing during normal running. When the spike arrives, the diode gives the current a safe path to circulate and die away.
+V ---+------------+
| |
Motor Diode (stripe towards +V)
| |
Switch+------------+
|
GND
You usually do not add these yourself:
If you ever drive a bare motor with a single transistor, add the diode. It costs pennies and saves a Pico.
Here is how the pieces connect. Notice that only a small signal goes from the Pico, while the big current comes from the battery:
flowchart LR
P["Pico GPIO, a few milliamps of signal"] -->|"IN1, IN2, EN"| D["Motor driver"]
B["Motor battery, amps of power"] --> D
D -->|"OUT1, OUT2"| M["DC motor"]
P --- G["Common ground"]
B --- G
D --- G
Why: Motor spikes and current surges travel down shared wires and disturb the Pico’s supply.
Teachers: a stalled TT motor can draw an amp or more and turn that into heat quickly, and the driver chip heats up with it. Tell learners not to hold a wheel still on purpose, and to let a hot board cool after switching off. Spinning a motor by hand to make a voltage (exercise 3) is a safe, low-voltage activity that suits groups with no batteries or soldering.
Quick quiz 1 of 3
About how much current should a single Pico GPIO pin supply at most?
Quick quiz 2 of 3
What causes the voltage spike when a motor is switched off?
Quick quiz 3 of 3
Why does a stalled motor draw more current than a running one?
Comments