All paths

Motors and motion

DC motors on a driver, the H bridge inside it, servos, a stepper on an A4988, an encoder that measures what the motor did, and a 2WD robot car with ultrasonic eyes and line sensors.

Arduino Uno R3Free7 lessons4 h4 chapters1,842 XPEmbedded engineering · Intermediate+150 XP

0 of 7 done

Start the course freeA DC motor on a driver: speed and directionBuild it as a kitRetails for about $50, free on Mokxi.Lesson plan for teachers
What you will build

3 projects, built step by step

7 lessons in 4 chapters, about 4 hours on a simulated Arduino Uno R3. Free, in your browser, every step checked by the simulator.

Chapter 1 project

Inside the driver: the H bridge

Four switches around a motor make it go both ways. An L293D on a breadboard: the truth table, braking against coasting, back EMF, and why half the PWM is not half the speed.

Open it in the simulator
Chapter 2 project

A stepper on an A4988: STEP and DIR

A NEMA 17 moves in exact steps with no sensor at all. Two wires from the Uno, microstepping from three pins, the current limit you set with a screwdriver, and how a stepper misses steps.

Open it in the simulator
Chapter 4 project

Boss: a robot car with eyes and line sensors

The finished robot: a 2WD car on a MOSFET DRV8833 with an ultrasonic eye and two TCRT5000 line sensors, run by a four-state machine that hunts, charges and never drives off the edge.

Open it in the simulator
The map

Chapter by chapter

Each lesson opens when the one before it is done, and each chapter ends in a project.

Chapter 1

DC motors

Speed with PWM, direction with an H bridge, and where the volts go.

  1. Open187 XP

    A DC motor on a driver: speed and direction

    Two gear motors on an L298N: why a pin cannot run a motor, two inputs for direction, PWM on the enable for speed, and the volts a bipolar driver keeps for itself.

    0 of 5 steps

  2. ProjectLocked374 XP

    Inside the driver: the H bridge

    Four switches around a motor make it go both ways. An L293D on a breadboard: the truth table, braking against coasting, back EMF, and why half the PWM is not half the speed.

    0 of 5 steps

Chapter 2

Servos and steppers

Motors that go to an angle, and motors that count their steps.

  1. Locked169 XP

    A servo: an angle, not a speed

    A hobby servo is a motor, a gearbox, a potentiometer and a control loop in one box. Drive it with a pulse width, follow a slider, and learn why it needs its own power.

    0 of 5 steps

  2. ProjectLocked338 XP

    A stepper on an A4988: STEP and DIR

    A NEMA 17 moves in exact steps with no sensor at all. Two wires from the Uno, microstepping from three pins, the current limit you set with a screwdriver, and how a stepper misses steps.

    0 of 5 steps

Chapter 3

Feedback

An encoder measures what the motor really did, and the code corrects.

  1. Locked187 XP

    An encoder: measure what the motor really did

    A gear motor with a Hall encoder on an L9110S pumps an exact dose: count pulses on an interrupt, work out speed from them, and slow down before the mark so it stops on it.

    0 of 5 steps

Chapter 4

Boss project

A 2WD robot car that avoids walls, hunts with its eye and never crosses the line.

  1. Locked187 XP

    Boss part 1: a car that avoids walls

    A 2WD chassis on an L298N with an HC-SR04 on the front: time an ultrasonic echo, turn it into millimeters, and write the look-then-decide loop every robot starts from.

    0 of 5 steps

  2. ProjectLocked400 XP

    Boss: a robot car with eyes and line sensors

    The finished robot: a 2WD car on a MOSFET DRV8833 with an ultrasonic eye and two TCRT5000 line sensors, run by a four-state machine that hunts, charges and never drives off the edge.

    0 of 6 steps

Syllabus

Every lesson in the course

All 7 lessons, in order, each with what it covers. Any of them opens in the editor right away.

Chapter 1

DC motors

  1. A DC motor on a driver: speed and directionTwo gear motors on an L298N: why a pin cannot run a motor, two inputs for direction, PWM on the enable for speed, and the volts a bipolar driver keeps for itself.
  2. Inside the driver: the H bridgeFour switches around a motor make it go both ways. An L293D on a breadboard: the truth table, braking against coasting, back EMF, and why half the PWM is not half the speed.
Chapter 2

Servos and steppers

  1. A servo: an angle, not a speedA hobby servo is a motor, a gearbox, a potentiometer and a control loop in one box. Drive it with a pulse width, follow a slider, and learn why it needs its own power.
  2. A stepper on an A4988: STEP and DIRA NEMA 17 moves in exact steps with no sensor at all. Two wires from the Uno, microstepping from three pins, the current limit you set with a screwdriver, and how a stepper misses steps.
Chapter 3

Feedback

  1. An encoder: measure what the motor really didA gear motor with a Hall encoder on an L9110S pumps an exact dose: count pulses on an interrupt, work out speed from them, and slow down before the mark so it stops on it.
Chapter 4

Boss project

  1. Boss part 1: a car that avoids wallsA 2WD chassis on an L298N with an HC-SR04 on the front: time an ultrasonic echo, turn it into millimeters, and write the look-then-decide loop every robot starts from.
  2. Boss: a robot car with eyes and line sensorsThe finished robot: a 2WD car on a MOSFET DRV8833 with an ultrasonic eye and two TCRT5000 line sensors, run by a four-state machine that hunts, charges and never drives off the edge.
Keep going

The next course on your track

Motors and motion is part of the embedded track, a ladder of courses from zero to expert.

Next course

Embedded on the ESP32-C3

A 32 bit RISC-V board at 160 MHz. Its own peripherals, its own 3.3 V rules, and a console at the end of it.

Open the next course
Track

Embedded track

Arduino, ESP32, Raspberry Pi Pico and STM32: pins, timing, buses, motors, WiFi, registers and debugging, every lesson checked on a simulated board.

See every course on the track
Kits

Build it on your bench too

Every lesson runs in the simulator with nothing to buy. When you want the real thing, these kits have the parts.

The kit for this course

Robot Car Kit

An Uno, a 2WD chassis, two motor drivers, an ultrasonic eye and two line sensors.

Open the kit
Have a kit already?

Find your kit

Pick the starter kit you own and run every lesson in its manual with the same parts on the same pins.

See every kit
Questions

About Motors and motion

Is Motors and motion free?

Yes. All 7 lessons of Motors and motion are free and run in your browser, with nothing to install and no parts to buy before you start.

Do I need a real Arduino Uno R3?

No. Every lesson runs on a simulated Arduino Uno R3 with its parts on the canvas, and the simulator checks each step as you go. When you want to build it for real, the same wiring and code work on a real board.

How long does Motors and motion take?

About 4 hours: 7 lessons in 4 chapters, each one a few short steps. Your progress is kept, so you can stop after any lesson and pick up where you left off.

What will I build?

Each chapter ends in a project that puts it together: Inside the driver: the H bridge, A stepper on an A4988: STEP and DIR and Boss: a robot car with eyes and line sensors.

Where do I start?

With "A DC motor on a driver: speed and direction", and each lesson builds on the one before it. New to circuits? Electronics basics is the course that starts from zero.