roboattic Lab
Published © CC BY-NC-SA

How to Make a TV Remote Control Robot Car

Make Cool TV Remote control car using Arduino and IR Receiver.

IntermediateFull instructions provided427
How to Make a TV Remote Control Robot Car

Things used in this project

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Circuit Diagram

Code

Arduino TV Remote Control Car

C/C++
// Remote Controlled Robot Car 
// Contact me here https://www.instagram.com/diy_burner/
// Please Subscribe for Support - https://youtube.com/@roboatticLab
   
// include library 
#include <IRremote.h>

// define IR sensor pin 
int IRsensorPin = 11;

// define the some functions used by the library 
IRrecv irrecv(IRsensorPin);
decode_results results;

// define L298N motor drive control pins 
int RightMotorForward = 3;    // IN1
int RightMotorBackward = 4;   // IN2
int LeftMotorForward = 5;     // IN3
int LeftMotorBackward = 6;    // IN4
int ForwardSpeed = 2;
int BackwardSpeed = 7;


void setup(){
  
  // initialize motor control pins as output 
  pinMode(LeftMotorForward,OUTPUT);
  pinMode(RightMotorForward,OUTPUT);
  pinMode(LeftMotorBackward,OUTPUT);
  pinMode(RightMotorBackward,OUTPUT);
  pinMode(ForwardSpeed,OUTPUT);
  pinMode(BackwardSpeed,OUTPUT);

  // start serial communication to see hex codes 
  Serial.begin(9600);
  irrecv.enableIRIn();
}

void loop(){
  
  // if the sensor is receive any signal 
  if (irrecv.decode(&results)){
    
    // print the hex code value on the serial monitor 
    Serial.println(results.value);
    delay(5);

    // resume function according to hex code 
    irrecv.resume();
  }
  
  // if the incoming data is "defined hex code" then run the motors functions 
  // write the hex codes of your remote control 
  if(results.value == 12583000)
           Forward();
  if(results.value == 12583001) 
           Backward();
  if(results.value == 12583003) 
           Right();
  if(results.value == 12583002) 
           Left();
  if(results.value == 12583004) 
           Stop();
  
}

// FORWARD 
void Forward(){
  Serial.println("Forward");
  digitalWrite(ForwardSpeed,200);
  digitalWrite(BackwardSpeed,200);
  digitalWrite(LeftMotorForward,HIGH);
  digitalWrite(RightMotorForward,HIGH);
  digitalWrite(LeftMotorBackward,LOW);
  digitalWrite(RightMotorBackward,LOW); 
}

// BACKWARD 
void Backward(){
   digitalWrite(ForwardSpeed,200);
  digitalWrite(BackwardSpeed,200);
  digitalWrite(LeftMotorBackward,HIGH);
  digitalWrite(RightMotorBackward,HIGH);
  digitalWrite(LeftMotorForward,LOW);
  digitalWrite(RightMotorForward,LOW);
}

// TURN RIGHT 
void Right(){
   digitalWrite(ForwardSpeed,200);
  digitalWrite(BackwardSpeed,200);
  digitalWrite(LeftMotorForward,HIGH); 
  digitalWrite(RightMotorForward,LOW);
  digitalWrite(LeftMotorBackward,LOW);
  digitalWrite(RightMotorBackward,HIGH);
}

// TURN LEFT 
void Left(){
   digitalWrite(ForwardSpeed,200);
  digitalWrite(BackwardSpeed,200);
  digitalWrite(RightMotorForward,HIGH);  
  digitalWrite(LeftMotorForward,LOW);
  digitalWrite(LeftMotorBackward,HIGH);
  digitalWrite(RightMotorBackward,LOW);
}

// STOP 
void Stop(){
   digitalWrite(ForwardSpeed,0);
  digitalWrite(BackwardSpeed,0);
  digitalWrite(LeftMotorBackward,LOW);
  digitalWrite(RightMotorBackward,LOW);
  digitalWrite(LeftMotorForward,LOW);
  digitalWrite(RightMotorForward,LOW);
}

Credits

roboattic Lab

roboattic Lab

10 projects • 9 followers
YouTube Content Creator Robotics Enthusiast

Comments