Weeks 1-2 • Foundational Robotics

Introduction to Robotics — Systems & Mechanical Advantage

A robot is a programmable machine capable of sensing its environment, making decisions, and physically interacting with the world. Unlike simple automated machines that follow fixed routines, robots combine sensors, processors, and actuators in an integrated system that can adapt to changing conditions. The field of robotics draws from mechanical engineering, electrical engineering, and computer science — making it one of the most interdisciplinary domains in STEM.

The fundamental architecture of any robot follows the sense-think-act cycle. Sensors gather data about the environment (light, distance, temperature, orientation), a processor or controller interprets that data and decides on an action, and actuators (motors, servos, linear actuators) carry out the physical movement. Understanding this cycle is the foundation of all robotics engineering.

  • Degrees of Freedom (DOF): The number of independent motions a robot can make. A wheeled robot on a flat surface has 3 DOF (x, y, heading). A robotic arm with 6 joints has 6 DOF.
  • End Effector: The tool mounted at the tip of a robotic arm — a gripper, welding torch, camera, or suction cup — that directly interacts with the workpiece or environment.
  • Gear Ratio: The ratio of teeth between two meshing gears, determining the tradeoff between rotational speed and torque. A gear ratio greater than 1 produces slower output rotation but multiplied torque.
  • Payload: The maximum weight a robot arm can carry at a given reach while maintaining positional accuracy and structural integrity.
GR = Ndriven / Ndriver
ωout = ωin / GR
τout = τin × GR
P = τ · ω = constant (power is conserved)

Mechanical Advantage in Robotics

Every robot that moves must convert the rotary motion of a motor into useful work — turning wheels, lifting arms, or opening grippers. Gear trains are the most common mechanism for modifying the speed-torque characteristics of a motor. A small DC motor might spin at 10,000 RPM but produce only 0.01 N·m of torque. By passing this through a 100:1 gear reduction, the output shaft spins at 100 RPM with 1 N·m of torque — suitable for driving a robot’s wheels or lifting a payload.

The simulator below lets you explore this tradeoff directly. Adjust the number of teeth on each gear and observe how the ratio affects output speed and torque. Notice that meshing gears rotate in opposite directions — an important consideration in drivetrain design. A small driver gear turning a large driven gear produces speed reduction with torque multiplication, which is the most common configuration in mobile robotics.

Gear Ratio & Mechanical Advantage Simulator Interactive

Adjust the number of teeth on each gear to explore how gear ratios affect output speed and torque. Observe the size difference between meshing gears and notice how the driven gear rotates in the opposite direction.

Weeks 3-4 • Electrical Engineering

Electronics Fundamentals — Circuits & Microcontrollers

Electricity is the lifeblood of every robot. Motors need current to produce torque, sensors need stable voltage to generate accurate readings, and microcontrollers need regulated power to execute programs. Understanding how electrical energy flows through a circuit is essential before you can design or troubleshoot any robotic system.

The three fundamental quantities in electronics are voltage (V), current (I), and resistance (R). Voltage is the electrical “pressure” that pushes charge through a circuit, measured in Volts. Current is the rate of charge flow, measured in Amperes. Resistance is the opposition to current flow, measured in Ohms. These three quantities are governed by Ohm’s Law.

  • Series Circuit: Components connected end-to-end share the same current. Voltage divides proportionally across each component: Vn = I × Rn.
  • Parallel Circuit: Components connected side-by-side share the same voltage. Current divides among branches: In = V / Rn.
  • Microcontroller: A self-contained computer on a single chip (e.g., Arduino Uno / ATmega328P) that reads sensor inputs and drives outputs through programmable digital and analog pins.
  • Breadboard: A reusable prototyping board with internal spring clips that allow components to be connected without soldering, essential for rapid circuit iteration.
V = I × R
P = V × I = I² × R = V² / R

From Circuit to Code

Modern robotics relies on microcontrollers — small, inexpensive programmable chips that bridge the gap between sensors and actuators. An Arduino Uno provides 14 digital I/O pins and 6 analog inputs. A single line of code like analogRead(A0) reads the voltage on pin A0 (0-5V mapped to 0-1023), while analogWrite(9, 128) outputs a PWM signal at roughly 50% duty cycle on pin 9. This direct hardware access is what makes microcontrollers so powerful for robotics.

The simulator below demonstrates Ohm’s Law in action. Adjust the voltage and resistance and watch how current and power change. Notice that power scales with the square of voltage — doubling the voltage quadruples the power dissipation through the same resistor. This is why proper component selection and heat management are critical in robot electronics.

Ohm’s Law Circuit Visualizer Interactive

Adjust the supply voltage and resistance to see how current, power, and the circuit schematic respond. The resistor color and current arrow size change to reflect the operating conditions.

Weeks 5-6 • Software Engineering

Programming for Robots — Logic, Sensors & Motor Control

Hardware without software is just metal and plastic. Programming is what brings a robot to life — translating sensor data into motor commands through a logical sequence of decisions. Robot programming combines real-time data processing with control theory, often running on resource-constrained hardware where every microsecond and byte of memory counts.

Most beginner robotics platforms use C/C++ (Arduino) or Python (Raspberry Pi). The core programming loop reads inputs, computes outputs, and writes those outputs to actuators — repeating this cycle hundreds or thousands of times per second. Within this loop, the programmer must handle sensor noise, implement state machines for complex behaviors, and manage timing constraints.

  • PWM (Pulse Width Modulation): A technique for simulating variable voltage by rapidly switching a digital signal between HIGH and LOW. The duty cycle (percentage of time HIGH) determines the effective average voltage delivered to a load like a DC motor.
  • State Machine: A programming pattern where the robot exists in one of several discrete states (e.g., “searching,” “approaching,” “grabbing”) and transitions between them based on sensor inputs.
  • H-Bridge: A circuit of four switching elements (transistors or MOSFETs) that allows bidirectional current flow through a DC motor, enabling both forward and reverse rotation from a single supply.
  • Sensor Noise: Random fluctuations in sensor readings caused by electrical interference or environmental factors. Filtering (moving average, exponential smoothing, Kalman filter) is needed to extract reliable data.
Veff = Vsupply × (D / 100)

where D is the PWM duty cycle as a percentage. A 12V supply at 75% duty delivers Veff = 9V to the motor.

PWM and Motor Speed Control

A DC motor’s speed is roughly proportional to the voltage applied to it. However, microcontrollers output digital signals (5V HIGH / 0V LOW), not true analog voltages. PWM bridges this gap: by switching the signal HIGH for a fraction of each cycle at a frequency high enough (typically 490 Hz or 980 Hz on Arduino), the motor’s inertia smooths the pulsed signal into a proportional average speed. The simulator below lets you change the duty cycle and supply voltage to see how the PWM waveform and effective voltage respond.

PWM Motor Control Visualizer Interactive

Change the duty cycle and supply voltage to see how the PWM waveform shape changes and how the effective voltage delivered to the motor responds. The motor speed indicator reflects the effective power output.

Weeks 7-9 • Mechanical Engineering

Mechanical Design — Kinematics & Robotic Arms

While wheeled robots move by steering along surfaces, articulated robots — robotic arms — must compute precise joint angles to position their end effectors in space. This is the domain of kinematics: the mathematics of motion geometry without regard to the forces that cause it. Kinematics bridges a robot’s mechanical structure and its software control.

A robotic arm is a kinematic chain — a series of rigid links connected by joints. Each revolute (rotating) or prismatic (sliding) joint adds a degree of freedom. A 2-link planar arm confined to a flat plane is the simplest non-trivial case and serves as the foundation for understanding complex industrial manipulators with 6 or more DOF.

  • Forward Kinematics (FK): Computing the end-effector position from known joint angles. Uses straightforward trigonometry and always yields exactly one solution.
  • Inverse Kinematics (IK): Computing the joint angles needed to reach a desired end-effector position. More complex — may have zero, one, or multiple solutions.
  • Workspace: The set of all points the end effector can reach. For a 2-link arm, this is an annular (ring-shaped) region with inner radius |L1 – L2| and outer radius L1 + L2.
  • Singularity: A configuration where the arm loses a degree of freedom (e.g., fully stretched out). Near singularities, small changes in end-effector position require disproportionately large joint movements.

Forward Kinematics — given joint angles θ1, θ2 and link lengths L1, L2:

x = L1·cos(θ1) + L2·cos(θ1 + θ2)
y = L1·sin(θ1) + L2·sin(θ1 + θ2)

Inverse Kinematics — given target (x, y):

cos(θ2) = (x² + y² – L1² – L2²) / (2 · L1 · L2)
θ1 = atan2(y, x) – atan2(L2·sin(θ2), L1 + L2·cos(θ2))

Elbow-Up vs Elbow-Down

The inverse kinematics of a 2-link arm generally yields two valid solutions — the “elbow-up” and “elbow-down” configurations. Both place the end effector at the same target position, but the arm’s shape differs. Choosing between them depends on workspace obstacles, joint limits, and the desired motion trajectory. Industrial robots often use elbow-down for tasks below the arm and elbow-up for overhead work. The simulator below computes the elbow-down solution. Try moving the target outside the dashed reach boundary to see what happens when a point is unreachable.

Two-Link Robotic Arm — Inverse Kinematics Interactive

Set a target position using the sliders and watch the arm compute the required joint angles. The dashed circles show the minimum and maximum reach boundaries. Green = reachable; red = unreachable.

Weeks 10-12 • Control Systems

Autonomous Behavior — PID Control & Path Following

The ultimate goal of robotics is autonomy — the ability for a robot to operate independently, making decisions and adjusting its behavior in real time without human intervention. At the heart of most autonomous behaviors is a feedback control loop: the robot continuously measures its state, compares it to a desired state, and applies corrections to minimize the difference. This is the principle of closed-loop control.

The PID (Proportional-Integral-Derivative) controller is the most widely used feedback control algorithm in robotics and industrial automation. Its elegance lies in its simplicity: three tuning parameters (Kp, Ki, Kd) that can be adjusted to handle a remarkable range of control challenges, from maintaining a drone’s hover altitude to guiding a mobile robot along a curved line.

  • Proportional (Kp): Produces correction proportional to the current error. Higher Kp means faster response but can cause overshoot and oscillation around the setpoint.
  • Integral (Ki): Accumulates past errors over time. Eliminates steady-state offset that P-only control cannot correct, but excessive Ki causes integral windup and instability.
  • Derivative (Kd): Reacts to the rate of error change. Acts as a predictive dampener that reduces overshoot, but amplifies high-frequency sensor noise.
  • Steady-State Error: The persistent offset remaining after a system settles, which a P-only controller cannot eliminate for certain plant types (e.g., velocity control with constant disturbance).
u(t) = Kp · e(t) + Ki · ∫0t e(τ) dτ + Kd · de(t)/dt

where e(t) = setpoint – measured is the error and u(t) is the control output (e.g., steering angle, motor voltage).

Tuning a PID Controller

PID tuning — finding the right balance of Kp, Ki, and Kd — is both a science and an art. The Ziegler-Nichols method provides a systematic starting point: increase Kp until the system oscillates at constant amplitude (the “ultimate gain” Ku with period Tu), then compute initial gains from published formulas. From there, manual fine-tuning adjusts the response to meet specific settling-time, overshoot, and stability requirements.

For a line-following robot, the process is intuitive: start with Kp only and increase until the robot tracks the line but oscillates. Add Kd to dampen oscillation. Finally, add a small Ki to correct any persistent bias from sensor miscalibration or uneven wheel diameters. The simulator below lets you experience this tuning process directly — adjust each gain and observe its effect on the robot’s trajectory.

PID Line-Following Controller Interactive

Tune the proportional (Kp), integral (Ki), and derivative (Kd) gains and observe how the robot follows the reference path (dashed line). High Kp causes oscillation. Kd dampens overshoot. Ki eliminates steady-state bias.

Weeks 13-16 • Capstone Integration

Capstone — Autonomous Navigation Challenge

This capstone module brings together every concept from the course — sensing, electronics, programming, kinematics, and control — into a single integrated challenge: autonomous navigation. A mobile robot must reach a goal position in an arena populated with obstacles, using sensor-based perception and intelligent decision-making to plan and execute a safe path.

Real-world autonomous navigation involves multiple layers of intelligence. At the lowest level, reactive behaviors (like obstacle avoidance) provide immediate safety. At a higher level, path planning algorithms compute efficient routes. This capstone focuses on the foundational layer: reactive navigation using potential fields, where the goal exerts an attractive force and obstacles exert repulsive forces, and the robot follows the combined vector.

  1. Environment Sensing: The robot’s sensors (ultrasonic, LiDAR, or IR) detect nearby obstacles. In this simulation, obstacles are rectangular regions that generate repulsive force fields.
  2. Goal Attraction: The target position exerts an attractive force proportional to distance, pulling the robot toward it. The force magnitude is capped to prevent runaway speed.
  3. Obstacle Repulsion: Each obstacle generates a repulsive force when the robot is within a threshold distance. The force increases sharply as the robot approaches.
  4. Navigation Execution: The robot’s heading is determined by the vector sum of all forces. By continuously recomputing these forces as it moves, the robot navigates around obstacles while progressing toward the goal.
  • Potential Field Method: A navigation approach where the goal attracts and obstacles repel, creating a virtual “force landscape” the robot flows through.
  • Local Minima: A limitation where balanced attractive and repulsive forces trap the robot in a non-goal position. Advanced methods (navigation functions, RRT*) address this.
  • Sensor Fusion: Combining data from multiple sensor types (wheel encoders + IMU + LiDAR) to produce a more accurate state estimate than any single sensor could provide.
Autonomous Navigation Arena Full System

Click anywhere in the arena to set the goal position (red marker), then press Execute to watch the robot navigate using potential-field forces. The green trail shows the robot’s path. Can you find a goal that causes the robot to get stuck?

Ready. Click on the arena to place the goal, then press Execute to run the navigation simulation.