Designing My Self-Driving Car

22 Jun 2020 . category: projects . Comments

#3d-printing #arduino #code #project #python

Last Updated July 1st

This year, Hack Club (A global network of code-loving high-school students) started something called Summer of Making, challenging members to learn more about tech and create cool hardware projects. I decided to use the opportunity to create something I’ve always wanted to make - a model self-driving car, inspired by the Donkey Car Project.

Right now, I’m in the process of designing and building the car - which includes a 3d-printed chassis and frame, and a custom i2c control circuit. I will be writing about the process in detail here, but posting short updates and photos on the Summer of Making scrapbook.

The RC car

Originally, I had wanted to The Donkey Car project is based on a pre-built RC car from Exceed RC, but I wanted to build my own RC car from scratch to add to the challenge. I know that 3d printed materials (especially PLA) tend to be quite brittle - so I have no idea how well a 3d-printed car will hold together after crashes. But videos of 3d-printed RC cars show them performing quite well, and I will mostly be driving my car indoors - so I decided I’d give it a try. I started on Thigiverse, and found a few good designs I like:

I’m think that I’ll probably go with a modified version of the touring car, which is nice because it’s 1/10 scale, and seems to have a nice mix of metal parts and 3d-printed parts. However, I will probably use a brushed motor rather than the sensored brushless motor.

For model self-driving cars, brushless motors are bad because they aren’t good for slow speeds (this is because, without brushes, there is nothing to physically slow/stabilize the armature in the motor). self-driving cars need to be able to drive slowly for training (plus you probably don’t want your AI driving your car at super-fast speeds…). Sensored brushless motors are fine because the sensors make the motors very good at all speeds, but they are a lot more expensive than brushed motors.

The ESC and IO board

RC cars use what’s called an ESC, or Electronic Speed Controller, to control the speed of the motor with input from the radio reciever. For brushless motors, ESCs are slightly more complicated, but for brushed motors the ESC’s job can be as simple as taking the PWM input from the reciever and mapping it to PWM output to the motor. For example, with a PWM cycle of 50% ON from the reciever might mean that the motor is supposed to be off - so the ESC outputs nothing to the motor.

Donkey car uses a i2c servo board to convert an i2c signal from the raspberry pi into servo singnals for the motor and steering servo. But this is redundant because the pwm signal from the i2c board to the ESC isn’t needed. So I decided to create my own custom IO control board and ESC. Of course, I could just get a standard motor controller or h-brdige to eliminate this redundancy, but I didn’t want to be limited to just using i2c to control my RC car.

My ESC board uses an Atmega328, the most common and popular Arduino chip, in combination with an H-bridge chip and voltage regulator. Initially, I’m going to implement it on a breadboard so that I can adjust it or add more parts (perhaps headers for a robotic arm or speakers?) if needed. I’ll probably move it onto a pcb later.

After giving it some more thought, I’ve realized that I might want to later add things such as a gimballed camera mount or robotic arm. For this, I’d need lots more servos - so I decided to design my control board so that it could drive up to 11 more servos in the future.

That’s all for now - but I’ll continue updating this as I work on this project! My next steps will be customizing and 3d-printing the car parts and designing the schematic for the control board.