Module Introduction
Welcome back, robot builders! In the last module, we learned how robots navigate from place to place. But how do robots keep themselves steady, move exactly the right amount, or balance on two wheels? That's where control systems come in. A control system is like a robot's internal coach – it watches what the robot is doing and tells it how to adjust. Think about riding a bicycle: if you start to lean too far to the right, you automatically turn the handlebar to the left to balance. That's your own control system! Robots do the same thing, but with sensors and computers. In this module, we will explore the two main types of control: open‑loop and closed‑loop. We will learn about feedback, and we will even discover the magic of PID control (don't worry – we'll make it simple!). By the end, you will understand how robots keep themselves steady and precise. Let's get controlled!
Chidinma is 11 years old. She built a robot that drives on two wheels. But her robot keeps wobbling and falling over! "Why won't it stand up straight?" she asked her older brother. He said, "Your robot needs a control system. Right now, it has no way to correct itself when it leans." He helped her add a gyroscope sensor (which measures tilt) and wrote a program that adjusts the wheels' speed when the robot leans too much. If the robot leans forward, the wheels spin faster to catch up. If it leans backward, they slow down. Suddenly, the robot stood up straight and drove smoothly! Chidinma learned that control systems are like a robot's sense of balance. Now her robot could even carry a cup of water without spilling!
Definition: A control system is a set of rules and devices that tells a robot how to behave. It watches what the robot is doing and makes adjustments to keep it on track.
Why it's important: Without control, robots would be clumsy and inaccurate. Control systems help robots move smoothly, balance, and do precise tasks.
Simple explanation: A control system is like a teacher who watches you draw a line and tells you "a little more to the left" to make it straight.
Real‑life example: A thermostat controls the temperature in your house. If it gets too cold, it turns on the heater.
School example: A robot arm uses a control system to move to the exact position you want.
Home example: A rice cooker uses a control system to keep the rice at the right temperature.
Nigerian example: A generator's voltage regulator is a control system that keeps the output steady.
+------------------------------------------+ | What is a Control System? | |------------------------------------------+ | +-------+ +---------+ +-------+ | | | Input | --> | Control | --> | Output| | | |(what | | System | |(action| | | | we | | (brain) | | taken)| | | | want) | +---------+ +-------+ | | +-------+ | | | v | | +-------+ | | |Feedback| (checks result) | | +-------+ | | | | The system keeps checking if the | | output matches the desired input. | +------------------------------------------+
Mini summary: A control system watches the robot's actions and makes corrections to achieve the desired result.
Definition: Open‑loop control is when a robot follows a set of instructions without checking if it did them correctly. It just does what it's told and hopes for the best.
Why it's important: Open‑loop is simple and fast, but it can't correct mistakes. It works well if the robot doesn't need to be very accurate.
Simple explanation: Imagine throwing a ball at a target with your eyes closed. You throw, but you don't see if you hit the target. That's open‑loop.
Real‑life example: A toaster heats bread for a fixed time, regardless of how toasted the bread is.
School example: A robot that moves forward for 2 seconds and stops – it doesn't check if it moved the right distance.
Home example: A sprinkler that runs for 30 minutes every day, rain or shine.
Nigerian example: A streetlight that turns on at 7 PM and off at 6 AM, regardless of daylight.
+------------------------------------------+ | Open‑Loop Control | |------------------------------------------+ | +---------+ +---------+ | | | Command | --> | Actuator| --> Action | | | (do X) | | (motor) | | | +---------+ +---------+ | | | | No checking if the action was done | | correctly. Just "fire and forget". | +------------------------------------------+
Mini summary: Open‑loop control executes a command without checking the result. It is simple but cannot correct errors.
Definition: Closed‑loop control is when a robot does a task, checks the result (with a sensor), and adjusts if it's not right. It uses feedback.
Why it's important: Closed‑loop control is accurate and can correct errors. Most important robots use this.
Simple explanation: Throwing a dart while keeping your eyes open – you see where it lands and adjust your aim for the next throw.
Real‑life example: A self‑driving car adjusts its steering based on the lane markings it sees.
School example: A line‑following robot uses a light sensor to check if it is on the line and corrects its direction.
Home example: An oven with a temperature sensor that turns the heat on and off to keep the set temperature.
Nigerian example: A solar panel system that tracks the sun – it uses a light sensor to adjust its position for maximum sunlight.
+------------------------------------------+ | Closed‑Loop Control | |------------------------------------------+ | +---------+ +---------+ +------+| | | Desired | --> |Control | --> |Action|| | | value | |System | | || | +---------+ +---------+ +------+| | ^ | | | | v | | +---------+ +------+| | |Feedback | |Sensor|| | |(error) | |(checks)| | +---------+ +------+| | | | The system compares actual output | | with desired value and corrects. | +------------------------------------------+
Mini summary: Closed‑loop control uses feedback to check the result and correct errors. It is more accurate than open‑loop.
Definition: Feedback is the information a robot gets from its sensors about what just happened. It tells the robot if it did the right thing.
Why it's important: Feedback is what makes closed‑loop control work. Without feedback, robots cannot correct themselves.
Simple explanation: Feedback is like looking at a mirror to see if your tie is straight.
Real‑life example: A car's speedometer gives feedback to the driver about how fast they are going.
School example: A robot uses a distance sensor to see if it is close to a wall, then stops.
Home example: A refrigerator's thermostat gives feedback about the inside temperature.
Nigerian example: A drone uses a GPS sensor to get feedback on its position and adjust its flight path.
+------------------------------------------+ | Feedback Loop | |------------------------------------------+ | | | +---------+ | | | Robot | → → → → Action | | | does | | | | action | | | +---------+ | | | | | v | | +---------+ | | | Sensor | → → → Feedback | | | measures| | | | result | | | +---------+ | | | | | v | | +---------+ | | | Compare | → → → Adjust | | | desired | | | | vs | | | | actual | | | +---------+ | | | | This loop repeats continuously. | +------------------------------------------+
Mini summary: Feedback is information from sensors about the result of an action. It allows the robot to correct itself.
Definition: Sensors used in control systems measure things like distance, angle, speed, temperature, or light. They provide the feedback needed for closed‑loop control.
Why it's important: The right sensor is essential for good control. You can't control what you can't measure.
Simple explanation: Sensors are like your eyes and ears – they tell the robot what is happening.
Real‑life example: A gyroscope sensor measures rotation and helps a robot balance.
School example: A line‑following robot uses a light sensor to see the line.
Home example: A smart thermostat uses a temperature sensor.
Nigerian example: A soil moisture sensor tells a farm robot when to water.
+------------------------------------------+ | Common Sensors for Control | |------------------------------------------+ | - Encoder: measures wheel rotation | | - Gyroscope: measures tilt/rotation | | - Accelerometer: measures acceleration | | - Distance sensor: measures how far | | - Light sensor: measures brightness | | - Temperature sensor: measures heat | | - Current sensor: measures motor current | +------------------------------------------+
Mini summary: Sensors give robots the information they need to control themselves accurately.
Definition: Let's see feedback in action: a robot wants to drive exactly 1 meter. It starts moving, uses an encoder to measure distance, and stops when it reaches 1 meter.
Why it's important: This shows how closed‑loop control works in practice.
Simple explanation: The robot says "I want to go 1 meter." It moves, checks the encoder, and if it's not at 1 meter, it keeps going. When it reaches 1 meter, it stops.
Real‑life example: A printer feeds paper until a sensor detects the edge, then stops.
School example: A robot moves until its touch sensor hits a wall.
Home example: A washing machine fills with water until a float sensor tells it to stop.
Nigerian example: A water pump fills a tank until a float sensor shuts it off.
+------------------------------------------+ | Feedback Example – Moving 1 Meter | |------------------------------------------+ | Desired: 1 meter | | ↓ | | Robot moves forward | | ↓ | | Encoder reads: 0.5 meters | | ↓ | | Is it 1 meter? No → keep moving | | ↓ | | Encoder reads: 1.0 meters | | ↓ | | Is it 1 meter? Yes → stop! | | | | The robot stops exactly at 1 meter. | +------------------------------------------+
Mini summary: Feedback works by checking the actual result against the desired result and adjusting until they match.
Definition: Proportional control (P) is a type of control where the correction is proportional to the error. If the error is large, the correction is large; if the error is small, the correction is small.
Why it's important: Proportional control is the simplest and most common part of PID control. It helps the robot react quickly.
Simple explanation: Imagine you are driving a car and you see you are 10 km/h too slow. You press the accelerator a lot. If you are only 2 km/h too slow, you press it a little. That's proportional control.
Real‑life example: A cruise control in a car: if the car is far below the set speed, the throttle opens wide; if it's close, it opens less.
School example: A robot arm that moves faster when it is far from the target and slower as it gets close.
Home example: A faucet where you turn it more if the water is too cold and less if it's just a little cold.
Nigerian example: A generator's throttle that adjusts more when the load is high and less when the load is low.
+------------------------------------------+ | Proportional Control (P) | |------------------------------------------+ | Error = Desired - Actual | | Correction = Kp × Error | | | | Kp is the proportional gain. | | Larger Kp = stronger reaction. | | | | Example: | | Desired = 100 cm, Actual = 80 cm | | Error = 20 cm | | Kp = 0.5 | | Correction = 0.5 × 20 = 10 cm/s | | Robot moves faster to close the gap. | +------------------------------------------+
Mini summary: Proportional control makes corrections proportional to the error. Big error = big correction, small error = small correction.
Definition: Integral control (I) looks at the accumulated error over time. If the robot has been wrong for a long time, the integral control increases the correction to eliminate the steady error.
Why it's important: Integral control removes the steady error that proportional control alone might leave. It makes the robot more accurate.
Simple explanation: Imagine you are holding a cup under a tap. If the tap is dripping, you have to keep adjusting. Integral control remembers the drips and turns the tap a bit more to stop them.
Real‑life example: A thermostat that keeps turning on the heater more if the temperature stays below the set point for too long.
School example: A robot that slowly adjusts its direction if it keeps drifting off line.
Home example: A water heater that compensates for heat loss by adding extra heat over time.
Nigerian example: A solar water heater that slowly adjusts to maintain temperature despite changing sunlight.
+------------------------------------------+ | Integral Control (I) | |------------------------------------------+ | Error = Desired - Actual | | Integral = Integral + Error × dt | | Correction = Ki × Integral | | | | Ki is the integral gain. | | It accumulates error over time. | | | | Example: | | Error = 2 cm for 5 seconds | | Integral = 2 × 5 = 10 cm·s | | Ki = 0.1 | | Correction = 0.1 × 10 = 1 cm/s | | Adds extra correction to eliminate | | persistent errors. | +------------------------------------------+
Mini summary: Integral control remembers past errors and corrects for them, eliminating steady offsets.
Definition: Derivative control (D) looks at how fast the error is changing. If the error is changing quickly, it applies a correction to slow down the change, preventing overshoot.
Why it's important: Derivative control predicts the future and dampens oscillations. It makes the robot's movement smoother.
Simple explanation: Imagine you are catching a ball. You don't just react to where the ball is – you predict where it will be. That's derivative control.
Real‑life example: A car's adaptive cruise control that slows down more sharply if the car ahead brakes hard.
School example: A robot arm that slows down as it approaches the target to avoid banging into it.
Home example: A drone that adjusts its rotors to prevent sudden tilts.
Nigerian example: A balancing robot that uses derivative control to stay upright.
+------------------------------------------+ | Derivative Control (D) | |------------------------------------------+ | Error = Desired - Actual | | Derivative = (Error - Previous_Error) / dt| | Correction = Kd × Derivative | | | | Kd is the derivative gain. | | It reacts to the rate of change. | | | | Example: | | Error = 5 cm, Previous_Error = 10 cm | | dt = 1 s | | Derivative = (5 - 10) / 1 = -5 cm/s | | Kd = 0.2 | | Correction = 0.2 × (-5) = -1 cm/s | | Applies a correction to slow down the | | change (prevents overshoot). | +------------------------------------------+
Mini summary: Derivative control reacts to the speed of change, predicting the future and smoothing movement.
Definition: PID stands for Proportional, Integral, Derivative. It combines all three to give the robot the best possible control. P reacts to the error, I corrects for accumulated error, and D predicts the future.
Why it's important: PID is the most popular control algorithm. It works for many robots – from line followers to drones to robot arms.
Simple explanation: Think of P as the strong, immediate reaction; I as the patient accumulator; and D as the smooth predictor. Together they make the robot perfect.
Real‑life example: A self‑balancing scooter uses PID to stay upright.
School example: A robot that follows a line and stays perfectly on it.
Home example: A cruise control in a car that maintains speed precisely.
Nigerian example: A drone that hovers steadily in windy conditions.
+------------------------------------------+ | PID Control Formula | |------------------------------------------+ | Correction = Kp × Error | | + Ki × Integral | | + Kd × Derivative | | | | Each gain (Kp, Ki, Kd) must be tuned. | | | | Together they give smooth, accurate, | | and responsive control. | +------------------------------------------+
Mini summary: PID control combines P (reaction), I (accumulation), and D (prediction) for the best control.
Definition: Tuning means adjusting the gains (Kp, Ki, Kd) until the robot behaves perfectly. It's like adjusting the volume on a radio – too loud or too soft until it's just right.
Why it's important: Poor tuning makes the robot sluggish or wobbly. Good tuning makes it fast and stable.
Simple explanation: You try different values and see how the robot responds. You increase Kp if the robot is too slow, increase Kd if it overshoots, and increase Ki if it has a steady error.
Real‑life example: A technician adjusts the gains on a robotic arm to make it move smoothly.
School example: Students experiment with different gains to make a line follower track the line best.
Home example: You adjust the thermostat's settings to get the right temperature quickly.
Nigerian example: An engineer tunes a drone's PID for stable flight in windy conditions.
+------------------------------------------+ | Tuning Tips | |------------------------------------------+ | 1. Start with all gains at zero. | | 2. Increase Kp until the robot | | starts to oscillate (wobble), | | then reduce it slightly. | | 3. Increase Kd to reduce overshoot | | and wobble. | | 4. Increase Ki to eliminate steady | | error, but not too much to avoid | | instability. | | 5. Test and repeat. | +------------------------------------------+
Mini summary: Tuning a PID controller involves adjusting Kp, Ki, Kd until the robot performs well.
Definition: Control systems are essential for navigation. A robot needs to control its speed, direction, and position accurately.
Why it's important: Without control, navigation would be inaccurate – the robot would drift off the path.
Simple explanation: A navigation control system uses sensors (like encoders and compass) to keep the robot on track and adjust for errors.
Real‑life example: A self‑driving car uses control systems to stay in its lane.
School example: A robot uses a line sensor to correct its steering.
Home example: A robot vacuum uses control to follow a cleaning pattern.
Nigerian example: A drone uses control systems to hold its position in the air.
+------------------------------------------+ | Navigation Control | |------------------------------------------+ | Desired Path → Control → Actuators | | ↑ | | | | | Sensors (GPS, encoder) | | | | The robot constantly checks its | | position and corrects to stay on path. | +------------------------------------------+
Mini summary: Navigation uses control systems to keep the robot on its intended path.
Definition: A robot arm needs precise control to move to exact positions. PID control is often used to make the arm move smoothly and stop exactly where needed.
Why it's important: Robot arms are used in manufacturing, surgery, and more. Accuracy is critical.
Simple explanation: The arm's control system reads the angle of each joint and adjusts the motors to reach the target angle.
Real‑life example: A robotic arm in a factory welds car parts with precision.
School example: A robot arm that moves a block from one spot to another.
Home example: A robot arm in a kitchen that flips pancakes.
Nigerian example: A robot arm used in a local factory to assemble electronics.
+------------------------------------------+ | Robot Arm Control | |------------------------------------------+ | Target Angle → PID → Motor → Arm moves | | ↑ | | | | | Encoder (angle sensor) | | | | The arm adjusts until it reaches the | | exact angle. | +------------------------------------------+
Mini summary: Robot arms use control systems to move precisely to desired positions.
Definition: Drones need to control their balance, altitude, and direction. They use PID control to adjust the speed of each rotor to stay stable.
Why it's important: Without control, a drone would tumble out of the sky. Control systems keep it flying smoothly.
Simple explanation: The drone's sensors measure tilt and rotation. The controller adjusts each motor's speed to keep the drone level.
Real‑life example: A camera drone that hovers steadily to take sharp photos.
School example: A small drone that can hover and move in different directions.
Home example: A toy drone that is easy to fly.
Nigerian example: A drone used for aerial mapping in agriculture.
+------------------------------------------+ | Drone Control | |------------------------------------------+ | Desired Attitude → PID → Motor Mixer | | ↑ | | | | | IMU (gyro + accelerometer) | | | | The drone adjusts motor speeds to | | maintain its orientation. | +------------------------------------------+
Mini summary: Drones use control systems to maintain balance and follow flight commands.
In this module, we learned about control systems – the internal coaches that make robots steady and precise. We discovered the difference between open‑loop (no feedback) and closed‑loop (with feedback) control. We explored feedback and how sensors provide the information robots need. We then broke down PID control into its three parts: Proportional (reacts to error), Integral (accumulates error), and Derivative (predicts change). We learned how to tune a PID and applied control systems to navigation, robot arms, and drones. You now understand how robots keep themselves in check – you are ready to make your robots smarter and more stable!
Concept 1: Open‑loop is simple but inaccurate; closed‑loop is accurate but more complex.
Concept 2: Feedback is the key to closed‑loop control – it tells the robot what happened.
Concept 3: PID control combines three actions: Proportional (reaction), Integral (memory), and Derivative (prediction).
Concept 4: Tuning is essential – the right gains make the robot perfect.
How to implement a simple PID controller:
How to tune a PID controller:
We've seen many real‑life examples in the lessons, such as thermostats, self‑driving cars, cruise control, robot arms, and drones. These show how control systems are everywhere.
In Nigeria, control systems are used in solar trackers, generator voltage regulators, agricultural drones, and factory automation. Nigerian engineers are increasingly using PID control in robotics projects for agriculture and security.
Imagine you are balancing a broomstick on your hand. If it leans left, you move your hand left to catch it. That's like proportional control – you react to the error.
Another fun example: A robot that kicks a ball. It uses feedback to adjust its leg's position to hit the ball accurately.
Key points: Emphasise the concept of feedback using everyday analogies. Use hands‑on demonstrations with simple robots (line followers, balancing robots). Explain PID gradually – start with P, then add I and D. Use simulations if possible.
Activity idea: Have students write a simple PID algorithm in pseudocode and test it with a simulated robot.
Parents can help children explore control systems by building simple balancing robots or line followers. Encourage them to experiment with different gains. Discuss how control systems are used in household appliances. Support their curiosity and help them understand that tuning is a process of trial and error.
Did you know that a PID controller can be implemented in just a few lines of code? Many microcontrollers have libraries for PID control.
Did you know that some robots use machine learning to automatically tune their PID gains – they learn the best tuning by themselves!
+------------------------------------------+ | PID Control Block Diagram | |------------------------------------------+ | +---------+ +-------+ +-------+ | | | Setpoint | --> | PID | --> | Plant | | | | (desired)| |Control| |(robot)| | | +---------+ +-------+ +-------+ | | ↑ | | | | v | | +------+ +-------+ | | |Error | |Sensor | | | +------+ +-------+ | | | | | | +------------------+ | | | | The error = setpoint - sensor reading | | PID calculates output to drive error | | to zero. | +------------------------------------------+ +------------------------------------------+ | PID Response Comparison | |------------------------------------------+ | Only P: Fast but overshoots | | P + D: Less overshoot, smoother | | P + I: No steady error, but may wobble | | P + I + D: Perfect! Smooth and precise | +------------------------------------------+
| Control Type | Feedback? | Accuracy | Complexity |
|---|---|---|---|
| Open‑loop | No | Low | Very simple |
| Closed‑loop | Yes | High | Moderate |
| PID | Yes | Very high | More complex |
| Control Term | Effect | If too high |
|---|---|---|
| P (Proportional) | React to error | Oscillation |
| I (Integral) | Correct steady error | Overshoot, instability |
| D (Derivative) | Dampen changes | Slow response, noise |
In this module, we explored the world of robot control systems. We learned that a control system is like a coach that watches the robot's performance and corrects it. We distinguished between open‑loop (no feedback) and closed‑loop (with feedback) control. We understood that feedback from sensors is the key to closed‑loop control. We then dived into the PID controller, which combines Proportional (reaction), Integral (memory), and Derivative (prediction) to give smooth and accurate control. We learned how to tune a PID and saw how control systems are used in navigation, robot arms, and drones. You now have the knowledge to keep your robots stable, precise, and responsive!
Match the control term with its description.
| Term | Description |
|---|---|
| Proportional | a) Reacts to the rate of change |
| Integral | b) Reacts to current error |
| Derivative | c) Remembers past errors |
| Open‑loop | d) No feedback |
| Closed‑loop | e) Uses feedback |
Answers: Proportional – b, Integral – c, Derivative – a, Open‑loop – d, Closed‑loop – e
Scenario 1: You have a robot that drives in a straight line, but it keeps drifting to the right. What type of control would you use to fix this and why?
Scenario 2: You are building a drone that hovers at a fixed height. Describe the sensors and control system you would use to maintain that height.
"Tune a PID Controller" – In groups of 4, simulate a PID controller for a robot that needs to reach a target distance. Use a spreadsheet or a simple program to test different gains (Kp, Ki, Kd). Observe the response (overshoot, steady error, oscillation) and find the best tuning. Present your findings.
Write a simple PID algorithm in pseudocode for a robot that maintains a set speed. Include the calculation of error, proportional, integral, and derivative terms, and the output to the motor.
"Build a PID‑Controlled Line Follower" – Build a line‑following robot that uses PID control to stay on the line. Tune the gains for smooth following. Record a video of your robot following a curved line.
Use an Arduino or micro:bit to implement a simple PID controller for a motor to reach a target position using an encoder. Measure the response and adjust the gains.
"Self‑Balancing Robot" – Build a two‑wheeled balancing robot using a gyroscope and accelerometer. Implement a PID controller to keep the robot upright. Tune the gains for stable balance.
In Module 7, we will explore Robot Programming Languages. You will learn about different programming languages used in robotics, from C++ to Python to specialized robot languages. We will compare them and help you choose the right one for your project. Get ready to code like a robot engineer!