Robots often need two kinds of brains working together. A microcontroller is excellent at fast, predictable control of motors, sensors, and electrical signals. A single-board computer, or SBC, is better for heavy computing tasks such as vision, mapping, and decision making.
Understanding the difference helps you design robots that are reliable, responsive, and powerful.
Understanding Robotics: Microcontroller vs SBC
Real time does not simply mean fast. It means that a task finishes within a known deadline, every time. Consider a balancing robot.
Its controller must notice a small tilt, calculate a correction, and change motor power before the robot falls farther. A delay that changes from one cycle to the next creates jitter. Jitter can make movement shaky even when the average speed of the processor seems high.
Microcontrollers usually run one focused program with direct access to hardware timers. A timer can trigger sensor readings at regular intervals, so the robot receives measurements spaced evenly in time. This steady rhythm matters for motor speed control, servo positioning, drone stabilization, and wheel odometry.
An SBC handles jobs whose completion time can vary without immediately causing physical trouble. A camera frame may take longer to process when a scene has more objects or poor lighting. A mapping program may need to search a large stored map.
These tasks use memory, file storage, networking, and software libraries that are hard to fit on a small controller. The operating system on an SBC shares processor time among many programs. It may pause one program briefly to handle network traffic, save data, or run another service.
That is useful for complex software, but it makes exact timing less certain. For a robot, a late image result is often acceptable. A late motor correction may not be.
The two boards need a clear way to exchange information. The SBC might send a target speed or a direction command several times each second. The microcontroller then turns that request into rapid electrical updates for the motor driver.
It can report back wheel counts, battery voltage, button states, and fault messages. Serial links, I squared C, SPI, CAN, and USB are common connections. Each has different speed, wiring, and reliability limits.
Students should think about what happens when a message is delayed, corrupted, or missing. A good design gives commands a timeout. If fresh commands stop arriving, the motor controller slows down or stops instead of continuing blindly.
Safety should stay close to the hardware that can cause motion. An emergency switch, an overcurrent reading, or a limit switch should be able to stop a motor without waiting for vision software or a wireless connection. Power is important too.
Motors create electrical noise and can pull large currents when starting. If that causes the SBC voltage to dip, it may restart while the robot is moving. Separate power regulation, shared ground connections, fuses, and proper motor drivers reduce these problems.
When learning, measure real timing with timestamps or a logic analyzer rather than trusting a program delay. Test one part at a time.
First read a sensor, then drive a motor safely, then send commands between boards. This method makes faults easier to find.
Key Facts
- Microcontrollers are best for real-time I/O because they can read sensors and update motors with predictable timing.
- SBCs are best for high-level processing because they have faster CPUs, more memory, and can run full operating systems.
- Control loop frequency is f = 1/T, where T is the loop period in seconds.
- A 1 ms control loop has f = 1/0.001 = 1000 Hz, which is typical of fast motor control.
- Data rate can be estimated by data rate = samples per second x bytes per sample x number of channels.
- A common robot design uses the SBC for planning and perception, while the microcontroller handles motor control, encoders, servos, and safety shutoff.
Vocabulary
- Microcontroller
- A small computer on a chip designed to control hardware pins, sensors, and actuators with predictable timing.
- Single-board computer
- A complete computer built on one circuit board, usually capable of running an operating system and complex software.
- Real-time I/O
- Input and output that must happen within strict timing limits so a system responds correctly.
- Control loop
- A repeated process in which a robot reads sensors, computes an action, and updates actuators.
- Operating system
- Software that manages hardware resources and allows programs to run on a computer.
Common Mistakes to Avoid
- Using an SBC alone for precise motor timing is a mistake because a general-purpose operating system can delay tasks unpredictably.
- Choosing a microcontroller for camera-based vision is a mistake because most microcontrollers lack the memory and processing power needed for image analysis.
- Ignoring communication delay between boards is a mistake because commands sent from the SBC to the microcontroller may arrive too slowly for fast control loops.
- Connecting motors directly to logic pins is a mistake because microcontroller and SBC pins cannot supply the current needed by motors and can be damaged.
Practice Questions
- 1 A microcontroller runs a motor control loop every 2 ms. What is the control loop frequency in hertz?
- 2 A robot has 4 distance sensors sampled at 200 samples per second. Each sample is 2 bytes. What is the total sensor data rate in bytes per second?
- 3 A robot must follow a line while also recognizing objects with a camera. Which tasks should be assigned to the microcontroller and which to the SBC, and why?