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
Computing Platform
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
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
- Standard USB camera
- Easy to connect
- Set
CAMERA_TYPE = "WEBCAM"in config
- 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
- 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)
DC_TWO_WHEEL)
- Tank-style steering
- Two motors (left/right)
- Uses H-Bridge motor driver (L298N)
DC_STEER_THROTTLE: DC motor for steeringSERVO_HBRIDGE_2PIN: Servo + 2-pin H-BridgeSERVO_HBRIDGE_3PIN: Servo + 3-pin H-BridgeVESC: 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
Additional Components
Required- Power supply (5V for Pi, battery for motors)
- MicroSD card (16GB+ for Pi)
- Jumper wires and connectors
- 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
- VCC → 5V (Pin 2 or 4)
- GND → Ground (Pin 6, 9, 14, 20, 25, 30, 34, or 39)
- SDA → GPIO 2 (Pin 3)
- SCL → GPIO 3 (Pin 5)
- Channel 0: Typically for throttle (ESC)
- Channel 1: Typically for steering (servo)
- Connect 5-6V to V+ terminal for servo/ESC power
- Do NOT connect Pi 5V to V+ (they should have separate supplies)
Never connect the motor battery directly to the Raspberry Pi. Use a voltage regulator or separate 5V supply.
Configuration Pin Mappings
Standard PWM_STEERING_THROTTLE Setup
Pin Format Explained
The pin format"PCA9685.1:40.0" means:
PCA9685: Controller type1: I2C bus number40: 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
- Enable I2C in
raspi-config - Check wiring connections
- Verify 5V power to PCA9685
- Check battery charge
- Verify ESC/servo connections to PCA9685
- Ensure V+ on PCA9685 is powered (5-6V)
- Test with original RC receiver first
- 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
