Introduction: PiCar: Building an Autonomous Car Platform
This Instructable details the steps required to build a PiCar
What is PiCar?
PiCar is an open sourced autonomous car platform. It isn’t autonomous by itself, but you can easily add sensors to control the car with an Arduino or Raspberry Pi.
Why use PiCar instead of an RC car?
Using PiCar is very similar to using an RC car as a platform. However, PiCar gives you more control and is easier to modify than an RC car. The chassis for the PiCar is 3D printed, and you can easily edit the 3D model to add more space in the car if needed. In addition, all of the parts are either easily available online or can be 3D printed.
Who made PiCar?
PiCar was designed at Washington University in St. Louis in the lab of Humberto Gonzalez and Silvia Zhang. The car was designed in May of 2017 and was entered into a robotics competition in June. The PiCar came in the top 10 out of 30+ international teams in the Silk Road Robotics Innovations Competition at Xi'an Jiaotong University in Xi'an, China. Here is a link to a YouTube Video of FlowBot.
This instructable only details how to build a PiCar. If you would like example code to use with your PiCar, please refer to our GitHub repository to access example code and additional documentation.
Step 1: Parts List
- Brushless motor and ESC ($32.77)
- Battery ($10.23)
- Servo Motor ($6.15)
- Wheels ($28; with insert and glued to wheel)
- Axle, 6mm ($19.38)
- Hex Wheel Adapters ($3.95)
- Large Gear ($8.51)
- Pinion Gear ($5.49)
- 3 mm Bore Bearings, 8 mm Outside Diameter ($8.39)
- 2 mm Bore Bearings, 5 mm Outside Diameter ($9.98)
- Axle Bearings ($30.68)
- M3 and M2 Screws ($9.99)
- Access to a 3D printer
- ESC Programming Card ($8.40)
- Battery Charger ($24.50)
- Alan Wrench Set ($9.12)
- RC Controller with Receiver ($22.58)
- Arduino ($10.9)
- Bread Board ($6.99)
- Various Wires ($6.99)
The parts were picked using three criteria:
- Data Sheet Availability
The parts needed to function well so that they perform as desired and last a long time. They need to be easily bought online so that other people can replicate the PiCar. This is important because our lab will be making more cars in the future, and because we want the car to be readily available to people across the country. The parts need to have data sheets because we will be performing experiments with the PiCar. When performing academic experiments, it is important to know exactly what goes into the equipment you are using. Having data sheets makes the experiment replicable.
Step 2: Accessing the 3D Models
How to access the CAD files hosted on Onshape:
1. Go to https://cad.onshape.com/signin.
2. If you have been given the account details, use those credentials to sign in.
3. Otherwise, create a new account. Once your account is set up and you have logged in, go to: https://cad.onshape.com/documents/79e37a701364950... to access the Pi Car Assembly.
4. Opening the link will take you to the Pi Car Assembly file as seen in the above images. If you are using the credentials provided, you will have 'edit' access to this assembly and all the part files. If you are using a new user account, you can create a copy of the assembly and edit it that way.
5. To learn Onshape, go to https://www.onshape.com/learn/learn-cad.
6. The above image shows how to access each part, assembly, sub-assembly or drawing.
7. The best way to check the dimensions (distance or angle between parts) is to go to the respective part or assembly's drawing. Before checking the dimensions, make sure you sync the drawing with its corresponding assembly or part by clicking on the update button as seen in the above image.
8. To check a particular dimension, use the point-to-point, point-to-line, line-to-line, angle, etc. dimension tool, and click on a pair of points/lines, like shown in the above image.
Step 3: Downloading the 3D Models
Now that you have access to the 3D models, you need to download them to 3D print
9 parts you need to download:
- Chassis Final
- Ackermann base link
- Ackermann servo horn
- Wheel hex 12mm
- (x2) Both sides are identical parts
- Ackermann arm
- (x2) Both left and right sides; these files are mirror images of each other
- Ackermann pin link
- (x2) Both sides are identical parts
- To download the above parts, go to the main PiCar Assembly in OnShape
- Right click the part you want to download
- Click export
- Save the file as an .stl file
- Repeat these steps to save all 9 files as .stl files
If you encounter an issue where the files are unable to download, you can find the step files or stl files on our GitHub. From the main page click hw, chassis, and finally stl_files or step_files.
Step 4: 3D Print the .STL Files
Use your 3D printer of choice to print all of the .stl files.
Most of the prints need to be printed with supports, but I found that a few of them print better without them. I recommend that you print the Ackermann servo horn, Wheel hex 12mm, and Ackermann arm pieces in a separate print, and without supports. This will reduce the total print time, and increase the quality of the prints.
I printed all of the parts with 100% infill, but this was a personal choice. You could go as low as 20% infill if you wanted to. I decided to print with such a high infill in an attempt to increase the strength of the parts.
My prints were set to a 0.1 mm layer height. I made this decision because 0.1 mm is the default setting for my 3D printer. I would recommend printing the parts between 0.1 mm and 0.2 mm layer height.
Step 5: Push Bearings Into 3D Printed Front Stearing System
A 3 mm bearing goes into both of the Ackermann Arm 3D printed parts.
You should be able to push the bearings in using your fingers. However, if more force is required I recommend pressing a flat object into the bearing so that you can push with more force. Try not to use a sharp object or impact the bearing abruptly.
Press two 2 mm bearings into both of the Ackermann Arm parts.
Press a 2 mm bearing into both of the Ackermann Pin Link parts.
Please refer to the photos to understand where all of the bearings go. It should be easy to tell since the bearings will only go into a correctly sized hole.
Step 6: Screw Ackermann Servo Horn Onto Servo
The Ackermann Servo Horn should snap right in. If it doesn't, you can cut the tip of the servo. As you can see in the first photo, I cut the tip of my servo off to show you what that would look like.
Use one of the screws that came with your servo to screw the Ackermann Servo Horn onto the servo.
This step is pretty straight forward. The screw will ensure that the parts are reliably connected.
Step 7: Connecting 3D Printed Front Wheel Assembly
Connect the two Ackermann Arm parts onto the Ackermann Base Link with two M2 screws and nuts.
Use the center bearing for this step. Please refer to the photos to see where to attach the Ackermann Arm parts. The two sides should be a mirror image of each other.
Connect the two Ackermann Pin Link parts onto the Ackermann Arm parts using two M2 screws and nuts.
The end of the Ackermann Pin Link that does NOT have a bearing is the end you use to attach the Ackermann Arm. Please refer to the photos to get the orientation of the parts correct.
IMPORTANT: The left and right Ackermann Pin Link parts are flipped relative to each other.
This means that one bearing end should float above the other, as seen in the photos.
Step 8: Attach Servo to Front Wheel Assembly
Using an M2 screw and nut, attach the servo to the front wheel assembly.
The Ackermann servo horn goes between the two Ackermann Pink Link parts. Refer to the photos so that you get the orientation of the parts correct.
Step 9: Connect Wheels to Front Wheel Assembly
Insert the two Wheel Hex 12mm 3D printed parts into the two wheels.
This 3D printed part acts as a spacer between the wheel and the car. This allows the tires to be as close to the chassis as possible while still not touching.
Use two M3 screws and nuts to attach the two wheels to the front wheel assembly.
The head of the screw goes on the outside of the wheel, and the nut goes on the inside. This completes the front wheel assembly.
Step 10: Mount Pinion Gear Onto Motor Shaft
The pinion gear needs to be hammered onto the shaft of the motor
I recommend using a plastic hammer so that you do not damage the parts. Keep the pinion gear near the edge of the shaft as seen in the photo.
Step 11: Cut Axle to Length
Cut the axle to 69 mm
The 6 mm diameter axle is 200 mm long when it arrives from McMaster Carr. The axle must be cut to 69 mm for this build.
I recommend using a Dremel with a rotary disc grinder attachment. Since the axle is made out of stainless steel, it will take several minutes of grinding to cut it to length. It took me just over 5 minutes to cut my axel for this build. I recommend using the Dremel to cut a chamfer into the end of the axle. This will allow the mounted bearings and spur gear to have an easier time sliding on.
Step 12: Slide Mounted Bearings Onto Axle
The mounted bearings need to be slid onto the axle.
This is starts building the back wheel assembly.
Step 13: Mount Spur Gear Onto Axle
Slide the spur gear onto the right side of the axle.
Make sure the lock screw is on the inside facing side of the gear.
Using the provided allen wrench, screw the lock screw until it is tight against the axle.
It might be best to keep the lock screw loose for now and tighten it fully later. This will ensure that the spur gear's teeth mesh well with the pinion gear.
Step 14: Attach Hex Adapters Onto 2 Wheels
Make sure the screws are tightened fully.
Step 15: Attach Wheels and Pillow Block Bearings to Axle
Slide both of the wheels onto either end of the axle.
Tighten the lock screws so that the wheels are fixed in place.
Step 16: Mount Brushless Motor Onto Chassis
It is helpful for later if you orient the wires so that they face towards the inside of the chassis.
Step 17: Mount Back Wheel Assembly to Chassis
Make sure that the spur gear and the pinion gear are aligned and that their teeth mesh well.
If the teeth do not mesh well, loosen the lock screw on the spur gear. Move the spur gear along the axle until it meshes with the pinion gear.
Step 18: Attach Front Wheel Assembly to Chassis
Fit the servo into the rectangular servo box in the chassis.
Step 19: Connect the ESC to the Brushless Motor
Connect the same colored wires on the motor to the wires on the ESC.
These wires provide power to the motor. The motor is a brushless motor, which means that it is driven by alternating current in three sets of coils. The ESC decides when to change the current depending on the pwm signal it gets from its information cable.
Step 20: Connect the ESC and Motor Information Cables to the Receiver
Make sure that the positive and ground are in the correct location for your receiver. It is very important that the positive (red) wires are all in the same row.
Refer to your RC controller's user manual to determine which location each of the cables needs to go. For my controller, the servo cable is in channel one while the ESC cable is in channel two.
Step 21: Power Everything With the LiPo Battery, and Test With RC Controller
Plug the LiPo battery into the ESC to power the whole system
You can now control the car with your RC controller. Test that the whole system operates as intended.
You may need to adjust the servo so that the car drives straight. Most RC controllers allow you to tune this angle. You can also tune how far you turn the wheel until the car starts. I recommend reading your owners manual for your RC controller so that you understand its various functions.