How to build a Raspberry Pi Robot (part 1)

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.

Features

  • 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)

Components

  • 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

Optional components

Custom 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.

pcb2

 

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.

pcb

back side of the PCB

 

Assembly

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

 

Smart car robot chassis
Smart car robot chassis

 

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.

M3 standoffs
M3 standoffs

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.

Raspberry Pi robot controller and Raspberry Pi camera
Raspberry Pi robot controller and Raspberry Pi camera

 

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.

Raspberry Pi robot
Raspberry Pi robot

 

 

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.

Battery Powered Raspberry Pi Robot
Battery Powered Raspberry Pi Robot

 

Optional modules

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.

Raspberry Pi robot with GPS, Gyroscope+Accelerometer and Ultrasonic Distance Sensor
Raspberry Pi robot with GPS, Gyroscope+Accelerometer and Ultrasonic Distance Sensor

 

 

Next Steps

In part 2 of this howto, I will cover the software aspect of this robot building exercise. Stay tuned.