Authorized Online Retailers

Buy from US Buy from UK Buy from DE Buy from IT Buy from FR Buy from ES Buy from JP

 

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.

Parts and Devices:


Hardware Installation

Install devices

Step 1: Install the smart car basic frame work as per Smart Car Lesson 1 . If you have already completed installation in Lesson 1 , just keep it as is.

Step 2: Remove the screws on copper pillars and add 2pcs IR Obstacle Avoidance modules onto the car. Install the IR Obstacle Avoidance modules with 2pcs M2.5*10 plastic screws, M2.5 plastic pillars and M2.5 plastic nuts at the back of low car chassis.

Step 3: Connect 2pcs IR Obstacle Avoidance modules as below connection diagram (Remember : DO NOT remove any existing wires installed in Lesson 1 ) :

下图电路有误,Left Sensor connect to D3,Right Sensor to D2

Step 4: Fix the screws on copper pillars to connect upper chassis to lower chassis.

Step 5: Turn on the car, 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 dectection distance, you also need to ajust the potentiometer


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 One sample code from http://osoyoo.com/driver/v2smartcar-lesson3.zip , unzip the download zip file v2smartcar-lesson3.zip, you will see a folder called v2smartcar-lesson3 .

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

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


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.

Note:
1) As IR Obstacle Avoidance modules are installed at the back of the car, all movement directions are contrary to other courses.
2) The car can only move forward, turn right and turn left, but cannot move backward.