A modern quad-core single-board computer running at 2.4 GHz with up to 8 GB RAM, PCIe connectivity, and a dedicated I/O controller eliminates the latency jitter that plagued earlier GPIO-heavy robotics projects. This guide covers everything from first boot to driving motors and reading sensors.
Hardware You Will Need
A single-board computer (4 GB or 8 GB RAM), a 27 W USB-C power supply, 32 GB+ microSD (A2 rated), active cooling case, an L298N or TB6612FNG motor driver module, DC gear motors or stepper motors, breadboard and jumper wires, an HC-SR04 ultrasonic sensor or an IMU module (optional for early testing).
First Boot and OS Setup
Flash a 64-bit Linux image using the vendor's imaging tool. Enable SSH and set hostname/wifi credentials before flashing. On first boot, run `sudo apt update && sudo apt full-upgrade -y`. Install GPIO libraries: `sudo apt install python3-lgpio python3-rpi.lgpio`. Newer boards use the `lgpio` library — older GPIO libraries will not work without a compatibility shim.
GPIO Pinout and Safety
Most current-generation boards expose 28 usable GPIO pins on a 40-pin header, all operating at 3.3 V logic. Never apply 5 V to GPIO inputs — most boards have no over-voltage protection on the I/O controller. Use a logic-level shifter when interfacing with 5 V sensors. Maximum current per GPIO pin is typically 16 mA; total GPIO header draw must not exceed 50 mA. Always power motors through a dedicated driver board, never directly from GPIO.
PWM Motor Control with TB6612FNG
Wire PWMA to GPIO18 (hardware PWM), AIN1 to GPIO23, AIN2 to GPIO24, STBY to GPIO25. In Python, use `lgpio` to set PWM frequency to 1000 Hz. Control direction by toggling AIN1/AIN2: both low = brake, AIN1 high + AIN2 low = forward, AIN1 low + AIN2 high = reverse. Duty cycle (0–100) maps to motor speed. The TB6612FNG handles up to 1.2 A continuous per channel with 3.2 A peak — sufficient for most micro and mini robot platforms.
I2C Sensor Integration
Enable I2C in the board's interface configuration menu. Install smbus2: `pip install smbus2`. A typical IMU module connects to SDA (GPIO2) and SCL (GPIO3) at 3.3 V. Default I2C address is 0x68. Read acceleration and gyro data by querying the device register map. Verify detection with `i2cdetect -y 1`.
Power Management
A high-performance single-board computer can draw up to 5 A at 5 V under full CPU load with peripherals. On a mobile robot, power the board from a dedicated 5 V / 5 A BEC (Battery Eliminator Circuit) separate from your motor supply. Sharing a single supply causes voltage sag when motors start, triggering under-voltage throttling. Use large (220–470 µF) capacitors across the motor supply rails to suppress inductive kickback.
ROS 2 Installation
Most current Linux distributions for single-board computers support ROS 2 via the official APT repository. Add the ROS 2 GPG key, add the repository, then run `sudo apt install ros-jazzy-desktop`. Source the setup script in `.bashrc`. For a resource-constrained robot, consider `ros-jazzy-ros-base` instead of the full desktop install. Current-generation boards are capable enough to run a full navigation stack locally — earlier models required offloading compute to a more powerful host.