Control Toy Car Using Ir Technology

Introduction: Control Toy Car Using Ir Technology

As an eee engineering inquisitive about science and technology. And for me everything is some ho...

Inspired from my last project Segway, this instructables is all about a toy robot car controlled using T.V ir remote. I would use it to controlling segway with this stuff in the next one . Ok its all done with the help of arduino and ir sensors. The toy car can also vary its speeds using 4 speed levels you can find it in the VIDEO.

Step 1: You Need This!

All you need for this project is

Arduino,

TV remote (ir)

L293D driver shield

2 BO motors and wheels

,2 9V battery,

IR sensor TSOP SM0038

Wires etc.

Driver shield using motor driver L293D can be made easily using circuits from net I have ready made.

Step 2: Just Build It..

Prepare robot base using cardboard; set motors and wheels as adjustable. I have not used balance wheel as it wont required.

You need to add IR remote library for programming

Find codes of your IR remote using examples of IR remote library.

#include

int RECV_PIN = 12;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()

{ Serial.begin(9600);

irrecv.enableIRIn();

}

void loop() {

if (irrecv.decode(&results))

{ remote = results.value;

Serial.println(remote);

irrecv.resume();

}}

Step 3: Program It

Forgot about connections! is very simple connect as below

//motorn pins

PWM 5-- left motor input 1

PWM 6-- left motor input 2

PWM 9-- right motor input 1

PWM 10-- right motor motor input 2

//IR receiver

Arduino pin 12--output of IR

+3vcc--- Vcc of ir

GND-- gnd of ir

I have attached the codes you can directly upload it

#include

int RECV_PIN = 12;

IRrecv irrecv(RECV_PIN);

decode_results results;

int remote = 0;

int spd = 0;

int s1 = 100;

int s2 = 150;

int s3 = 200;

int s4 = 250;

void setup()

{

pinMode(5, OUTPUT);

pinMode(6, OUTPUT);

pinMode(9, OUTPUT);

pinMode(10, OUTPUT);

Serial.begin(9600);

irrecv.enableIRIn(); }

void loop() {

if (irrecv.decode(&results))

{ remote = results.value;

Serial.println(remote);

irrecv.resume();

}

if (remote == 10965)

{

spd = s1; }

else if (remote == 26775)

{ spd = s2; }

else if

(remote == -22441)

{ spd = s3; } else if

(remote == 2805)

{ spd = s4; }

if (remote == 22695)

{ analogWrite(5, spd); digitalWrite(6, LOW); digitalWrite(9, LOW); analogWrite(10, spd);

} else if (remote == -7651)

{ digitalWrite(5, LOW); digitalWrite(6, LOW); digitalWrite(9, LOW); analogWrite(10, spd); }

else if (remote == -8161)

{ analogWrite(5, spd); digitalWrite(6, LOW); digitalWrite(9, LOW); digitalWrite(10, LOW); }

else if (remote == 4845 ) { digitalWrite(5, LOW); analogWrite(6, spd); analogWrite(9, spd); digitalWrite(10, LOW); }

else if (remote == -16321 ) { digitalWrite(5, LOW); digitalWrite(6, LOW); digitalWrite(9, LOW); digitalWrite(10, LOW); }

}

Step 4: Play Time

Turn power on and first select the speed level 1,2,3or 4 otherwise it won't work simple pressing forward reverse button.

Please comment if you liked it.....

Share

    Recommendations

    • Water Contest

      Water Contest
    • Metalworking Contest

      Metalworking Contest
    • Creative Misuse Contest

      Creative Misuse Contest

    Discussions