Hi everyone. This my new project IR remote control robot
using arduino. This is a simple design robot you can easily build it.
Project requirements:
- Arduino uno
- Tsop1738 (ir receiver)
- H bridge ic (L293D)
- Two dc motor
- A robot base
- 9v Battery
For The circuit diagram refer the bellow device pin
description and make connection to arduino based on the program of the robot:
Important: connect ir receiver out to arduino digital pin 11
only.
- Connect arduino pin 7- l293d IN 1 pin 2
- Connect arduino pin 6- l293d IN 2 pin 7
- Connect arduino pin 5- l293d IN 3 pin 11
- Connect arduino pin 4- l293d IN 4 pin 15
- Connect two motor show like bellow image
Project step 1: read
your IR remote button value using
serial monitor.
First do
the circuit connection shown above and download the ir remote library file for
arduino IDE. And copy the library file in the arduino libraries folder.
And then run the arduino ide select sketch like that given
bellow
File -> examples->IR
remote->IR recv demo
Upload the sketch to arduino and open serial monitor. Press
the TV IR remote (any company) in front of
ir receiver then you will see the decode hex code in serial monitor
(example : FF30CF). the code will vary according to the remote company. Press
any 5 button in remote and note down the codes shown in the serial monitor for
programming purpose.
Project step2: upload IR robot code and
play
This is the code for IR robot:
Type your 5 button s
code in if else if statement in bellow code. The shown value is my remote
value.
Use 5 button to control robot forward, reverse, left right
and stop
#include <IRremote.h>
int RECV_PIN = 11;
int statusled = 13;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
irrecv.enableIRIn();
pinMode(statusled,OUTPUT);
pinMode(8,OUTPUT);
pinMode(7,OUTPUT);
pinMode(6,OUTPUT);
pinMode(5,OUTPUT);
pinMode(4,OUTPUT);
digitalWrite(statusled,LOW);// Start the receiver
}
void loop() {
digitalWrite(8,HIGH);
if
(irrecv.decode(&results)) {
digitalWrite(statusled,HIGH);
irrecv.resume();
if (results.value
== 0xFF50AF){ // 0xtype your IR
remote button value note down in the previous step
digitalWrite(7,HIGH);
digitalWrite(6,LOW);
digitalWrite(5,HIGH);
digitalWrite(4,LOW);
}else
if(results.value == 0xFF30CF){
digitalWrite(7,HIGH);
digitalWrite(6,LOW);
digitalWrite(5,LOW);
digitalWrite(4,LOW);
}
else
if(results.value == 0xFFB04F){
digitalWrite(7,LOW);
digitalWrite(6,LOW);
digitalWrite(5,HIGH);
digitalWrite(4,LOW);
} else if(results.value
== 0xFFD02F){
digitalWrite(7,LOW);
digitalWrite(6,HIGH);
digitalWrite(5,LOW);
digitalWrite(4,HIGH);
}else
if(results.value == 0xFF9867){
digitalWrite(7,LOW);
digitalWrite(6,LOW);
digitalWrite(5,LOW);
digitalWrite(4,LOW);
}
}
}
That it once you upload it you are ready to go connect the
robot with battery and play. I hope that you are all like my project
Thank you all
How did you manage 12V supply for your motors. You can't make those motors work on 9V battery that you used for arduino.
ReplyDeleteI enjoyed reading your article :) PLease continue publishing helpful topics like this. Regards, from Let's get gadget, a company whose into selling
ReplyDeleteremote extender
can i ask something??
ReplyDeletei have try it. but the coding is not correct.
it says 'error compiling for board arduino'