Buy from US Buy from UK Buy from DE Buy from IT Buy from FR Buy from ES
amzus amzuk

I. Objective:

In this tutorial, we will use KOOKYE Smart tank car to make a simple remote controlled smart car. Once the car installation is completed, we will use a Infrared Remote to control the car movements including go forward, go back, left turn and right turn.

II. How it work

There is a IR receiver and remote control. The arduino board would translate the programs to the predefined behaviors once it receive the IR signals from remote control.

III. Software Installation:

Step 1: Install latest Arduino IDE (If you have Arduino IDE version after 1.1.16, please skip this step)
Download Arduino IDE from https://www.arduino.cc/en/Main/Software?setlang=en , then install the software.

Step 2: Install IRremote library into Arduino IDE (If you have already installed IRremote library, please skip this step)
Download IRremote library from http://www.kookye.com/download/car/IRremote.zip, then import the library into Arduino IDE(Open Arduino IDE-> click Sketch->Include Library->Add .Zip Library)

Step 3:Download Lesson 4sample code from http://www.kookye.com/download/car/tank_robot_lesson4.zip , unzip the download zip file tank_robot_lesson4.zip, you will see a folder called tank_robot_lesson4.

Step 4: Connect UNO R3 board to PC with USB cable, Open Arduino IDE -> click file -> click Open -> choose code “tank_robot_lesson4.ino” in tank_robot_lesson4 folder, load the code into arduino.


Step 5:Choose corresponding board and port for your project,upload the sketch to the board.


IV. Understanding the Code:

Part 1: Define the button that you will be using on IR remote control. (If you use the lesson 1example code, the arduino IDE Serial Monitor will output its counterpart IR code.)

#define IR_ADVANCE       0x00FF18E7       //code from IR controller "▲" button
#define IR_BACK          0x00FF4AB5       //code from IR controller "▼" button
#define IR_RIGHT         0x00FF5AA5       //code from IR controller ">" button
#define IR_LEFT          0x00FF10EF       //code from IR controller "<" button #define IR_SERVO 0x00FF38C7 //code from IR controller "OK" button #define IR_OPENLED 0x00FFB04F //code from IR controller "#" button #define IR_CLOSELED 0x00FF6897 //code from IR controller "*" button #define IR_BEEP 0x00FF9867 //code from IR controller "0" button

Part 2:The function on IR Remote Control

Button Function
go forward
go back
> turn right
< turn left
OK servo rotate
# turn on LED
* turn off LED
0 buzzer beep

Part 3: Define movement name for each button.

enum DN
  GO_ADVANCE, //go ahead
  GO_LEFT, //left turn
  GO_RIGHT,//right turn
  GO_BACK,//go back
  MOVE_SERVO,//move servo
  OPEN_LED,//open led
  CLOSE_LED,//close led
  BEEP,//control buzzer

Part 4:Decode the IR signal and translate button code into movment name. void do_IR_Tick()

void do_IR_Tick()

    else if(IRresults.value==IR_RIGHT)
    else if(IRresults.value==IR_LEFT)
    else if(IRresults.value==IR_BACK)
    else if(IRresults.value==IR_SERVO)
    else if(IRresults.value==IR_OPENLED)
    else if(IRresults.value==IR_CLOSELED)
    else if(IRresults.value==IR_BEEP)
    IRresults.value = 0;

Part 5: Execute movement function as per movement name from Part 4.

void do_Drive_Tick()
    switch (Drive_Num) 
      case GO_ADVANCE:
            go_ahead(10);JogFlag = true;JogTimeCnt = 1;JogTime=millis();break;//if GO_ADVANCE code is detected, then go advance
      case GO_LEFT:
            turn_left(10);JogFlag = true;JogTimeCnt = 1;JogTime=millis();break;//if GO_LEFT code is detected, then turn left
      case GO_RIGHT:
            turn_right(10);JogFlag = true;JogTimeCnt = 1;JogTime=millis();break;//if GO_RIGHT code is detected, then turn right
      case GO_BACK:
            go_back(10);JogFlag = true;JogTimeCnt = 1;JogTime=millis();break;//if GO_BACK code is detected, then backward
      case MOVE_SERVO:
            move_servo();JogFlag = true;JogTimeCnt = 1;JogTime=millis();break;//move servo
      case OPEN_LED:
            open_led(1),open_led(2);JogTime = 0;break;//open led
      case CLOSE_LED:
            close_led(1),close_led(2);JogTime = 0;break;//close led
      case BEEP:
            control_beep();JogTime = 0;break;//control beep
   //keep current moving mode for  200 millis seconds
      if(JogFlag == true) 
        stopFlag = false;
        if(JogTimeCnt <= 0) { JogFlag = false; stopFlag = true; } JogTimeCnt--; } if(stopFlag == true) { JogTimeCnt=0; go_stop(); } } }

V. Hardware Installation:

Step 1: Install expansion board on UNO R3 board.

Step 2: Move the wire connected to pinout(GND,VCC,S) in IR recevier to the counterpart pin in expansion board as the following picture.

Step 3: Turn the switch of expansion board to "1" and "2" position, as the following photo shows.


Step 4: Put two 12865 batteries in battery box and turn the swith of box to "ON". (If you have finished the above steps on lesson one, please skip these steps)
Step 5:

Press IR controller keys to control the car movements as per predefine code.

Note: Please check the wire connections if the tank car can not work as expected.

Your browser does not support the video tag.
Youtube link--https://youtu.be/xc3YXAJL8mY