Guided physical computing, beginning with the Arduino Starter Kit Classroom Pack

Arduino Uno R3

Control DC motor direction

Use the kit L293D H-bridge to start, stop, and reverse a DC motor through explicit enable and direction signals.

CSTA 2026 mapping candidatesNot reviewed by CSTA
MS-SYS-HW-30Systems & SecurityMS-PRO-TR-19Programming

Students will

  • Distinguish motor power, logic power, enable, and direction pins
  • Reverse a motor by changing H-bridge input states
  • Stop before reversing direction

Evidence of success

  • The wiring record distinguishes logic and motor supply pins
  • The motor stops before every direction change
  • Forward and reverse behavior repeat without Uno resets or component heating

Hardware

  • Arduino Uno R3
  • Starter Kit DC motor
  • L293D H-bridge motor driver
  • Teacher-approved motor supply
  • Breadboard and jumper wires

Prerequisites

  • Switch a DC motor safely
  • Identify PWM and digital pins
  • Read the exact H-bridge pinout

Before class

  • Confirm the L293D marking, notch orientation, and datasheet pinout
  • Verify the motor supply and common-ground arrangement
  • Remove mechanical loads for the first direction test

Reviewed connection map

L293D direction control

D4 + D5Direction inputs
D9 PWMEnable and speed command
L293DSeparates logic control from motor current
Motor + reviewed supplyLoad power, return, and common reference
  1. Wire D4, D5, and D9 to the reviewed L293D input and enable pins.
  2. Connect logic power, motor power, grounds, and outputs using the exact IC orientation and pinout.
  3. Stop the motor before reversing direction.

Build and test

  1. 01Map the L293D logic supply, motor supply, four ground pins, enable, inputs, and one output pair
  2. 02Connect one motor channel with power disconnected and verify the IC spans the breadboard center gap
  3. 03Run a stopped-to-forward test
  4. 04Stop the motor before commanding reverse
  5. 05Repeat forward-stop-reverse-stop while checking heat and supply stability

Read before uploading

Annotated Arduino sketch

const int ENABLE_PIN = 9;
const int INPUT_1 = 4;
const int INPUT_2 = 5;

void driveMotor(bool first, bool second, int speedValue) {
  digitalWrite(INPUT_1, first);
  digitalWrite(INPUT_2, second);
  analogWrite(ENABLE_PIN, speedValue);
}

void setup() {
  pinMode(ENABLE_PIN, OUTPUT);
  pinMode(INPUT_1, OUTPUT);
  pinMode(INPUT_2, OUTPUT);
}

void loop() {
  driveMotor(HIGH, LOW, 160);
  delay(1000);
  driveMotor(LOW, LOW, 0);
  delay(500);
  driveMotor(LOW, HIGH, 160);
  delay(1000);
  driveMotor(LOW, LOW, 0);
  delay(1000);
}

Optional engineering record

Record evidence from this lesson

Choose the prompts that help students explain predictions, evidence, debugging, and transfer. Saving creates a new entry in this browser’s Rudi notebook.

Record your thinking — optional4 prompts

Use these prompts if they help students capture evidence, decisions, or questions. You do not need to complete every prompt or create an entry at every step.

Nothing is saved until you choose this button.

Troubleshooting

Motor moves only one direction

Verify both direction-input connections and print or observe their commanded states.

The H-bridge becomes warm

Disconnect power immediately and review pinout, shorts, motor stall current, supply voltage, and mechanical load.

2026 middle school standards

Potential CSTA connections

Not reviewed by CSTA

These are evidence-based crosswalk candidates for curriculum review—not a claim of official alignment.

MS-SYS-HW-30

Examine differences between computing systems based on user needs, system requirements, and potential societal, environmental, and ethical impacts.

Students examine how an H-bridge changes the computing system needed to meet a bidirectional-motion requirement.

Lesson evidence: Direction truth table
MS-PRO-TR-19

Use systematic strategies to test, refine, and document changes to a computing technology to meet the intended purpose.

Students isolate variables, compare observed behavior with the intended purpose, and document a revision.

Lesson evidence: Stop and direction sequence test
View the official 2026 CSTA standardsStandard text: Computer Science Teachers Association (2026), CC BY-NC-SA 4.0.

Supporting concepts

motor-types · motor-control · motor-drivers · power-and-signals

Sources and review

Arduino Uno R3 documentationArduino Projects Book · CC BY-NC-SA 3.0Texas Instruments L293D datasheet

Starting point, not verified curriculum. Review the actual hardware, circuit, code, power requirements, and classroom conditions.

After teaching this lesson

Make one bounded change—or connect the skill to a project.