RC Car to Obstacle Avoiding Robot

11,226

30

6

Introduction: RC Car to Obstacle Avoiding Robot

This is the old car.

I find an old RC car in my shed.
How I turned into a robot? It's simple, I will explain you in next step.

Step 1: The Old RC Car

1. Removing the casing
2.Removing the circuit.

Step 2: Control

To control it I used:
 -Arduino UNO
 -A motor driver TB6612FNG

Power:
8 x 1.5 alkaline battery
  - 4 for arduino
  - 4 for driver -> motor

Step 3: The Space

To put Arduino and driver on car we need a smooth space. I use the plastic, finished whit a wire brush.

I kept the original screws for a easy conection.

Step 4: 'Eye'

Robot need a sensor to detect the obstacles.

Sensor: IR Sharp sensor.

I want to use a servo for turn the sensor at right and left, but I dropped this idea.

Step 5: PCB

For easy using I make a PCB with a female pin (If it breaks I can replace) and 2 wire holder (with screw).
I make the PCB in my enchanting machine (reduced the time).

Step 6: FINISHING

Now I have all the component ready for mount.
1.Put the battery holder
2.Put the Arduino UNO and Driver
3.Put the sensor
4.Wire it up


The robot is complete, but don't have code.

Step 7: CODE



int DIST; //distance

//motor A connected between A01 and A02 //motor B connected between B01 and B02

int STBY = 10; //standby

//Motor A int PWMA = 3; //Speed control int AIN1 = 9; //Direction int AIN2 = 8; //Direction

//Motor B int PWMB = 5; //Speed control int BIN1 = 11; //Direction int BIN2 = 12; //Direction

void setup(){ pinMode(STBY, OUTPUT);

pinMode(PWMA, OUTPUT); pinMode(AIN1, OUTPUT); pinMode(AIN2, OUTPUT);

pinMode(PWMB, OUTPUT); pinMode(BIN1, OUTPUT); pinMode(BIN2, OUTPUT); }

void loop(){ // read the input on analog pin 0: int sensorValue = analogRead(A0); // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V): float DIST = sensorValue * (5.0 / 1023.0); if(DIST < 2) { move(1, 0, 1); //direction move(2, 255, 1); //full speed front } if(DIST > 2) { move(1, 150, 1); //direction: right move(2, 200, 0); // back } }

void move(int motor, int speed, int direction){ //Move specific motor at speed and direction //motor: 0 for B 1 for A //speed: 0 is off, and 255 is full speed //direction: 0 clockwise, 1 counter-clockwise

digitalWrite(STBY, HIGH); //disable standby

boolean inPin1 = LOW; boolean inPin2 = HIGH;

if(direction == 1){ inPin1 = HIGH; inPin2 = LOW; }

if(motor == 1){ digitalWrite(AIN1, inPin1); digitalWrite(AIN2, inPin2); analogWrite(PWMA, speed); }else{ digitalWrite(BIN1, inPin1); digitalWrite(BIN2, inPin2); analogWrite(PWMB, speed); } }

void stop(){ //enable standby digitalWrite(STBY, LOW); }

Arduino Contest

Participated in the
Arduino Contest

Robot Contest

Participated in the
Robot Contest

Be the First to Share

    Recommendations

    • Puzzles Speed Challenge

      Puzzles Speed Challenge
    • "Can't Touch This" Family Contest

      "Can't Touch This" Family Contest
    • CNC Contest 2020

      CNC Contest 2020

    6 Discussions

    0
    karana35
    karana35

    3 years ago

    hey can u upload a video of its working ?

    0
    ando2013
    ando2013

    6 years ago on Introduction

    Hi, I already have one Instructables whit tank but I'm going to make another best

    0
    wbannister
    wbannister

    6 years ago

    make an instructable on the tracked vehicle in the background

    0
    tikeda1
    tikeda1

    Reply 6 years ago on Introduction

    hi if u made one too seend me photos on whatsapp +818041685464

    0
    tikeda1
    tikeda1

    6 years ago on Introduction

    can u make an instructabke with that background vehicle?

    i have the same "tank" but i buid mine with an arduino, laidada motor shield 2 dc motors like yours, and an ultrasonic sensor but its dont work hwlp pls