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