Note: ALL OSOYOO Products for Arduino are Third Party Board which is fully compatible with Arduino

Authorized Online Retailers

Where to buy the set with 18650 batteriese and USB charger

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

Buy the V2.1 Robot car without Battery and charger:

Buy from OSOYOO 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 distance sensors on robot car and program the car to follow object movements. The principle of this experiment is based on IR distance detection principle. The car receives the signal from the IR distance sensors, and then the program will drive the car to take actions.
You must complete lesson 1 (assembling the car) before you continue on with this lesson.

Parts and Devices:

No. Picture Device Qty. Accessories Link
1 IR distance Sensor 2 M3 Plastic Screw x 2
M3 Plastic Nut x 2
M3 Plastic Pillar x 2
Click here to buy
3 20Pin jumper wire Male to female 20cm some Click here to buy
3 Philips screwdriver 1 Click here to buy
4 Hex Screwdriver 1 Click here to buy
5 M3 plastic screw 2
6 M3 plastic pillar 2
7 M3 plastic nut 2


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 distance sensor onto the car. Install the IR distance sensors with 2pcs M3 plastic screws, M3 plastic pillars and M3 plastic nuts at the back of low car chassis.

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

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


Software Installation:

Open-source Arduino
Software(IDE)
Download IDE here:
https://www.arduino.cc/en/Main/Software?setlang=en
7 zip is a free zip
utility that un-zips zip files
Download 7zip here for free
https://www.7-zip.org/

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

Step 2: Download Lesson 3 sample code from https://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 OSOYOO basic board 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 your board.

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

Step 5: Turn on the car, put object about 10cm ahead of each IR distance sensors and adjust potentiometer on IR distance sensors 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 distance sensors detect object.
when object or your hand is over 10cm ahead, it will stop.

Note:
1) As IR distance sensors 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.