Arduino Tank Car Kit Lesson 9:Object follow

Byamber

Arduino Tank Car Kit Lesson 9:Object follow


Authorized Amazon Seller

Robot Tank Car Chassis

Buy from US Buy from UK Buy from DE Buy from IT Buy from FR Buy from ES
amazon_com amazon_co_uk amazon_de amazon_it amazon_fr amazon_es

Robot Tank Car Electronic Parts Kit

Buy from US Buy from UK Buy from DE Buy from IT Buy from FR Buy from ES
amazon_es amazon_co_uk amazon_es amazon_es amazon_es amazon_es

I. Objective:

In this lesson, we will install 2pcs IR Obstacle Avoidance modules on robot car and program the car to follow object movements. The principle of this experiment is based on IR detection object. The car receives the signal from the IR Obstacle Avoidance module, and then the program will drive the car to take actions.

II. How It Work:

About Obstacle Avoidance Sensor

IR Obstacle Detection Module Pin Outs

The IR transmitter sends an infrared signal that, in case of a reflecting surface (e.g. white color), bounces off in some directions including that of the IR receiver that captures the signal detecting the object.

When the surface is absorbent (e.g. black color) the IR signal isn’t reflected and the object cannot be detected by the sensor. This result would occur even if the object is absent.

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:Download Lesson 9 sample code from https://kookye.com/download/Arduino_Tank_Car_Kit/tank-robot-lesson9.zip , unzip the download zip file tank_robot_lesson9.zip, you will see a folder called tank_robot_lesson9.

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

open

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

port

IV. Understanding the Code:

Step 1: Define the pinout of left and right tracking sensor.

#define RightObstacleSensor 2  //Right obstacle sensor to D2 (front direction is from arduino point to voltage meter)
#define LeftObstacleSensor 3   //Left obstacle sensor to D3

Step 2:Read the signal from tracking sensor and store the signal value.

Step 3:Read the signal from tracking sensor and store the signal value.

Step 4:Read the signal from tracking sensor and store the signal value.

V. Hardware Installation:

Step 1: Add 2pcs IR Obstacle Avoidance modules onto the car. Install the IR Obstacle Avoidance modules with 2pcs M3*10 plastic screws, M3 plastic pillars and M3 plastic nuts at the front of low tank chassis.

Step 2: Remove the wire connect to pinout of  car LED and then move the wire connected to pinout(OUT,GND,VCC) in IR obstacle avoidance sensor to the counterpart pin in expansion Board as the following picture.

Step 3: Turn the switch of esp8266 to “1” and “2” position, as the following photo shows.

lesson2-HW-2
Step 4: Turn on the tank, put object about 10cm ahead of each IR Obstacle Avoidance modules and adjust potentiometer on IR Obstacle Avoidance modules to detect object or your hand.

Note: When these module detect objects, the power indicator and signal indictor are on. when you move object over detection distance, the power indicator is on. If the signal indictor is always on even though the object is over detection distance, you also need to adjust the potentiometer.

Final Testing:

Turn on the car, move object or your hand ahead of car, and then the car will move accordingly: looks like you pull it. It goes forward when both IR Obstacle Avoidance modules detect object or your hand; it turns right when the right IR Obstacle Avoidance modules detect object; it turns left when the left IR Obstacle Avoidance modules detect object. when object or your hand is over 10cm ahead, it will stop.

About the Author

amber administrator

You must be logged in to post a comment