Intrroduction
Step 1 : Install IR remote library by ken shirrif using manage library option under sketch menu .
Step 2: afterintalling library go to examples and select irremote from the list and the go to IrRecvdemo program and upload the program to the arduino and connect tsop only to the arduino.
Step 3: Open serial monitor and use your remote to get the codes from remote keys and note them down.
Step 4 : replace the code (marked below in red) lines looking similar to this -------
if(results.value==0x1039789F) with your remote keys code in the following program and upload it.
Step 5 :- connect motor driver and tsop and your robot is complete.
Code of the project :-
/*
* IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv
* An IR detector/demodulator must be connected to the input RECV_PIN.
* Version 0.1 July, 2009
* Copyright 2009 Ken Shirriff
* http://arcfn.com
*/
#include <IRremote.h>
int RECV_PIN = 9;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
// In case the interrupt driver crashes on setup, give a clue
// to the user what's going on.
Serial.println("Enabling IRin");
irrecv.enableIRIn(); // Start the receiver
Serial.println("Enabled IRin");
}
void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
if(results.value==0x1039789F)
{
digitalWrite(13,HIGH);
digitalWrite(12,LOW);
digitalWrite(11,HIGH);
digitalWrite(10,LOW);
}
else if(results.value==0xBB8B3E9E)
{
digitalWrite(13,LOW);
digitalWrite(12,HIGH);
digitalWrite(11,LOW);
digitalWrite(10,HIGH);
}
else if(results.value==0x45481702)
{
digitalWrite(13,LOW);
digitalWrite(12,LOW);
digitalWrite(11,HIGH);
digitalWrite(10,LOW);
}
else if(results.value==0xF0B4BB43)
{
digitalWrite(13,HIGH);
digitalWrite(12,LOW);
digitalWrite(11,LOW);
digitalWrite(10,LOW);
}
else if(results.value==0xB8E7B4FE)
{
digitalWrite(13,HIGH);
digitalWrite(12,HIGH);
digitalWrite(11,HIGH);
digitalWrite(10,HIGH);
}
irrecv.resume(); // Receive the next value
}
delay(100);
}
Connections of the project :-
TSOP(1738) Arduino
VCC 3.3v
GND GND
OUT pin 9
Step 1 : Install IR remote library by ken shirrif using manage library option under sketch menu .
Step 2: afterintalling library go to examples and select irremote from the list and the go to IrRecvdemo program and upload the program to the arduino and connect tsop only to the arduino.
Step 3: Open serial monitor and use your remote to get the codes from remote keys and note them down.
Step 4 : replace the code (marked below in red) lines looking similar to this -------
if(results.value==0x1039789F) with your remote keys code in the following program and upload it.
Step 5 :- connect motor driver and tsop and your robot is complete.
Code of the project :-
/*
* IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv
* An IR detector/demodulator must be connected to the input RECV_PIN.
* Version 0.1 July, 2009
* Copyright 2009 Ken Shirriff
* http://arcfn.com
*/
#include <IRremote.h>
int RECV_PIN = 9;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
// In case the interrupt driver crashes on setup, give a clue
// to the user what's going on.
Serial.println("Enabling IRin");
irrecv.enableIRIn(); // Start the receiver
Serial.println("Enabled IRin");
}
void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
if(results.value==0x1039789F)
{
digitalWrite(13,HIGH);
digitalWrite(12,LOW);
digitalWrite(11,HIGH);
digitalWrite(10,LOW);
}
else if(results.value==0xBB8B3E9E)
{
digitalWrite(13,LOW);
digitalWrite(12,HIGH);
digitalWrite(11,LOW);
digitalWrite(10,HIGH);
}
else if(results.value==0x45481702)
{
digitalWrite(13,LOW);
digitalWrite(12,LOW);
digitalWrite(11,HIGH);
digitalWrite(10,LOW);
}
else if(results.value==0xF0B4BB43)
{
digitalWrite(13,HIGH);
digitalWrite(12,LOW);
digitalWrite(11,LOW);
digitalWrite(10,LOW);
}
else if(results.value==0xB8E7B4FE)
{
digitalWrite(13,HIGH);
digitalWrite(12,HIGH);
digitalWrite(11,HIGH);
digitalWrite(10,HIGH);
}
irrecv.resume(); // Receive the next value
}
delay(100);
}
Connections of the project :-
TSOP(1738) Arduino
VCC 3.3v
GND GND
OUT pin 9
2. Connections for L293D module:-
Here in L293d motor driver at the top we have total 7 pins . 4 Pins are used for controlling the motor and 3 pins in the middle of the l293d module are used for powering the module.
Connect the arduino and L293d as follows:-
Arduino Pins:- L293d Motor Driver
Pin 13 M1 a // for controlling motor 1
Pin 12 M1 b
Pin 11 M2 a // for controlling motor 2
Pin 10 M2 b
Vin 12v
Gnd Gnd // providing power to L293d module
5v 5v
Comments
Post a Comment