Sensors & Actuators
In the last lesson, we said every robot has sensors, actuators, and software. Now let's look at the first two in detail — because understanding your hardware is the foundation of everything else.
Sensors: How Robots See
A sensor converts physical phenomena into electrical signals that software can process. Let's explore the most important ones.
Cameras
A camera captures a grid of pixels, each with red, green, and blue intensity values. A 640×480 camera produces 640 × 480 × 3 = 921,600 numbers every frame. At 30 frames per second, that's about 27 million values per second.
Cameras are incredibly versatile — they're used for object detection, lane following, visual SLAM, gesture recognition, and more. But they have weaknesses:
- Lighting dependent — struggle in darkness or direct sunlight
- No direct depth — a single camera can't tell if something is 1 meter or 10 meters away
- Computationally expensive — processing images requires significant compute
LiDAR
LiDAR (Light Detection And Ranging) fires laser pulses and measures the time they take to bounce back. Since light travels at a known speed, this gives precise distance measurements.
A typical 2D LiDAR scans 360° around the robot, producing a "ring" of distance measurements. 3D LiDARs stack multiple layers vertically, creating a point cloud — a 3D map of the environment.
| Property | Camera | LiDAR |
|---|---|---|
| Output | 2D pixel grid (image) | 3D point cloud |
| Range | 1-100m (depends on lens) | 1-200m typical |
| Lighting | Needs ambient light | Works in total darkness |
| Cost | $10-$500 | $100-$75,000 |
| Best for | Recognition, classification | Mapping, obstacle detection |
IMU (Inertial Measurement Unit)
An IMU combines:
- Accelerometer — measures linear acceleration (how fast you're speeding up)
- Gyroscope — measures angular velocity (how fast you're rotating)
- Sometimes a magnetometer — measures magnetic field (compass heading)
IMUs are small, cheap, and fast. They're in your phone, your drone, and almost every robot. The catch? They drift over time. A gyroscope accumulates small errors, and after a few minutes, it might think the robot has rotated 5° when it actually rotated 3°. That's why IMUs are usually combined with other sensors.
Encoders
Wheel encoders measure rotation by counting ticks as a wheel turns. If you know the wheel's circumference and count 100 ticks per revolution, you can calculate exactly how far the wheel has traveled.
Encoders are incredibly precise for short distances but accumulate error over time — if a wheel slips on a wet surface, the encoder doesn't know. This is called odometry drift.
All sensors have limitations. The art of robotics is combining multiple sensors so their strengths compensate for each other's weaknesses. This is called sensor fusion, and we'll cover it in Module 4.
Actuators: How Robots Move
Actuators convert electrical signals into physical motion. Here are the main types you'll encounter.
DC Motors
The workhorse of robotics. Apply voltage, the shaft spins. Reverse voltage, it spins the other way. Speed is proportional to voltage.
DC motors are simple and cheap but imprecise — you can't easily command "rotate exactly 90 degrees" without additional hardware (like an encoder).
Servo Motors
A servo is a DC motor with built-in position feedback. You command an angle (like 45°), and the servo's internal controller adjusts until it reaches that position. Most hobby servos have a limited range (0-180°), but continuous rotation servos exist too.
Servos are used everywhere: robot arm joints, camera gimbals, steering mechanisms, and robot grippers.
Stepper Motors
Steppers divide a full rotation into discrete steps (typically 200 per revolution = 1.8° per step). You can command exact positions without feedback because each step is precise.
They're great for 3D printers and CNC machines but not ideal for fast-moving robots — they lose torque at high speeds and can "miss" steps under heavy load.
Linear Actuators
These convert rotational motion to linear (push/pull) motion. A lead screw inside converts the motor's spinning into straight-line travel. Used for grippers, lift mechanisms, and adjustable-height platforms.
When choosing an actuator, consider: speed (how fast it needs to move), torque (how much force it needs to exert), precision (how accurate the position needs to be), and cost (your budget).
Putting It Together
Here's a real-world example: a warehouse robot picking up boxes.
| Component | Role |
|---|---|
| Camera (RGB) | Identify box labels, estimate position |
| LiDAR (2D) | Map the warehouse, detect obstacles |
| IMU | Track orientation during navigation |
| Wheel encoders | Measure distance traveled |
| DC motors (wheels) | Drive around the warehouse |
| Servo motors (arm) | Position the arm to grab a box |
| Linear actuator (gripper) | Open and close the gripper |
Each sensor produces data that software processes, and each actuator receives commands that software generates. The software is the glue — and that's what we'll focus on in the next lesson.
What's Next?
We've got the hardware. Now we need software to connect sensors to actuators. In the next lesson, we'll look at how modern robot software is organized — and why it's built from small, independent modules that talk to each other.