Source: https://mokxi.com/teachers/plans/motors-and-motion
Updated: 2026-11-11

Lesson plan

# Motors and motion lesson plan

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.

4 chapters, 7 lessons, about 4 hours, on the Arduino Uno R3. Every lesson runs in the browser, with nothing to install.

Start a class from this course

The unit

## Objectives and materials

### By the end, students can

- Speed with PWM, direction with an H bridge, and where the volts go.
- Motors that go to an angle, and motors that count their steps.
- An encoder measures what the motor really did, and the code corrects.
- A 2WD robot car that avoids walls, hunts with its eye and never crosses the line.

### Materials for the whole unit

- Arduino Uno R3
- Battery: AA, coin cell, LiPo
- DC motor x 2
- Full-size breadboard
- Gear motor with encoder
- Half breadboard
- Hobby servo
- Line sensor, TCRT5000 x 2
- Motor driver module, L298N
- Motor driver, DRV8833
- Motor driver, L293D
- Motor driver, L9110S
- Pushbutton
- Robot car chassis, 2WD
- Slide potentiometer
- Stepper driver, A4988
- Stepper driver, DRV8825
- Stepper motor, NEMA 17 x 2
- Ultrasonic ranger

Every part is already on the simulator’s bench, so there is nothing to buy or hand out. The counts are the most any one lesson uses, if you build it on real breadboards too.

Chapter 1. About 1 h 10 min

## DC motors

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

Lesson | Time | What students do

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. | 35 min

- Run it
- Two pins for direction
- PWM is the throttle
- Where 2.5 volts go
- More battery, more speed

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. | 35 min

- Run it
- The other way
- Braking against coasting
- Darlingtons, and the D in L293D
- Half throttle is not half speed

### Materials

- Arduino Uno R3
- DC motor x 2
- Full-size breadboard
- Motor driver module, L298N
- Motor driver, L293D

### Check for understanding

Each student finishes "Inside the driver: the H bridge" on their own, without opening the hints. The simulator checks 5 of its 5 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Half throttle is not half speed".

Chapter 2. About 1 h 10 min

## Servos and steppers

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

Lesson | Time | What students do

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. | 35 min

- Run it
- The angle is a pulse width
- Push the fader
- Back to the middle
- Give it its own power

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. | 35 min

- Run it
- Two wires: STEP and DIR
- One pulse, two different steps
- The current limit
- How a stepper loses its place

### Materials

- Arduino Uno R3
- Full-size breadboard
- Hobby servo
- Slide potentiometer
- Stepper driver, A4988
- Stepper driver, DRV8825
- Stepper motor, NEMA 17 x 2

### Check for understanding

Each student finishes "A stepper on an A4988: STEP and DIR" on their own, without opening the hints. The simulator checks 5 of its 5 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "How a stepper loses its place".

Chapter 3. About 35 min

## Feedback

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

Lesson | Time | What students do

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. | 35 min

- Run it
- Press for a dose
- Speed from pulses
- Stop on the mark
- Which way? Quadrature

### Materials

- Arduino Uno R3
- Battery: AA, coin cell, LiPo
- Gear motor with encoder
- Half breadboard
- Motor driver, L9110S
- Pushbutton

### Check for understanding

Each student finishes "An encoder: measure what the motor really did" on their own, without opening the hints. The simulator checks 5 of its 5 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Which way? Quadrature".

Chapter 4. About 1 h 15 min

## Boss project

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

Lesson | Time | What students do

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. | 35 min

- Run it
- Clear ahead: drive
- How the echo is timed
- Put a wall in front
- Back away

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. | 40 min

- Run it
- A better driver
- Find the opponent
- The edge always wins
- And the other corner
- Make it your robot

### Materials

- Arduino Uno R3
- Line sensor, TCRT5000 x 2
- Motor driver module, L298N
- Motor driver, DRV8833
- Robot car chassis, 2WD
- Ultrasonic ranger

### Check for understanding

Each student finishes "Boss: a robot car with eyes and line sensors" on their own, without opening the hints. The simulator checks 6 of its 6 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Make it your robot".

Your class

## Teach this unit as a class

Start a class from this course and its 7 lessons are assigned in one go, in order. Students join with a six-character code or printed login cards, and each one’s work comes back to you.

The class tools are free for 30 days for one class of up to 20 students, with no card. The lessons themselves are free either way.

Start a class from this course See the demo class

More units

## Other lesson plans

Electronics basics 20 lessons, about 10 h. Embedded on the Arduino Uno 16 lessons, about 12 h. Embedded on the ESP32-C3 13 lessons, about 11 h. Embedded on the Raspberry Pi Pico 7 lessons, about 6 h. Build your own fight stick 5 lessons, about 4 h. Embedded on the STM32F411 6 lessons, about 6 h. C++ on a board 13 lessons, about 10 h. Digital logic and memory 4 lessons, about 4 h. Interactive devices on the Uno 9 lessons, about 8 h. From gates to a computer 23 lessons, about 16 h. Build a claw machine 8 lessons, about 6 h. Every unit All the courses as ready-made units, on the teachers page.
