Programming Robots
Download the Lessonotes Mobile Ghana app for faster lesson access on Android and iPhone.
Subject: Robotics
Class: SHS 2
Term: 2nd Term
Week: 18
Grade code: 2.3.3.LI.2
Strand code: 3
Sub-strand code: 3
Content standard code: 2.3.3.CS.1
Indicator code: 2.3.3.LI.2
Theme: Robot Construction and Programming
Subtheme: Programming Robots
This page supports the lesson note with a companion video and a short classroom-ready summary.
For class groups and homework, share this lesson page so learners also get the summary, objectives, and full lesson context.
Welcome, learners! Today, we are moving beyond simple "if this, then that" programming for our robots. We will explore how to make our robots smart, responsive, and incredibly accurate. We will learn about a powerful control system called a PID Controller. Think about a drone trying to stay perfectly still in the air despite the wind, or a self-driving car trying to stay exactly in the middle of its lane. How do they make constant, tiny adjustments to stay on target? The answer is often a PID controller.
The Core Problem: Reaching a Target Accurately
Imagine you have built a simple line-following robot. Its goal is to keep a light sensor perfectly centred on a black line. This desired position is called the Setpoint (SP). The robot's actual position, measured by the sensor, is the Process Variable (PV).
The difference between where you want to be and where you are is the Error (e).
Formula: `Error (e) = Setpoint (SP) - Process Variable (PV)` If the robot is perfectly on the line, the `Error` is 0. If it drifts to the right, the `Error` might be +10. If it drifts to the left, the `Error` might be -10.