Ask a parent, teacher, or trusted adult before building, powering a circuit, using tools or batteries, or buying parts. Purchases are optional and at your own cost. If anything gets hot, smells burnt, leaks, swells, sparks, or moves unexpectedly, switch off or disconnect power without touching the damaged or hot part, then tell an adult. Read safety rules

All lessons
⚙️Components 6 min read

Motors

Making things spin — and why motors need their own power.

In 10 seconds

  • • Motors need far more current than a pin can give.
  • • Use a driver board plus a suitable separate supply chosen with an adult.
  • • Always join the grounds together.

Motors are where projects stop sitting on the desk and start moving across the floor. A DC motor is a wonderfully simple device: send electricity through it and a shaft spins. Reverse the electricity and it spins the other way. Give it less voltage and it spins slower. That is almost everything you need to know about the motor itself — the interesting part is how you connect it to an Arduino.

Never wire a motor straight to a pin

An Arduino pin can supply about 20 milliamps safely, and 40 at absolute maximum. A small hobby motor wants 200 to 800 milliamps, sometimes more when it starts up or when a wheel is blocked. Connecting one directly will, at best, make the board reset and at worst permanently damage the pin. This is not being cautious — it genuinely breaks boards, and it is the most common way beginners kill their first Arduino.

Use a driver

A motor driver is a middleman. Your Arduino sends it small, polite control signals, and the driver switches a much bigger battery current through to the motors. The popular L298N board takes four control pins for two motors, plus two speed pins, and screw terminals for the battery and the motors themselves.

Two rules make driver wiring work every time:

  • The motor battery connects to the driver, not to the Arduino.
  • The battery's ground and the Arduino's GND must be joined together. Without a shared ground the two halves cannot agree on what zero volts means, and the robot behaves like it is haunted.

Direction and speed

Each motor uses two control pins. Set the first HIGH and the second LOW and it spins forward; swap them and it spins backwards; set both the same and it stops. The enable pin takes analogWrite() from 0 to 255 to control speed with PWM. If a wheel spins the wrong way when you build a car, you do not need to change any code — just swap that motor's two wires.

The three types you will meet

  • DC gear motor — cheap, fast, great for wheels. Has no idea where it is or how far it has travelled.
  • Servo — moves to a precise angle and holds it. Perfect for arms, doors and steering.
  • Stepper — rotates in exact, countable steps. Used in 3D printers and anywhere you need precision over many turns.

Why motors misbehave

Motors are electrically noisy. As they spin they generate spikes that can cause random resets. A suitable driver, separate motor supply, short wiring and the protection parts recommended by the driver or motor maker help control this. An experienced adult may add a correctly rated suppression capacitor; children should not use a soldering iron. If a project fails only when the motors start, disconnect power and check the supply and driver first.

Quick quiz: Motors

3 questions to check it stuck.

Take the quiz

Next lesson

🦿 Servos

Keep learning

Ready to try it for real?

Pick a project and ask a parent, teacher, or trusted adult to check the parts and power before you build. Buying hardware is optional and at your own cost.

Explore projects