Hello Friends and welcome to my blog.
     In this blog you will be learn how to make a TV IR remote control Car. To fully understanding this project first you need to study my previous blog "How to control LEDs from TV IR remote control" .Because for this project you need to learn.
1: How to Use IR sensor with Arduino , Download Library of IR sensor and use them.
2: How to take HEX code from Remote control.
 3: How to put these Hex codes in your project.
    After learn these topics. we need to modify our code a little bit and add some circuits to our project. The components that will be need for this project are.
Components :
   1:Arduino Uno, 2: IR sensor , 3:TV remote control , 4:Old RC Car we need the wheels and motors to move forward , reverse ,left and right. 5: LN298 Motors control module ,  5: 9 Volts battery ,  6: 4.8 volt battery, 7: 9V battery snap power cable to DC 9V clip male line battery adapter for Arduino UNO R3,   8: Jumper wires (male to female and male to male)


ln298 Motors Control Module:


Circuit diagram :



Sketch :

#include "IRremote.h"

//Declare Constants

int receiver = 11; // pin 1 of IR receiver to Arduino digital pin 11
//Declare objects
IRrecv irrecv(receiver);           // create instance of 'irrecv'
decode_results results;             // create instance of 'decode_results'
    //Declare Variables 
   int fspeed = 160;                            // Motor speed
    
int ML = 10;
int MRT = 9;
int MF = 6;
int MR = 5;

void setup()   // SETUP: RUN ONLY ONCE
{
  Serial.begin(9600);
  Serial.println("IR Receiver Raw Data + Button Decode Test");
  irrecv.enableIRIn();            // Start the receiver
   pinMode(ML, OUTPUT);        //Car Left
   pinMode(MRT, OUTPUT);      //Car Right
   pinMode(MF, OUTPUT);         //Car Forward
   pinMode(MR, OUTPUT);        //Car Reverse
 }         //(end setup )
void loop()   //( LOOP: RUNS CONSTANTLY )
{
  if (irrecv.decode(&results)) // have we received an IR signal?
{
    translateIR();
    irrecv.resume(); // receive the next value
  }
}      //(end main loop )

   //Declare User-written Functions )
void translateIR() // takes action based on IR code received

{
switch(results.value)
{
   case 0xEF807F:     //1
         digitalWrite(ML, HIGH);              // Turn left for 1 sec
        Serial.println("Left");
        digitalWrite(MRT, LOW);
       delay(1000);
       digitalWrite(ML, LOW);
       delay(500);
       break;

   case 0xEF40BF:    //2
          digitalWrite(ML, LOW);
          Serial.println("STOP");
          digitalWrite(MRT, LOW);
          delay(1000);
          break;
    
     
     case 0xEFC03F:  //3            // Turn right for 1 sec
          digitalWrite(ML, LOW);
          Serial.println("Right");
          digitalWrite(MRT, HIGH);
          delay(1000);
          digitalWrite(MRT, LOW);
          delay(500);
          break;
     
     case 0xEF20DF:   //4
         analogWrite(MF, fspeed);      // low speed  Forward
         Serial.println("Forward");
         digitalWrite(MR, LOW);
          delay(500);
          break;
     
  case 0xEFA05F:  //5
        digitalWrite(MF, LOW);
        Serial.println("Stop");
        digitalWrite(MR, LOW);
        delay(500);
        break;
     
  case 0xEF609F:   //6
        analogWrite(MR, fspeed);
        digitalWrite(MF, LOW);       
        Serial.println("Reverse");
        delay(500);
        break;
     
  case 0xEFE01F:   //7
      digitalWrite(ML, HIGH);
      Serial.println("right Turning ");
      digitalWrite(MRT, LOW);
      delay(500);
      break;
     
  case 0xEF10EF:   //8
         digitalWrite(ML, LOW);
         Serial.println("Left Turning");
         digitalWrite(MRT, HIGH);
         delay(500);
         break;
     
  case 0xEF08F7:   //volume up
        digitalWrite(ML, HIGH);   //Full speed forward
        Serial.println("Full speed forward ");
        digitalWrite(MRT, LOW);
        delay(500);
        break;
     
  case 0xEFF00F:   //volume down
        digitalWrite(ML, LOW);   //full speed reverse
        Serial.println("Full speed reverse ");
        digitalWrite(MRT, HIGH);
        delay(500);
        break;

 default:
     Serial.println(" other button   ");
   }
     delay(500);
}


 Project Images:

Post a Comment

Auto Gate HMI Animation VB.NET | Automatic Gate Open Close Application S...

Code: Public Class Form1     Private g As Graphics     'Private xPosition As Integer     Private yposition As Integer    Private Sub For...

 
Top