Control 4WD Robot With Tv Remote Using Arduino UNO and L293D

About: i'm a Arduino programer beginner

How to use your TV remote or any Remote control to control 4WD Robot,

No shield required ,

Connecting the 4 Motor with L293D ic ,

Step 1: First You Need to Know the Code for Every Remote Control Button You Need to Use

- Download IR remote library :

https://goo.gl/oh3Dcv

- Run IRrecvDemo example .

- Open the serial monitor , and push any button you need , and the code will appear in the serial monitor,

- Save all the button code , you will use it in your project

Step 2: Hardware Required

- Arduino UNO

https://goo.gl/a6Uq9C

- 4 Motor with wheel.

https://goo.gl/DgnZ7j

- L293D

https://goo.gl/zUxi2L

- IR Receiver .

https://goo.gl/E1sD1P

- TV Remote

- Battery's

https://goo.gl/NjV3s3

- Battery Holder

https://goo.gl/45PfkU

Step 3: Circuit Schematic & Component Assembly

I'm using L293D for control all the motor's :

Pin 1 +9+16 to 5v pin in arduino board .

Pin 2 to Arduino pin 3

Pin 3 to Motor 1

Pin 4+5 to GND

Pin 6 to Motor 1

Pin 7 to Arduino pin 5

Pin 8 to external 9v battery

Pin 10 to Arduino pin 9

Pin 11 to Motor 2

Pin 12 +13 to GND

Pin 14 to Motor 2

Pin 15 to Arduino pin 10

---------

IR Receiver

1 = Arduino Pin A0

2 = GND

3 = 3.3v

Step 4: Coding

#include
int motorL1 = 3; // Motor 1

int motorL2 = 5 ; // Motor 1

int motorR1 = 9 ; // Motor 2

int motorR2 = 10 ; // Motor 2

int IR = A0 ;

IRrecv irrecv(IR);

decode_results results

; void setup()

{ pinMode ( motorL1 , OUTPUT ) ;

pinMode ( motorL2 , OUTPUT ) ;

pinMode ( motorR1 , OUTPUT ) ;

pinMode ( motorR2 , OUTPUT ) ;

//-----------------

pinMode(IR, INPUT);

Serial.begin(9600);

irrecv.enableIRIn();

}

void loop()

{

if (irrecv.decode(&results)) {

if (results.value == 0xFF00FF) {

Serial.println ("FORWARD");

forward ();

delay ( 100 );

}

if (results.value == 0xFF807F) {

Serial.println ("BACKWARD");

backward ();

}

if (results.value == 0xFF40BF) {

Serial.println ("RIGHT");

right ();

}

if (results.value == 0xFFC03F) {

Serial.println ("LEFT");

left ();

}

if (results.value == 0xFFE01F)

{

Serial.println ("STOP");

STOP ();

}

irrecv.resume(); // Receive the next value

}

delay(100);

}

void forward ()

{

digitalWrite ( motorL1 , HIGH ) ;

digitalWrite ( motorL2 , LOW ) ;

digitalWrite ( motorR1 , HIGH ) ;

digitalWrite ( motorR2 , LOW ) ;

}

void backward ()

{

digitalWrite ( motorL1 , LOW ) ;

digitalWrite ( motorL2 , HIGH ) ;

digitalWrite ( motorR1 , LOW ) ;

digitalWrite ( motorR2 , HIGH ) ;

}

void right ()

{

digitalWrite ( motorL1 , LOW ) ;

digitalWrite ( motorL2 , HIGH ) ;

digitalWrite ( motorR1 , LOW ) ;

digitalWrite ( motorR2 , LOW ) ;

}

void left ()

{

digitalWrite ( motorL1 , LOW ) ;

digitalWrite ( motorL2 , LOW ) ;

digitalWrite ( motorR1 , LOW ) ;

digitalWrite ( motorR2 , HIGH ) ; }

void STOP ()

{

digitalWrite ( motorL1 , LOW ) ;

digitalWrite ( motorL2 , LOW ) ;

digitalWrite ( motorR1 , LOW ) ;

digitalWrite ( motorR2 , LOW ) ; }

Share

    Recommendations

    • Make it Glow Contest 2018

      Make it Glow Contest 2018
    • Optics Contest

      Optics Contest
    • Plastics Contest

      Plastics Contest

    Discussions