Dominic J Hodgkiss
Published © GPL3+

PiCart

A quick, easy and fun build for Raspberry Pi. An excellent first project for newcomers to Robotics, Raspberry Pi' and Python programming.

BeginnerFull instructions provided1,626
PiCart

Things used in this project

Hardware components

Raspberry Pi 1 Model B
Raspberry Pi 1 Model B
All we had at the time but its really all you need, its only running a short Python script, and the motor controller shield only mounts onto 26 pins.
×1
RyanTeck RPi Motor Controller Board
You have to solder the board yourself but its a fun extra task, plus they give you the links to the guides with QR codes! (well I thought it was cool...)
×1
Robot Car Chassis Kit
×1
SD Card (Generic)
I used an 8Gb, but that's because that was all we had. I am sure you could get away with a 2 or 4Gb one.
×1
AA Battery (Generic)
You will need 4.
×1
USB to Micro USB Cable
Like the one the Raspberry Pi uses, but I would advise going out and buying the cheapest you can find as you will be cutting the micro USB end off to solder to the battery wires to power the Pi.
×1
Equipment Cable (Generic)
You only need about an inch and a bit of wire to lengthen the battery box wires so they can connect to the micro USB and also the power input on the motor controller board.
×1
Heatshrink (Generic)
I only used a small amount of this just to add rigidity to my connections on the motors, and wires.
×1

Software apps and online services

Raspbian
Raspberry Pi Raspbian
We use Raspbian for pretty much everything as it has all the things we need for teaching our students, and for this project is has Python IDLE 3.
Python IDLE 3

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Screwdriver (Generic)
Power/Hand Drill (Generic) (3mm bit)
You need to drill 4 small holes to mount the Raspberry Pi on the top, of which displaces the battery box from its position. To keep the batteries close to the centre of gravity I seated my battery box just behind the "axle" so that the batteries wouldn't tip the cart backwards.

Story

Read more

Schematics

Raspberry Pi Mounting Holes

This is where I drilled two holes to mount the Pi, though I just placed it on top of the protective paper film and then marked with pencil. Eye balled it essentially.

Battery Box Holes

Same as the other ones, I just marked with pencil where to drilled.

PowerConnections

This diagram shows how you need to solder the power connections, I explain it in the story section.

Code

BasicLinePattern7

Python
This is a short snippet of code that sets up select GPIO headers to be used to control the motors, it then proceeds to make the robot move forward for 1.5 seconds before turning 180 degrees and returning for 1.5 seconds (hopefully back to where it started). I have left some non-essential lines in there but they let you grasp the concept of changing the polarity of the motor.
import time
import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(17,GPIO.OUT)
GPIO.setup(18,GPIO.OUT)
GPIO.setup(22,GPIO.OUT)
GPIO.setup(23,GPIO.OUT)

#moving forward 1.5 seconds
GPIO.setup(17,True)
GPIO.setup(18,False)
GPIO.setup(22,True)
GPIO.setup(23,False)
time.sleep(1.5)

#turning left 0.8 seconds
GPIO.setup(17,True)
GPIO.setup(18,False)
GPIO.setup(22,False)
GPIO.setup(23,False)
time.sleep(0.7)

#forward 1.5 seconds
GPIO.setup(22,True)
time.sleep(1.5)

#stops
GPIO.setup(17,False)
GPIO.setup(22,False)

#You can see that we dont actually need to keep setting everything to False,
#We just need to tell whatever is False or True the other way round

Credits

Dominic J Hodgkiss

Dominic J Hodgkiss

1 project • 3 followers
Always been big on making, so i was bound for my hobbies to be 3D printing, electronics, home automation, pretty much all things beep boop.

Comments