Overview
Building a Donkeycar requires assembling hardware components on an RC car chassis. This guide covers the recommended components and assembly process.
Recommended Hardware Components
Raspberry Pi (Recommended)
- Raspberry Pi 4 (2GB+ RAM recommended)
- Raspberry Pi 3 B+ (minimum)
- Compatible with RaspberryPi OS
- Powers the car’s AI and control systems
The Raspberry Pi is the preferred on-board computer for Donkeycar. If you’re new to Raspberry Pi, set it up using Raspberry Pi Imager and familiarize yourself with raspi-config before building your car.
Camera Options
Donkeycar supports multiple camera types:
Raspberry Pi Camera (PICAM)
- CSI interface camera
- Low latency, reliable
- Most common choice
- Set
CAMERA_TYPE = "PICAM" in config
USB Webcam
- Standard USB camera
- Easy to connect
- Set
CAMERA_TYPE = "WEBCAM" in config
Advanced Options
- CSIC: High-speed CSI camera (e.g., Arducam)
- D435: Intel RealSense D435 with depth sensing
- OAKD: Luxonis OAK-D with depth and IMU
- CVCAM: OpenCV-compatible camera
Motor Controllers
PCA9685 PWM Driver (Most Common)
- 16-channel PWM controller
- I2C interface (address typically
0x40)
- Controls both steering servo and ESC (Electronic Speed Controller)
- Requires calibration of PWM pulse values
Alternative Controllers
- RoboHat MM1: Integrated controller for Raspberry Pi
- Direct PWM Pins: Using Raspberry Pi GPIO
- PiGPIO: Hardware PWM using pigpio daemon
Drive Train Types
Your configuration depends on your chassis:
Standard RC Car (PWM_STEERING_THROTTLE)
- Steering servo + ESC
- Most common setup
- Typical PWM range: 200-500 (12-bit values)
Differential Drive (DC_TWO_WHEEL)
- Tank-style steering
- Two motors (left/right)
- Uses H-Bridge motor driver (L298N)
Other Options
DC_STEER_THROTTLE: DC motor for steering
SERVO_HBRIDGE_2PIN: Servo + 2-pin H-Bridge
SERVO_HBRIDGE_3PIN: Servo + 3-pin H-Bridge
VESC: VESC motor controller
Chassis
Recommended RC car platforms:
- Exceed Desert Monster: Popular choice
- Magnet 1/16 Scale Rally Car: Affordable option
- Traxxas: Higher-end, durable
- Custom 3D-printed chassis: For advanced users
Make sure your chassis has enough space for the Raspberry Pi, motor controller, and battery. A 1/10 or 1/16 scale RC car is ideal.
Additional Components
Required
- Power supply (5V for Pi, battery for motors)
- MicroSD card (16GB+ for Pi)
- Jumper wires and connectors
Optional Sensors
- IMU (Inertial Measurement Unit): MPU6050 or MPU9250
- LIDAR: RP or YD LIDAR for obstacle detection
- GPS: For path following
- Encoders: For odometry and speed measurement
Assembly Steps
Configuration Pin Mappings
Standard PWM_STEERING_THROTTLE Setup
The pin format "PCA9685.1:40.0" means:
PCA9685: Controller type
1: I2C bus number
40: I2C address (0x40 in hex)
0: Channel number (0-15)
Camera Configuration
Verifying Your Setup
Troubleshooting
Camera not detected
- Verify cable connection to CSI port
- Enable camera in
raspi-config
- Check:
vcgencmd get_camera
I2C device not found
- Enable I2C in
raspi-config
- Check wiring connections
- Verify 5V power to PCA9685
Motors not responding
- Check battery charge
- Verify ESC/servo connections to PCA9685
- Ensure V+ on PCA9685 is powered (5-6V)
- Test with original RC receiver first
Servo jitters or behaves erratically
- Add capacitor across PCA9685 power supply
- Check for loose connections
- Verify PWM frequency (typically 60Hz)
Next Steps
Once your hardware is assembled:
- Create your car application with
donkey createcar
- Calibrate steering and throttle
- Start driving and collecting data
Additional Resources