User avatar
ZacharyI123
Posts: 263
Joined: Sun Jun 17, 2012 1:09 pm
Location: Ilford, Essex
Contact: Website

How to make a Raspberry Pi car

Tue Jul 16, 2013 6:36 pm

Hey Guys! I’m Zachary Igielman from London, I’m 13 years old, and I thought I might share some of the projects I’ve been working on with my raspberry pi. Today, I’m going to tell you how to build a raspberry pi car.

Firstly I would like to thank this forum, if it weren’t for the lovely people on here that helped me get going, I wouldn’t have been able to build these projects at all so thanks to all the forum members that have answered my questions in the past.

Before you start trying to build this, you’re going to have to install wiring pi. Instructions are here: https://projects.drogon.net/raspberry-p ... d-install/

Once you’ve installed that, you need to write and compile some c code that uses wiring pi to control some GPIO pins. Here’s the code I wrote:

Code: Select all

#include <stdio.h>
#include <wiringPi.h>

#define left	0
#define right	2

int main (void)
{

  wiringPiSetup () ;

  int motors[4];
  motors[0]=left;
  motors[1]=right;

  int i=0;
  for (i=0; i<2; i++) {
    pinMode (motors[i], OUTPUT) ;
    digitalWrite(motors[i], LOW) ;
  }

  char input;
  int happened=0;

  for (;;) {
    happened=0;
    scanf("%c",&input);
    if (input=='a') {
      happened=1;
      digitalWrite(left, LOW);
      digitalWrite(right, HIGH);
    } else if (input=='d') {
      happened=1;
      digitalWrite(left, HIGH);
      digitalWrite(right, LOW);
    } else if (input=='w') {
      happened=1;
      digitalWrite(left, HIGH);
      digitalWrite(right, HIGH);
    } else if (input=='s') {
      printf("all off");
      digitalWrite(left, LOW);
      digitalWrite(right, LOW);
    }
  }
  return 0 ;
}
Now save the code in your default users directory (~) as car.c . Now compile it using this command (use this command to compile any c code with wiring pi):

Code: Select all

gcc -Wall -o car car.c -lwiringPi
Now we should have a executable file called car in our default user (pi for most of us) home directory.

Next, you will have to build a circuit twice on a breadboard, with one of with wheels connected to GPIO 0 and the other wheel connected to GPIO 2. Use the ground pins on the raspberry pi for ground.

Here is the equipment list for the circuit:

Item Website to buy Here is the circuit:

pic.twitter.com/ez9pyPT9xj

Here is what pin is what:

pic.twitter.com/1dkLKrhPDH

Now stick the raspberry pi, a battery back for the raspberry pi (http://www.amazon.co.uk/gp/product/B00C ... UTF8&psc=1), the 4 AA connector packs, and the circuit on the breadboard onto a piece of wood. Stick the two motors to the underside of the back of the wood, and stick two small freewheeling caster-wheels (find them in a local DIY store) to the underside of the front.

When you plug your raspberry pi, wait a bit, then enter your username, followed by your password, followed by ‘sudo ./car’

When you press w then enter, it’ll go forward. When you press d or a, it will turn.

If the motors go the wrong direction, change round the two points they connected with the circuit.

Here are some pictures of what it should look like:
pic.twitter.com/2pkLgYayov
pic.twitter.com/KLQJ11dMJu
pic.twitter.com/yOUVwu9xaS
pic.twitter.com/3OSxv3lQsH
pic.twitter.com/TqWCE1cNL5

Here is a video of it working: http://youtu.be/uQU3Os1u9OI

If you have any questions post them below along with more ideas for pi projects.
Last edited by ZacharyI123 on Wed Jul 17, 2013 4:19 pm, edited 2 times in total.
Don't be mean, I'm only thirteen 8-)

User avatar
raspberrypiguy1
Posts: 379
Joined: Sun Sep 02, 2012 7:01 pm

Re: How to make a Raspberry Pi car

Tue Jul 16, 2013 6:39 pm

AWESOME!

The Raspberry Pi Guy
Matt, 17 year old @Raspberry_Pi YouTube tutorial maker, programmer, electronics tinkerer, entranced by the cosmos, ISS, Physics, likes Politics, Cambridge UK

User avatar
ZacharyI123
Posts: 263
Joined: Sun Jun 17, 2012 1:09 pm
Location: Ilford, Essex
Contact: Website

Re: How to make a Raspberry Pi car

Tue Jul 16, 2013 7:37 pm

How could I get this featured on the raspberry pi website?
Don't be mean, I'm only thirteen 8-)

simplesi
Posts: 2327
Joined: Fri Feb 24, 2012 6:19 pm
Location: Euxton, Lancashire, UK
Contact: Website

Re: How to make a Raspberry Pi car

Tue Jul 16, 2013 9:01 pm

Absolutley brilliant stuff :-)

Easiest way to get it out there is to get yourself a free wordpress.com blog site and stick an article on there with some pics and then tell Liz :)

No need to spend time on making the blog look fancy to start with - you can do that later :)

But in the meantime, put some tags around you images in your post above to make them easily visible :)
Any links should have around them as well

Simon

PS Top tip - don't click on any links that anyone sends to you in any comments you get saying how wonderful your blog is - they are always spam artists !
Seeking help with Scratch and I/O stuff for Primary age children
http://cymplecy.wordpress.com/ @cymplecy on twitter

Oysterville
Posts: 54
Joined: Tue Feb 19, 2013 3:33 am

Re: How to make a Raspberry Pi car

Tue Jul 16, 2013 9:02 pm

I now feel old and under-accomplished. Thanks.
Google is a helluva drug.

User avatar
ZacharyI123
Posts: 263
Joined: Sun Jun 17, 2012 1:09 pm
Location: Ilford, Essex
Contact: Website

Re: How to make a Raspberry Pi car

Wed Jul 17, 2013 6:35 am

simplesi wrote:Absolutley brilliant stuff :-)

Easiest way to get it out there is to get yourself a free wordpress.com blog site and stick an article on there with some pics and then tell Liz :)

No need to spend time on making the blog look fancy to start with - you can do that later :)

But in the meantime, put some tags around you images in your post above to make them easily visible :)
Any links should have around them as well

Simon

PS Top tip - don't click on any links that anyone sends to you in any comments you get saying how wonderful your blog is - they are always spam artists !
Thanks! I will make a website later today. How would I go about telling Liz?
Don't be mean, I'm only thirteen 8-)

User avatar
ZacharyI123
Posts: 263
Joined: Sun Jun 17, 2012 1:09 pm
Location: Ilford, Essex
Contact: Website

Re: How to make a Raspberry Pi car

Wed Jul 17, 2013 6:39 am

Thanks guys for all the lovely comments, I really appreciate it :) . Before I make a website about how to make this car, I would like someone to try and build it just following my instructions. That way, I can find out my mistakes, mis-explanations and anything that I might've missed out. If you can't do that, then please read it and spot as many type errors, things that are unclear and stages that are missed out. What are the mistakes in the how to and how can I make it better? Thanks again.
Don't be mean, I'm only thirteen 8-)

User avatar
ZacharyI123
Posts: 263
Joined: Sun Jun 17, 2012 1:09 pm
Location: Ilford, Essex
Contact: Website

Re: How to make a Raspberry Pi car

Wed Jul 17, 2013 6:44 am

Oysterville wrote:I now feel old and under-accomplished. Thanks.
How about you try following my instructions? Maybe then you'll feel a bit younger and more accomplished. Don't forget to comment and tell me how it goes?
Don't be mean, I'm only thirteen 8-)

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 17877
Joined: Sat Jul 30, 2011 7:41 pm

Re: How to make a Raspberry Pi car

Wed Jul 17, 2013 8:48 am

ZacharyI123 wrote:
simplesi wrote:Absolutley brilliant stuff :-)

Easiest way to get it out there is to get yourself a free wordpress.com blog site and stick an article on there with some pics and then tell Liz :)

No need to spend time on making the blog look fancy to start with - you can do that later :)

But in the meantime, put some tags around you images in your post above to make them easily visible :)
Any links should have around them as well

Simon

PS Top tip - don't click on any links that anyone sends to you in any comments you get saying how wonderful your blog is - they are always spam artists !
Thanks! I will make a website later today. How would I go about telling Liz?
Already done!
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Please direct all questions to the forum, I do not do support via PM.

Twinkletoes
Posts: 210
Joined: Fri May 25, 2012 9:44 pm

Re: How to make a Raspberry Pi car

Wed Jul 17, 2013 9:02 am

Brings back memories... I built something like this when I was about 13, controlled by a BBC micro. It was dubbed Robot Ron, after the playmobil bloke glued to the top of it :) I think it must have been a CDT project because it had a nice feature where you could guide it along a path and then it would reverse back along the same path. I knew I'd passed when I saw the teachers sitting on the floor in the classroom playing with it in an obstacle course they'd built.

This looks like a really great project and congratulations on thinking about how other people might want to build it. I'm sure you're full of ideas of how you can make a better one that does more. Google Driverless Car, here we come :)

User avatar
ZacharyI123
Posts: 263
Joined: Sun Jun 17, 2012 1:09 pm
Location: Ilford, Essex
Contact: Website

Re: How to make a Raspberry Pi car

Wed Jul 17, 2013 3:55 pm

Should I tweet Liz, tweet raspberry pi, send Liz a private message on her forum profile, email press@raspberrypi.org, email forum@raspberrypi.org, email liz@raspberrypi.org or email info@raspberrypi.org? What should I say?
Don't be mean, I'm only thirteen 8-)

User avatar
ZacharyI123
Posts: 263
Joined: Sun Jun 17, 2012 1:09 pm
Location: Ilford, Essex
Contact: Website

Re: How to make a Raspberry Pi car

Wed Jul 17, 2013 4:24 pm

Don't be mean, I'm only thirteen 8-)

User avatar
RaTTuS
Posts: 9485
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: How to make a Raspberry Pi car

Wed Jul 17, 2013 4:26 pm

She'll see it - no need to spam,
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

User avatar
ZacharyI123
Posts: 263
Joined: Sun Jun 17, 2012 1:09 pm
Location: Ilford, Essex
Contact: Website

Re: How to make a Raspberry Pi car

Wed Jul 17, 2013 4:30 pm

RaTTuS wrote:She'll see it - no need to spam,
I wasn't going to send it to all of them. But which of them is most appropriate? She won't see it if I don't send it :p
Don't be mean, I'm only thirteen 8-)

User avatar
RaTTuS
Posts: 9485
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: How to make a Raspberry Pi car

Wed Jul 17, 2013 4:33 pm

well she reads this forum , but putting a tweet in with "@Raspberry_Pi #RaspberryPi http://www.raspberrypi.org/phpBB3/viewt ... 41&t=50093"
will be a good starter for 10.
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

User avatar
raspberrypiguy1
Posts: 379
Joined: Sun Sep 02, 2012 7:01 pm

Re: How to make a Raspberry Pi car

Wed Jul 17, 2013 4:57 pm

I think that Liz has already seen it!

The Raspberry Pi Guy
Matt, 17 year old @Raspberry_Pi YouTube tutorial maker, programmer, electronics tinkerer, entranced by the cosmos, ISS, Physics, likes Politics, Cambridge UK

User avatar
ZacharyI123
Posts: 263
Joined: Sun Jun 17, 2012 1:09 pm
Location: Ilford, Essex
Contact: Website

Re: How to make a Raspberry Pi car

Wed Jul 17, 2013 5:25 pm

raspberrypiguy1 wrote:I think that Liz has already seen it!

The Raspberry Pi Guy
How do you know that?
Don't be mean, I'm only thirteen 8-)

Return to “Other projects”

Who is online

Users browsing this forum: No registered users and 9 guests