Arduino RC Car With Tinker CAD

Introduction: Arduino RC Car With Tinker CAD

Hi guys, this is a instructable to learn a simple arduino rc car with very cheap and readily available materials.Check out the design.The base of the car can be done with either cardboard or chassis.Check out the supplies needed and get them ready.

Supplies

*Arduino UNO

*Dc motars-2

*Breadboad(Medium sized)

*IR sensor

*LED(Any colour)

*H-Bridge Motar Driver

*Resistor

*IR Remote

*Jumper wires for connecting

*A to B arduino cable for programming.

Pc or Laptop for programming

Step 1: Connecting the Circuit

Look at the image and assemble your components.

Step 2: Coding Your Project

Connect your Arduino to pc or laptop with the help of Arduino A to B cable.Look at the code below copy and paste them in Arduino IDE app and upload it.

Code:

#include

IRrecv rc(11);

decode_results results; //Init Motors

const int PWM_M1 = 5;

const int IN1_M1 = 2;

const int IN2_M1 = 3;

const int PWM_M2 = 6;

const int IN1_M2 = 8;

const int IN2_M2 = 9;

int speed = 100;

void setup()

{

Serial.begin(9600);

rc.enableIRIn();

pinMode(PWM_M1,OUTPUT);

pinMode(PWM_M2,OUTPUT);

pinMode(IN1_M1,OUTPUT);

pinMode(IN2_M1,OUTPUT);

pinMode(IN1_M2,OUTPUT);

pinMode(IN2_M2,OUTPUT); }

void loop()

{

if (rc.decode(&results))

{

switch(results.value)

{

case 0xFD00FF://power

break;

case 0xFD807F://vol+

forward();

break;

case 0xFD40BF://func/stop

break;

case 0xFD20DF://|<<

turnLeft();

break;

case 0xFDA05F://>||

stop();

break ;

case 0xFD609F://>>|

turnRight();

break ;

case 0xFD10EF://down arrow

speedDown();

break ;

case 0xFD906F://vol-

backward();

break ;

case 0xFD50AF://up arrow

speedUp();

break ;

}

rc.resume();

}

}

void forward()

{

Serial.println("forward");

analogWrite(PWM_M1, speed);

analogWrite(PWM_M2, speed);

digitalWrite(IN1_M1, HIGH);

digitalWrite(IN2_M1, LOW);

digitalWrite(IN1_M2, HIGH);

digitalWrite(IN2_M2, LOW); }

void backward()

{

Serial.println("backward");

analogWrite(PWM_M1, speed);

analogWrite(PWM_M2, speed);

digitalWrite(IN1_M1, LOW);

digitalWrite(IN2_M1, HIGH);

digitalWrite(IN1_M2, LOW);

digitalWrite(IN2_M2, HIGH); }

void turnLeft()

{

Serial.println("turnLeft");

analogWrite(PWM_M1, 0);

analogWrite(PWM_M2, speed);

digitalWrite(IN1_M1, HIGH);

digitalWrite(IN2_M1, LOW);

digitalWrite(IN1_M2, HIGH);

digitalWrite(IN2_M2, LOW); }

void turnRight()

{

Serial.println("turnRight");

analogWrite(PWM_M1, speed);

analogWrite(PWM_M2, 0);

digitalWrite(IN1_M1, HIGH);

digitalWrite(IN2_M1, LOW);

digitalWrite(IN1_M2, HIGH);

digitalWrite(IN2_M2, LOW); }

void stop()

{

Serial.println("stop");

digitalWrite(IN1_M1, LOW);

digitalWrite(IN2_M1, LOW);

digitalWrite(IN1_M2, LOW);

digitalWrite(IN2_M2, LOW); }

void speedUp()

{

Serial.println("speedUp");

speed+=10;

if(speed>255) speed =255;

analogWrite(PWM_M1, speed);

analogWrite(PWM_M2, speed); }

void speedDown()

{

Serial.println("speedDown");

speed-=10;

if(speed<0) speed =0;

analogWrite(PWM_M1, speed);

analogWrite(PWM_M2, speed);

}

Step 3: Tutorial!!

Arduino Contest 2020

Participated in the
Arduino Contest 2020

Be the First to Share

    Recommendations

    • Summer Fun: Student Design Challenge

      Summer Fun: Student Design Challenge
    • Metal Contest

      Metal Contest
    • Maps Challenge

      Maps Challenge

    2 Comments

    0
    HECTOR2304
    HECTOR2304

    1 year ago on Introduction

    I am having problems with it working, what could it be?
    The code and connections are fine, but the remote just does´t work

    0
    Vedanth_K
    Vedanth_K

    Best Answer 1 year ago

    What motar are you using the dc motar or something else. Just check out with the IR sensor and IR remote if it works properly.In the code change the first line as
    #include<IRremote.h>.Go to this link and download the library file and add them in the arduino IDE app.https://github.com/z3t0/Arduino-IRremote . Take help from youtube for adding this library.