← Embedded Track
Embedded Systems & IoT · Course 06

Robotics with
Sensors & Motors

Build a small rover from motor control to autonomy: power, drivers, servos, distance sensing, line following, encoders, state machines, and testing.

Start Course 06 ← Course 05 Course 07 →
12Modules
MotorsDrivers + servos
Control logicSensors + autonomy
CapstoneAutonomous rover
Course Progress
0%
Module 01

Robot Safety & Build Planning

Robotics combines code, current, motion, and mechanical risk. Learners start with safe power, stable wiring, and testable design.

🤖 Safety habits
  • Disconnect power before rewiring.
  • Keep wheels off the ground for first motor tests.
  • Separate logic power from motor power when required.
  • Use motor drivers instead of GPIO pins for motors.
🧪 Lab: Bench Safety Check

Create a pre-power checklist and test motor code with the robot lifted off the table.

🧠 Quick Check
Why should wheels be lifted during first motor tests?
Module 02

Power & Motor Drivers

Motors draw more current than logic pins can supply. Learners use motor drivers, shared ground, and separate power planning.

🤖 Power concepts
  • GPIO signals control drivers; they do not power motors directly.
  • Motor supplies must match motor requirements.
  • Ground must be shared between controller and driver.
  • Brownouts happen when motors steal current from the controller.
🧪 Lab: Driver Wiring Map

Draw and wire a controller, motor driver, battery pack, and motor with a shared ground.

🧠 Quick Check
Why use a motor driver?
Module 03

DC Motors

DC motors teach direction, speed, and driver control. Learners run forward, reverse, stop, and simple speed changes.

🤖 Motor commands
  • IN1/IN2 often control direction.
  • PWM controls average speed.
  • Stop can mean coast or brake depending on driver behavior.
  • Test one motor before controlling two.
🧪 Lab: Single Motor Test

Write code to run one motor forward, stop, reverse, and stop again.

🧠 Quick Check
What commonly controls DC motor speed?
Module 04

Servos

Servos move to an angle rather than spinning continuously. Learners use them for steering, doors, arms, and sensor mounts.

🤖 Servo basics
  • A standard servo expects timed control pulses.
  • Servos need enough current.
  • Mechanical limits matter.
  • Jitter often means power or signal issues.
🧪 Lab: Sweep Servo

Move a servo between three angles and document its safe mechanical range.

🧠 Quick Check
Why avoid forcing a servo past its physical limit?
Module 05

Ultrasonic Distance Sensors

Distance sensors let robots detect walls and obstacles. Learners read trigger/echo timing and convert it into distance.

🤖 Distance concepts
  • Trigger pulse starts measurement.
  • Echo duration represents travel time.
  • Soft surfaces and angles can affect readings.
  • Multiple readings should be filtered.
🧪 Lab: Distance Readout

Print distance readings and test against near, medium, and far objects.

🧠 Quick Check
Why take multiple distance readings?
Module 06

Line Sensors

Line sensors teach surface detection and feedback. Learners read reflected light and decide whether the robot is over a dark or light line.

🤖 Line following ideas
  • Sensors need calibration for the actual surface.
  • Thresholds separate line from background.
  • Two sensors can steer left or right.
  • Lighting changes can affect readings.
🧪 Lab: Line Threshold Test

Record sensor values over line and background, then choose a threshold.

🧠 Quick Check
Why calibrate line sensors?
Module 07

Encoders

Encoders measure wheel movement. Learners understand ticks, speed estimation, and why dead reckoning drifts.

🤖 Encoder concepts
  • Ticks count wheel rotation.
  • Wheel diameter affects distance calculation.
  • Slipping wheels create error.
  • Interrupts often read encoder pulses.
🧪 Lab: Tick Counter

Spin a wheel slowly and count encoder ticks in Serial output.

🧠 Quick Check
What does an encoder measure?
Module 08

Joystick & Manual Control

Before autonomy, learners build manual control to verify drive direction, steering, and response.

🤖 Control mapping
  • Map joystick axes to motor speed.
  • Dead zones prevent drift.
  • Manual mode helps debug hardware.
  • Start at low speed.
🧪 Lab: Joystick Drive

Use a joystick or button controls to drive forward, reverse, left, and right.

🧠 Quick Check
Why build manual mode first?
Module 09

Obstacle Avoidance

Learners combine distance sensing with motor decisions so a rover can stop, turn, and continue.

🤖 Avoidance logic
  • Read distance.
  • Compare to a threshold.
  • Stop before collision.
  • Turn and re-check.
  • Avoid rapid oscillation with delays or states.
🧪 Lab: Avoid the Box

Program the rover to stop before an obstacle and turn away.

🧠 Quick Check
What triggers an avoidance maneuver?
Module 10

Robot State Machines

State machines make robot behavior easier to reason about than giant nested if statements.

🤖 States
  • IDLE
  • DRIVE_FORWARD
  • AVOID_OBSTACLE
  • TURN_LEFT
  • ERROR
🧪 Lab: State Machine Sketch

Refactor obstacle avoidance into named states and print the current state.

🧠 Quick Check
Why use named states?
Module 11

Calibration & Testing

Robots need repeatable tests. Learners tune thresholds, speeds, turn times, and sensor positions.

🤖 Test plan
  • Test one subsystem at a time.
  • Record values before changing thresholds.
  • Use slow speeds first.
  • Document known limitations.
🧪 Lab: Rover Test Sheet

Create a test sheet with pass/fail rows for motors, sensors, turns, and obstacle avoidance.

🧠 Quick Check
What should you do before changing thresholds?
Module 12

Capstone: Autonomous Rover

The capstone combines safe wiring, motors, distance sensing, line or obstacle logic, manual mode, and documentation.

🤖 Final requirements
  • Manual drive mode works.
  • Obstacle avoidance works.
  • Status LED or serial output explains state.
  • Battery and wiring are secured.
  • README includes wiring diagram and test results.
🧪 Lab: Build the Rover

Build and demo an autonomous rover that avoids obstacles and includes a documented test plan.

🧠 Quick Check
What makes a rover portfolio-ready?