Trybotics Logo

How to Make an Obstacle Avoiding Car

DESCRIPTION

In this tutorial ill be showing you how to build a obstacle avoiding or a smart car(both are the same, just the name is......).What it does is it will stop when an object comes in front of it ...

Things required-

  1. A car base plate with wheels
  2. Power supply
  3. Arduino
  4. Wires
  5. Relay
  6. Ir sensor

Description:

You can make whichever way you want but I made this a way I found easy.

What I did is took a simple wooden plate type thing and then cut it according the size of the of the tyres(the space I left for the tyres).

Description:

For mounting,If you use the base plate I've done here then you can easily mount the components on it.It does not actually matter where you mount the components but the sensor should be facing ahead without any obstacle coming before it...Better let it be just at the front so that it can detect objects more accurately....

Description:

So now for the circuit part, its not that difficult,though you may have to give a separate power supply for the Arduino which I have not shown in this diagram.So what happens in the circuit is that when the sensor sends message to the Arduino that there is some obstacle in front of it ,which will then cut the circuit and stop the car its that simple you can also add some leds to make it look more good....

Description:

And now the code....

int irrecv=A0; 
int motor=6;
void setup(){
pinMode(irrecv,INPUT);
pinMode(motor,OUTPUT);
}
void loop(){
 int i=digitalRead(irrecv);
if(i==HIGH){
digitalWrite(motor,HIGH); 
                  /*low will make the motor spin as the gnd pin is connected to it.*}

else{digitalWrite(motor,LOW)}
}

If you are using leds to decorate then use this code instead of it-

int irrecv=A0; 
int motor=6;
int led=13;//led computable pin 
void setup(){
pinMode(irrecv,INPUT);
pinMode(motor,OUTPUT);
}
void loop(){
int i=digitalRead(irrecv);
if(i==HIGH){
digitalWrite(motorpin,HIGH); 
                  /*low will make the motor spin as the gnd pin is connected to it.*/}
else{digitalWrite(motor,LOW);
digitalWrite(led,HIGH)
}
}

Description:

Just upload the code and done!!!,The car is ready for you to play about with......So thank you for selecting my tutorial, Happy electronics!

Description:

Its the same design just with a different sensor, because it it gives me a better range and it also cannot be deflected by the sun because it does not depend on IR rays while the IR sensor as the name suggests depends on IR rays which can be deflected by the sun.


YOU MIGHT ALSO LIKE