Last year, I built a robot based on Raspberry Pi and gave a demo on the Pi Day in Computer History Museum.
I thought that it might be helpful to someone if I share how I built it.
- L293D motor drives for two 6V DC motors
- Video streaming to laptop/cell phone from Raspberry Pi over wifi
- Python script controls the robot through VNC
- Headers for ultrasonic distance sensors
- Headers for gyroscope and acceleromenter
- Headers for 2.4GHz RF module
- Pin headers for GPS
- Extension for other I2C sensors
- Power jack for batteries (5-6V)
- Raspberry Pi 1 B+ (I tested this one. Although later models ,like RPi2, RPi3 or RPi Zero, should also work).
- A custom PCB (I will cover that in later section)
- A robot chassis. Pretty much any chassis with two 6V DC motors should work.
- Battery holder (for 4 AA batteries)
- A few dupont cables to hook up the DC motors to the PCB
I designed a custom PCB to hold all the sensors and to keep the external wiring minimal. It was fabricated using Osh Park.
For those who want to build the same one, you could order the PCB through this link. However, you need to purchase other components through other places.
This PCB is very easy to solder because most of the components are standard 0.1″ through-hole components. The voltage regulators are SMT type. However, they are big enough to solder by hand. All the components (except for the female headers for Raspberry Pi) are on the top side of the PCB.
Locations for Gyroscrope, RF module and GPS module are marked on the PCB with dashed lines.
Smart car robot chassis
Here are the steps to put them together. First, assemble the robot chassis. After soldering couple of dupont cables to each motor, it looks like this
Add the M3 standoffs
You will need a few M3 standoffs to mount the custom PCB to Raspberry Pi. You may purchase the plastic ones like these on Amazon.
Mount on Raspberry Pi
There is a slot/cutout on the custom PCB to allow the Raspberry Pi camera cable to go through. Plug in the PCB to Raspberry Pi pin header carefully.
Connect the motors
The screw terminals (the blue connectors) are for the DC motors and power supply. Connect the motors as shown in the picture below.
Power it up!
Now, put everything on the robot chassis. I used a couple of rubble bands to secure the wires and the controller. Plug in the power and it is ready to go… well, you need to program it first. I will cover it in part 2 of this howto.
As mentioned earlier, there are several optional modules for this robot. This includes ultrasonic distance sensor, gyroscope+accelerometer, RF module and GPS module. I tested all except for the RF module and they all work fine. The following photo is for your reference if you want to add these modules.
In part 2 of this howto, I will cover the software aspect of this robot building exercise. Stay tuned.