Make your own self-driving RC car using Python and Raspberry Pi (Part 1 - Introduction)

Zaid Mallik
4 min readOct 6, 2023

--

About

This comprehensive article chronicles my personal journey of constructing a self-driving RC car from scratch, utilising Python and Raspberry Pi as the core components. Presented in a tutorial format, this guide is designed to support both beginners and advanced learners in the world of robotics and autonomous vehicles.

The comprehensive documentation of the self-driving car project is divided into 5 distinct parts, each serving a specific purpose:

  1. Introduction(Part 0): In this initial section, I will provide a thorough explanation and guide on laying the foundational aspects of our self-driving car project. This includes insights into creating the physical track upon which our self-driving car will operate.
  2. Hardware(Part 1): This is where we roll up our sleeves and get hands-on with assembling the physical components of our car. From wiring up the motors to the H bridge to making the required jumper wire connections, This section covers it all.
  3. Software(Part 2): In this domain, we enter the digital realm and focus on the brains of our operation. Here, we work on setting up the Raspberry Pi, the central computing unit that drives our car’s decision-making process. We embark on the journey of the first boot, breathing life into our hardware setup. Furthermore, we meticulously install the necessary software that empowers our Raspberry Pi to interpret sensor data, make decisions, and control the car’s movements. It’s where the magic of automation and intelligence takes shape.
  4. Using Donkey Car (Part 3): For those looking to dive into self-driving cars without delving into the intricacies of low-level coding, I provide a step-by-step walkthrough of using the Donkey Car platform. Donkey Car offers a user-friendly and approachable method for building and training your autonomous RC car, making it an excellent choice for beginners.
  5. What is CNN? Coding Your Own FSD Model from Scratch (For Advanced Learners) (Part 4): If you’re an advanced learner or enthusiast seeking a deeper understanding of self-driving technology, I also guide you through the process of writing your own code for the RC car. This approach allows you to gain a profound insight into the inner workings of autonomous systems, making it a rewarding experience for those with programming expertise.

Together, these three parts provide a comprehensive roadmap for anyone interested in embarking on the exciting journey of building their own self-driving car. From the fundamentals to the cutting-edge, this documentation aims to empower enthusiasts with the knowledge and skills needed to take on this thrilling challenge.

Prerequisites:

Before we proceed, let’s ensure that we are on the same page by familiarizing ourselves with the following key concepts and ensuring that we have the required hardware at our disposal.

Concepts:

  1. Basic Programming Knowledge: A fundamental understanding of programming concepts and Python will be beneficial for both the Donkey Car and custom code approaches.
  2. Raspberry Pi Familiarity: Basic knowledge of Raspberry Pi, including its setup and configuration, will be essential for this project.
  3. Electronics Basics: Familiarity with basic electronics components like motors, sensors, and breadboards will come in handy, especially if you choose to build custom circuitry.

Hardware:

  1. RC Car Chassis: You’ll need an RC car chassis that is suitable for your project. Ensure it is compatible with the components you plan to use.
  2. Raspberry Pi: Obtain a Raspberry Pi board (preferably the Raspberry Pi 3 or 4) for controlling and processing data. I will be using the RPi 4 because tensorflow doesn’t seem to work in my RPi 3.
  3. Motor Controller: Depending on your chosen approach, you may need an appropriate motor controller or motor driver board.
  4. PCA9685 Servo Controller: The PCA9685 servo controller is crucial for precise control of servos, which are often used for steering and other mechanisms in self-driving RC cars.
  5. Camera: An affordable USB camera module compatible with the Raspberry Pi is essential for vision-based autonomous driving.
  6. Power Supply: Ensure you have an adequate power supply for your Raspberry Pi, motors, PCA9685 controller, and other components. Battery packs or LiPo batteries are commonly used for this purpose.
  7. Breadboard and Jumper Wires: If you plan to build custom electronics, a breadboard and jumper wires will be necessary for prototyping and connecting components.
  8. Ultrasonic Sensors (Optional): For obstacle detection and navigation, you can use ultrasonic sensors like HC-SR04.
  9. Wi-Fi Dongle (Optional): In case your Raspberry Pi doesn’t have built-in Wi-Fi, consider obtaining a Wi-Fi dongle for wireless communication.
  10. Tools: Basic tools such as screwdrivers, pliers, and a soldering iron (if required) will be useful during assembly.
  11. An Xbox Controller: To control the car while collecting data

Make sure you have these prerequisites in place before diving into the project. Having a clear understanding of the concepts and the necessary hardware will streamline the process and help you achieve success in building your self-driving RC car.

Creating the track:

Keep it as simple as you want or go all in. It entirely depends on you on what kind of track you would like.

--

--