Instructables
Picture of Building robots with Raspberry Pi and Python
The goal of this tutorial is to help you begin programming with Python to control your Arduino robots with a Raspberry PI. We will go over the basics like installation and some simple examples to control your robot from a Python GUI from Raspberry PI.

 
 
Remove these adsRemove these ads by Signing Up

Step 1: Parts list

Picture of Parts list
In this tutorial we are going to use the following items :

1.   Raspberry PI ( with monitor, USB hub, keyboard, mouse,and WIFI Dongle)
http://www.zagrosrobotics.com/shop/item.aspx?itemid=895

2.   Arduino UNO or compatiable (USB cable)
http://www.zagrosrobotics.com/shop/item.aspx?itemid=868

3.   Wifi Router

Now when it comes to robot bases there are many kits available in size and complexity. In this tutorial I have decided on using this setup with a 12v battery that will give us long run times and high load capacity. And a power distribution board with regulated 12v and 5v power outputs that makes it easy to deliver power to our robot.

4.   Robot Base 
http://www.zagrosrobotics.com/shop/item.aspx?itemid=523

5. Motor Driver
http://www.zagrosrobotics.com/shop/item.aspx?itemid=782

6. Power Distribution Board
http://www.zagrosrobotics.com/shop/item.aspx?itemid=765

7. 12volt  7amp hr Battery
http://www.zagrosrobotics.com/shop/item.aspx?itemid=766

Step 2: Introduction to Python

Picture of Introduction to Python
Python is a general purpose interpreted, interactive, object-oriented, high-level programming language that was created by Guido van Rossum in the late eighties. Python allows users to write code with clear, readable syntax with a growing number of support libraries for various tasks that is open source and has a community based around its development. Here are some helpful links that might come in handy when starting out.


Cheat Sheet

Python Howto 

Very very nice! I like your style!

ecommgeek2 months ago

What kind of wire do I need to hook this all up?

ZRob314 (author)  ecommgeek2 months ago

We normally just use jumper wires similar to these:

http://www.zagrosrobotics.com/shop/item.aspx?itemi...

You will probalby want some male-male and male-female

MoserLabs4 months ago

Nice work! I'm trying to wrap my mind around how the R-Pi communicates to the Arduino though. From the one image it's got a 5V connection to the Arduino, but there aren't any data connections from Pi to Arduino?

dhill298 months ago

Hi Fells, there was a problem with the sketch provided. To make it work you will need to change

int r_motor_pwm = 10;

to

int r_motor_pwm = 3;

ZRob314 (author)  dhill297 months ago

This depends on the version of the motor driver listed above or if a different motor drive is used. Always double check the data sheets or specs on your components/devices against your code to avoid any confusion during setup/operation.

dhill29 ZRob3147 months ago
Thanks ZRob, That is very good advice. I had bought the exact parts linked to from you and it just is a little thing that tripped me up as a beginner. I wanted to make sure any other inexperienced people would be able to find the problem easily.
epierce10 months ago
This works sweet! Have you tried to run it with NetIO on an Android or Iphone device?
epierce10 months ago
Zrob thanks for helping a 50 year old realize his bot dreams!! I have been hitting a brickwall with this project for 6 months!! Unfortunatley my wife is screaming at me for yelling ITS ALIVE!!! at 1:00 am!!LOL II now realize why the villagers actually destroyed Dr. Frankenstein's lab. Any way to program the button control to an android tablet or phone?
purpulhaze11 months ago
Great instructable! I think I'm gonna try this as I have all the parts on hand. Do you know how one would go about adding live video streaming to something like this? I have a camera module on the way and also a compatible webcam. Though I wasn't impressed with the usb webcam performance.
nerd74731 year ago
cool
Selenae1 year ago
Thank you for your post, I was blocked with the python part of my project and you give me some robust base to begin my learn :-)
uavguy1 year ago
Wow this is so awesome! I just got a Raspberry Pi and I have been wanting to use it for robotics. Thank you for taking the time to put this together I know it will be a big help to me!