Autonomous 1/10 Scale Racecar Design

This project was part of the course Mechatronic Design Laboratory (EE 192) taught by Prof. Ronald Fearing at UC Berkeley in the spring of 2016. I worked with two other graduate students to design an autonomous car that could follow a track defined by a white line.

We were given a 1/10 scale chassis, as well as the following electronic components: line-scanning camera, DC motor, optical encoders, steering servo motor, mbed FRDM-KL25Z microcontroller, and 7.4V battery. We were tasked to do the following:

  • Design the circuitry for the power conditioning, motor driver, steering, and sensing (aka, no breakout boards).
  • Design a mounting system for the hardware.
  • Program the microcontroller to read data from the line-scanning camera and encoders; track the line and estimate velocity; and command the steering servo and DC motor.

I led the hardware design and manufacturing. I considered weight distribution, camera vantage, adjustability, and assembly time. I designed and laser cut acrylic mounting boards for our PCBs and electronic components. I also machined posts to form the struts and rungs of a camera tower (see image below).

Car side view

Side view of assembled car showing mounting platforms and camera tower

I also had ownership over the design of a troubleshooting board. I selected appropriate components for LEDs and buttons, and I designed the PCB using Eagle. Our team designed three PCBs in total: (1) troubleshooting board, (2) motor driver and power conditioning board, and (3) MCU shield (signal routing and breakout pins). See a schematic of our circuitry below.

Circuit block diagram

Circuit block diagram

I worked closely with my team members to program our microcontroller. We programmed in C using the Keil uVision development environment. We broke the programming tasks into the following functions:

  • Velocity sensing: Originally interrupt reads from optical encoders, but later switched to interrupt reads of back-EMF when the encoders were unreliable
  • Velocity control: PID control of PWM duty cycle
  • Camera read: Double-beat bit banging method to read the camera and automatic gain control to adjust for varying lighting conditions
  • Track detection: Thresholded peak detection
  • Cross detection: Search for secondary peak in range outside of primary peak
  • Steering control: PD control of pulsewidth
  • Troubleshooting: Turn on LEDs based on variables of interest and receive input from buttons

I learned a great deal from this project. Correctly designing the circuitry and programming the functionality above took a great deal of troubleshooting and iteration. In our final class race, our car demonstrated excellent stability in its steering and velocity control. However, our automatic gain control was not responsive enough, and our car lost the track on a shaded segment. You can watch the race (scroll to 14:50). You can also peruse our final presentation.

Through this course project, I gained experience in the following areas:

  • PCB design using Eagle
  • Soldering of small components
  • Circuit troubleshooting using an oscilloscope
  • DC motor and servo motor control
  • Back-EMF velocity sensing
  • Programming in C

Thank you to Prof. Fearing and the teaching staff! Thank you also to my teammates, Brian Cera and Edward Zhu.

EE 192 class photo

EE 192 class photo

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s