Autonomous Race Car

77,947

393

85

Introduction: Autonomous Race Car

Build this autonomous driving robot car based on a old RC toy car. I removed the radio control board from the car and replaced it with a brain in the form of an Arduino UNO board (plus a motor driver board) and gave it an ultrasonic distance measuring module to see the world through.

Step 1: Components

  • Radio controlled toy car
  • Arduino Uno
  • Motor driver board (2 channel)
  • Ultrasonic sensor distance measuring module
  • Bread board

Step 2: Brain Transplant

Remove the radio control board from the RC car cutting all wires close to the board. Connect wires to the motor driver board - rear wheel motor in one channel - front wheel steering motor in the other channel.

"Steal" power from the cars batteries.

Step 3: Connect Arduino Board and the Ultrasonic Sensor

Connect the ultrasonic sensor and the motor driver to the Arduino board.

Step 4: The Programming

The cars intelligence is pretty simple. It's based on different modes that controles speed & direction depending on distance to objects ahead of the car:

FULL SPEED MODE - No objects ahead - full speed

CRUISE MODE - Object is X cm away - slow down

AVOID MODE - Object is too close for comfort - slow down and turn in random direction

REVERSE MODE - Object is very close - stop and reverse for 2 seconds

Step 5: The Code

Note: you need to find the "Ultrasonic.h" online. As I remember, I had to download a couple of different versions before I found one that worked.

Microcontroller Contest

Participated in the
Microcontroller Contest

1 Person Made This Project!

Recommendations

  • Make it Glow Contest

    Make it Glow Contest
  • First Time Author Contest

    First Time Author Contest
  • PCB Challenge

    PCB Challenge

85 Discussions

0
YashuY
YashuY

5 years ago on Introduction

please make it fast as soon as possible...

0
TalhaI4
TalhaI4

Reply 2 years ago

F3E7GSUHZI8QI9Q:159: error: 'class Ultrasonic' has no member named 'Ranging'

distance = (ultrasonic.Ranging(CM));

^

exit status 1

'class Ultrasonic' has no member named 'Ranging'

Any idea how to fix this?

0
sasdsdferrcfd
sasdsdferrcfd

3 years ago

plz .how i can do it with L298 driver .what the changing in code?

0
m0ebius
m0ebius

3 years ago

Watching this work roaming is impressive! but reading through your code I don't see how the Random Seed influences the steering choices. Is this your early code for the project?

0
ShayanN1
ShayanN1

3 years ago

the front motors are not working and the rear motors are moving front only when an I move my hand in front of the ultrasonic sensor. need help

0
ilkergureli
ilkergureli

4 years ago

Hi :)
First of all, Congratulations..
I wonder how many motors(dc or servo) in car? And lastly, is there any hardware circuit of this project ? Please help me :)
Thanks :)

0
Dod5
Dod5

4 years ago

Can it used for 2WD smart car? do you have sketch code for 2WD which uses L9110s and ultrasonic sensor?

0
yaseenninja
yaseenninja

4 years ago

Hey I actually tried it with the l298 motor module and it's not working because. The l298 has pwm (pulse width modulation) so it has 3 pins for each motor. 2 of them are Standard and one more is pwm pin so please can u suggest. Me the code it's not working pls

0
YashuY
YashuY

5 years ago on Introduction

please, can i get the program code for this one..

0
arduinoarpan
arduinoarpan

5 years ago

Hey actually the car i am using has only one motor ie fr rear wheel so will it work on such car

0
jesper birk
jesper birk

Reply 5 years ago on Introduction

hmmm - does it have a servo steering the front then? You would need to tweek the program - but it should be possible...

0
GarrukApex
GarrukApex

Reply 5 years ago on Introduction

This is an old thread, but if you are reading this-

Instead of one motor turning either fully right or left, with a servo you would have the option of turning in either direction in varying intensities. You would need a single channel motor driver for you rear wheel, and you would be able to connect the servo directly to arduino. Instead of just turning the front steering motor left or right, you would have to specify the angle for the servo to turn to to control steering. However, you would have the option to control the intensity (ie degree) of the turn based on the scenario.

*In case you do not already know, the Servo.h library comes standard with the arduino ide and would be perfect for your purposes.

0
ChrisA7
ChrisA7

5 years ago on Introduction

I cannot get the car to move forward, only reverses. any suggestions on what could be the problem?

0
jesper birk
jesper birk

Reply 5 years ago on Introduction

It could be a problem with the sensor. If it reads out a zero value, the program will go in reverse mode.

0
ChrisA7
ChrisA7

Reply 5 years ago on Introduction

I was able to get it moving forward, but now it wont seem to turn.

0
zerger
zerger

5 years ago on Introduction

I am not able to get your code. It keeps saying that there is a fault.

0
amir.leboss1
amir.leboss1

5 years ago on Introduction

i didn't find the motor driver board 2 channel and i bought the Motor Drive Shield Expansion Board L293D .... can i use it ? and how should i connect it ?

Waiting your answer!

thank you .