27 March 2016

Remote Controlled Car using Arduino Uno

Hey Buddies , Wanna control a car with just TV remote ? Here's what you need to learn

You would need IR library , only then you may successfully build it

Get IR library from here and put it on Libraries folder of Arduino in C drive(location where you have installed)




Fully constructed

Thing you need


Motor Shield

Arduino Uno



Components Required :-

1.Chassis
2.Wheels (one castor + two normal wheels)
3.Arduino uno
4,H bridge (L293D Motor Driver IC)
5. DC motors 500 RPM (2 pcs)
6.Breadboard
7.TSOP1738 IC
8. 9V battery (2 pcs)
9. Jumpers
10. TV remote 

Before directly connecting first we have to find the values of  TV remote , Follow the given connections.

Test Connection(for TSOP1738 and Arduino)

1.Arduino Vcc to pin 2
2.Arduino Gnd to pin 1
3.Arduino pin 6 to pin 3

After connecting in the mentioned way upload this code

                                        

Code :-

// lookforlk.blogspot.com
#include <IRremote.h>
int RECV_PIN = 6;//pin 6 of arduino to data pin of ir receiver
IRrecv irrecv(RECV_PIN);
decode_results results;

void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
}

void loop()
{
  if (irrecv.decode(&results))
    {
     Serial.println(results.value);
     irrecv.resume(); // Receive the next value
          delay(1000);

    }
}


Open the Serial Monitor and then try pressing different buttons ,  the value of the button pressed will be displayed on the Serial Monitor .

Designate 5 buttons
1.Forward
2.Reverse
3.Left
4.Right
5.Stop/Brake

Note down the values it will be used later


Full Connections:-


1.Arduino pin 6 to TSOP1738 IC
2.Arduino pin 8 to Motor Shield pin 2
3.Arduino pin 9 to Motor Shield pin 7
4.Arduino pin 10 to Motor Shield pin 10
5.Arduino pin 11 to Motor Shield pin 15
6.Arduino VCC to Motor Shield VCC
7.Arduino GND to Motor Shield GND
8.TSOP1738 pin 1 to Arduino VCC
9.TSOP1738 pin 2 to Arduino GND

Since you cannot connect more than one pin in Arduino Vcc and Gnd , connect the terminals in common and proceed

Code :-

#include <IRremote.h>
int lm=9;
int lmr=8;
int rm=10;
int rmr=11;

int RECV_PIN = 6;
IRrecv irrecv(RECV_PIN);
decode_results results;

void setup()
{
  pinMode(lm,OUTPUT);
  pinMode(lmr,OUTPUT);
  pinMode(rm,OUTPUT);
  pinMode(rmr,OUTPUT);
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
}

void loop()
{
  if (irrecv.decode(&results))
    {
     Serial.println(results.value);
     irrecv.resume(); // Receive the next value
    }
   //bot moves front
    if(results.value==1515192842)
    {
      digitalWrite(lm,LOW);
      digitalWrite(lmr,HIGH);
      digitalWrite(rm,HIGH);
      digitalWrite(rmr,LOW);
    }
    //bot moves back
    if(results.value==1519387146)
    {
      digitalWrite(lm,HIGH);
      digitalWrite(lmr,LOW);
      digitalWrite(rm,LOW);
      digitalWrite(rmr,HIGH);
    }
    //bot moves left
     if(results.value==1485832714)
    {
      digitalWrite(lm,LOW);
      digitalWrite(lmr,HIGH);
      digitalWrite(rm,HIGH);
      digitalWrite(rmr,HIGH);
    }
    //bot moves right
     if(results.value==1485832714)
    {
      digitalWrite(lm,HIGH);
      digitalWrite(lmr,HIGH);
      digitalWrite(rm,HIGH);
      digitalWrite(rmr,LOW);
    }
    //bot stops
    if(results.value==1217397258)
  {
      digitalWrite(lm,HIGH);
      digitalWrite(lmr,HIGH);
      digitalWrite(rm,HIGH);
      digitalWrite(rmr,HIGH);
    }
}
 
Note :-

Change the values in the if condition  


Construct the Body :-

Place the Motor and wheels in Chassis . Connect the terminals of DC motor to Motor shield (in any way , later it can be modified)

Power supply :-


1.Connect a 9v battery to Arduino .
2.Connect 9v battery to Motor shield.


Place everything on chassis and ready to go
 
 
 

For Queries :-
lkkarthikeya@gmail.com



04 March 2016

Laser Trip wire Alarm using Arduino Uno

                              Hey guys ,One more project on Arduino Uno , Laser trip wire Alarm . A laser light is used as wire, when someone tries to cross the laser line the alarm will blow out and alert everyone . This project has vast application but the one application that i loved very much is military where this laser system is installed in Border areas , If there is any trespassing bomb will explode and destroy the extremists . This project may be installed in Indian border areas where it covers vast area of 15,106.7 km of land border and a coastline of 7,516.6 km. OK now lets do it  ...


Components Required :-


1. Arduino UNO
2. Photoresistor
3. Resistor (5 kilo ohm or 10 kilo ohm)
4. Wires
5. Arduino IDE software.
6. Buzzer / LED
7. Laser light





Connection :-



These three terminals can be seen on Left side(Analog) of Arduino UNO

Also connect LED/ Buzzer to 13 and gnd


Here i have used a resistor(1 kilo ohm) after the photodiode . I don't want 5v supply to damage the analog pins since the laser light which when falls on the Photo resistor reduces it resistance and the light will fall on the photodiode for sometime in Real Time (Just a precaution to safeguard my kit).



Coding :-


First of all we must find the Threshold value. i.e The value of photoresistor when the laser light displayed on it and the value when laser light is not displayed on photoresistor .


In order to find threshold value the Test program is simulated first and my code is here :

// test program
//lookforlk.blogspot.in
// we need to find the threshold value

int analogpin =0;
int ldrval=0;

void setup() 
{
 Serial.begin(9600);
}

void loop()
 {
 ldrval = analogRead(analogpin);
 Serial.println(ldrval);
 delay(2000);
}

After loading this program into arduino UNO open the serial monitor



Now we have got the Threshold value


//lookforlk.blogspot.com

//lookforlk.blogspot.com

int ledpin=13;
int analogpin =0;
int ldrval=0;
int threshold = 500;


void setup()
{

pinMode(ledpin,OUTPUT);
//digitalWrite(ledpin,HIGH);

}

void loop()
{
  ldrval = analogRead(analogpin);
  if(ldrval > threshold )
  {
  digitalWrite(ledpin,LOW);
   delay(1000);
  }
  else
  {
    digitalWrite(ledpin,HIGH);
    delay(3000);
  }

}



Thats all , Fix the laser at one end and Photoresistor at other end

Check the video

You can add mirror and make refection and increase the distance between laser and photo diode . Try something cool