Tishin
Published © CC BY-NC

IR Remote Controlled Car Using a Protoshield

Making a smart car kit smaller.

IntermediateFull instructions provided500
IR Remote Controlled Car Using a Protoshield

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Arduino Proto Shield
Arduino Proto Shield
I used a different protoshield for the IR remote project
×1
Dual H-Bridge motor drivers L293D
Texas Instruments Dual H-Bridge motor drivers L293D
The picture above is not the correct image. The correct component is a 16 pin IC. It is shown in the video and below.
×1
Linear Regulator (7805)
Linear Regulator (7805)
×1
IR Receiver EK8460
×1
3 mm LED: Red
3 mm LED: Red
×1
Resistor 1k ohm
Resistor 1k ohm
×1
Heatsink + Insulator/Mounting Kits for L7805
×1
Electrolytic Capacitor, 10 µF
Electrolytic Capacitor, 10 µF
×2
Single row female header 2 x 4 pin
×2
22 gauge solid core wire
×1
Tactile Switch, Top Actuated
Tactile Switch, Top Actuated
×1
DC Motor, 12 V
DC Motor, 12 V
3V - 6V is what I used
×2
Smart Car Wheels
×2

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free
Solder Flux, Soldering
Solder Flux, Soldering
Helping Hand Tool, with Magnifying Glass
Helping Hand Tool, with Magnifying Glass
Plier, Needle Nose
Plier, Needle Nose

Story

Read more

Schematics

IR REMOTE CAR SCHEMATIC

Code

IR REMOTE CONTROLLED CAR - l293D H-BRIDGE

Arduino
A remote controlled 2 wheel car that uses an L293D H-bridge, 2 3V-6V DC geared motors, an IR receiver and a remote.
/*
    IR_remcon_car_L293D

    A remote controlled 2 wheel car that uses an L293D H-bridge,
    2 3V-6V DC geared motors, an IR receiver and a remote.

    The circuit:
    * IR Receiver pin 7
    * L293D H-bridge pins 10,9,4,5,2,3

    Created 17 April 2022
    By VideotronicMaker
    https://videotronicmaker.com/
    
    based on the IR remote controlled car sketch 
    by Hosyond for the Hosyond Smart Car Kit

*/

#include <IRremote.h>
int RECV_PIN = 7;
IRrecv irrecv(RECV_PIN);
decode_results results;         // use IRrecvDemo from IRremote library by Ken Shirriff to get your remote codes
#define REM_FW     0x00FF629D   // defining remote button forward
#define REM_RV     0x00FFA857   // defining remote button reverse
#define REM_LF     0x00FF22DD   // defining remote button left
#define REM_RT     0x00FFC23D   // defining remote button right
#define REM_STOP   0x00FF02FD   // defining remote button stop
const int LFT_EN=5;             // Left Enable and Motor speed value from 0-255 on pin 5
const int RGT_EN=9;             // Right Enable and Motor speed value from 0-255 on pin 9
const int LEFT_MC1F=12;          // defining pin12 left reverse
const int LEFT_MC2B=6;          // defining pin6 left forward
const int RIGHT_MC1F=2;         // defining pin2 right reverse
const int RIGHT_MC2B=3;         // defining pin3 right forward
byte LPWM_val = 225;            // set speed of left motor using pwm (Set any value between 0-255)
byte RPWM_val = 225;            // set speed of right motor using pwm (Set any value between 0-255)
void M_Control_IO_config(void)  // Motor Control IO Function
{
  pinMode(LEFT_MC1F,OUTPUT);    // declare pin 4 to be an OUTPUT
  pinMode(LEFT_MC2B,OUTPUT);    // declare pin 5 to be an OUTPUT
  pinMode(RIGHT_MC1F,OUTPUT);   // declare pin 2 to be an OUTPUT
  pinMode(RIGHT_MC2B,OUTPUT);   // declare pin 3 to be an OUTPUT
  pinMode(LFT_EN,OUTPUT);       // declare pin 10 (PWM/speed value) to be an OUTPUT
  pinMode(RGT_EN,OUTPUT);       // declare pin 19 (PWM/speed value) to be an OUTPUT  
}
void Set_Speed(byte Left,byte Right)  //Function to set the speed.byte refers to
{                                     //the integer value set above at LPWM_val and RPWN_val
  analogWrite(LFT_EN,Left);           
  analogWrite(RGT_EN,Right);
}
void forward()                  // Function to move forward
  {
    digitalWrite(RIGHT_MC1F,LOW);
    digitalWrite(RIGHT_MC2B,HIGH);
    digitalWrite(LEFT_MC1F,LOW);
    digitalWrite(LEFT_MC2B,HIGH);
  }
void turnRight()                // Function to turn right
  {
    digitalWrite(RIGHT_MC1F,LOW);
    digitalWrite(RIGHT_MC2B,HIGH);
    digitalWrite(LEFT_MC1F,HIGH);
    digitalWrite(LEFT_MC2B,LOW);
  }
void turnLeft()                 // Function to turn left
  {
    digitalWrite(RIGHT_MC1F,HIGH);
    digitalWrite(RIGHT_MC2B,LOW);
    digitalWrite(LEFT_MC1F,LOW);
    digitalWrite(LEFT_MC2B,HIGH);
  }
void stopp()                    // Function to stop 
  {                             
    digitalWrite(RIGHT_MC1F,HIGH);
    digitalWrite(RIGHT_MC2B,HIGH);
    digitalWrite(LEFT_MC1F,HIGH);
    digitalWrite(LEFT_MC2B,HIGH);
  }
void reverse()                  // Function to go in reverse
  {
    digitalWrite(RIGHT_MC1F,HIGH);
    digitalWrite(RIGHT_MC2B,LOW);
    digitalWrite(LEFT_MC1F,HIGH);
    digitalWrite(LEFT_MC2B,LOW);
  }
void IR_Control(void)
{
   unsigned long Key;
   if(irrecv.decode(&results)) //check if serial port receives data   
 {
     Key = results.value;
    switch(Key)
    {
      case REM_FW:forward();    //Up arrow button on remote
      break;
      case REM_RV:reverse();    //Down arrow button on remote
      break;
      case REM_LF:turnLeft();   //Left arrow button on remote
      break;
      case REM_RT:turnRight();  //Right arrow button on remote
      break;
      case REM_STOP:stopp();    //OK button on remote
      break;
      default:
      break;
    }
    irrecv.resume();            //recieve the next value
  }

}
void setup() 
{
  M_Control_IO_config();         // 
  Set_Speed(LPWM_val,RPWM_val);
  irrecv.enableIRIn();          //Enable the receiver
  Serial.begin(9600);           //Initialize the serial port, Bluetooth used as serial port, setting baud ratio at 9600 
  stopp();
}

void loop() {
  IR_Control();                 // Main code to run repeatedly

}

Credits

Tishin

Tishin

1 project • 10 followers

Comments