Autonomous Car

Hey guys. For a school project this year I want to make an autonomous car. As of right now I am in the very early stages. I registered here hoping to post my progress along with any questions I have. I plan on ordering an arduous board (right now I am looking into the uno but I am open to suggestions.) I also plan on buying three of these sensors ( Ultrasonic Range Finder - Maxbotix LV-EZ1 ) one for front, left and right. Also I plan on getting the large servo from spark fun. I am hoping all of this will go in a cheap radio shack car so that it can roam the school halls knowing when it can turn left and right or continue straight.

Considering I have such a long period of time to complete this I plan on starting out same possible copying code others have written so similar type projects and altering it in ways to adapt more to my needs.

I will be checking back here with progress and questions and I am open to any comments or critiques.


Sounds like you're on the right track. Good luck!

I'm planning a similar project that I'll start hopefully in early November. But I was planning on using just one distance sensors and mount it on a servo, then have it check left, front, right, front, left, etc..... every half second to a second. Doing this for 2 reasons. 1: it's less expensive and 2: it's more of a challenge.

I look forward to seeing what you come up with.

That is a pretty smart idea I didn't think about that. Thanks for the reply though and I hope to see progress from you too.

hey. I had similar plans. if you want to check out what I had in mind, follow this link, it might give you some ideas:

I ended up not building it for lack of time, and currently the project is postponed, as I am really bad at multi tasking ... but yeah, eventually I will get this done as well...


This is my robot from ages ago, with code and stuff:

hey guys! i haven't been on here in a while but i ran into a little wall. i was wondering if you guys could help me with some test code to run my motor through my h bridge. i used this schematic. i do not need exact code but any help would be appreciated.

oh and dont mind the gps part. i am not using one.

looks like a l293d :wink: well if you set the pin high and low it spins in one direction and low and high it spins in the other direction

#define m1p1 8 //motor one pin one 
#define m1p2 9 motor one pin two
void setup()
  pinMode (m1p1,OUTPUT);
  pinMode (m1p2,OUTPUT);
void loop()
    // drive motors forward set  delay
  //now drive motors reverse both 

i copied and pasted a part of the code i was currently using change the pin no to 3 and 4 according to your setup

I plan on ordering an arduous board

Heh, heh - just noticed this - sometimes it can feel that way...


Not sure how familiar you are with cars, but I would suggest getting a car with drive by wire throttle. If that isnt possible, you can buy a drive by wire throttle body off ebay from like a Chevrolet Silverado or many other cars and adapt it to your vehicle (easiest way is to have someone make an adaptor from aluminum, not hard at all). This way you wont need a servo for the throttle input, you just wire the throttle body input motor to the arduino. Drive by wire cars have multiple throttle position sensors mounted in the throttle body and elsewhere, they monitor these sensors in realtime, and if any of them are more than a few percent different than the others, the ECU will react accordingly (either shut down the throttle input, the engine, or eliminate the non-matching sensor and monitor the remaining operational sensors). The reason I mention this, is that safety is paramount in any object capable of motion, especially when it is capable of high speed and weighs a couple thousand pounds.

Good luck and keep us posted!

This way you wont need a servo for the throttle input, you just wire the throttle body input motor to the arduino.

So what does the arduino output to control the throttle body?

What would be extremely cool, and difficult to do, is to make the car aware of which room it's in and be able to set a room for it to go to.

Set a default room for it to start in, (and obviously log which position it's in at all times, etc. etc.), have like a few buttons to set its destination room (maybe put all the rooms in some arrays or however you feel like doing it), and have it navigate there. Use its direction to find which way it needs to turn, etc.

Maybe I'm crazy, but it seems like a cool thing if you can make it work. Tons of work, but just imagine a teacher's face when a car comes in with a paper saying "From , here's my make-up work from yesterday -- Keep me in a safe place until comes and picks me up!".

Nevermind, I just realized you were talking about an r/c. When I read your post about a car I thought that was what you meant, a car. I recently read about a college project involving controlling cars and was thinking this project was the same idea. Good luck though.

thanks everyone, dude45342, that does sound really cool and if everything goes smoothly i will try this.

newbie thanks for the code, you said to change to 3 and 4 for me but why would it be 4 instead of 6 for the motor?

Sorry a small Error

copied and pasted a part of the code i was currently using change the pin no to 3 and 4 according to your setup

That to shouldn't have been ther i wanted to say .......
copied and pasted a part of the code i was currently using change the pin no's 3 and 4 according to your setup

This sounds like a col project! Tell me when you completed it!

I built an Arduino based robomagellan truck this summer and I just wanted to share a couple of lessons learned.

  1. A sweeping ping works awesome with two things to keep in mind. ping too high car hits curb(destructive). ping too low car sees grass (runs constant avoidance).
  2. The NMEA library is awesome!
  3. Use a servo for steering. I tried using the dc motor steering boxes that came with the trucks I modded (being cheap) and it was a disaster.
  4. Trees are not your GPS's friend.... Have a secondary system for staying on course (digital compass, etc).
  5. Keep the power for your board and sensors separate from your power for servos and motors.
  6. Keep the car's speed down until everything is dialed. Replacing ping sensors, etc sucks.
  7. Don't skimp on the batteries.

Hope this saves someone a few broken parts.....

thanks aroma of tacoma. i heard a little about the NMEA library and im going to look further into it.

newbie thanks for the clarification and from looking at the schematic i followed the pins would be 3 and 6 correct? because those are the motors leads.

im having a little bit of trouble testing this rc car because im not sure if my code is wrong. i used what newbie gave me and changed the pins to where he used 8 and 9 to 3 and 6 (look at the schematic i posted) or if its my wiring/connections that are causing nothing to happen.

arrording to the schematic you posted the pin no's for the motors are 3 & 4