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

In this lesson3, we will add a 3-Point tracking sensor module to the robotic car built in Lesson 1.The software in this lesson will read data from the 3-Point Tracking sensor module and automatically guide the smart car to move along the black track line in the white ground.

OSOYOO Mecanum wheels robotic car chassis x 1 (2x left-wheels/2x right-wheels and Motor x 4)
OSOYOO Mega2560 board fully compatible with Arduino UNO/Mega2560 x 1
OSOYOO WIFI shield V1.3 x 1
OSOYOO Model X motor driver x 2
OSOYOO 5-Point Tracking sensor module
OSOYOO Battery box x 1
18650 Batteries(3.7V) x 2

You must complete lesson 1 (assembling the car), before you continue on with this lesson.

We will add a 5-Point tracking sensor module to the robotic car built in Lesson 3.

Start the installation from previous status of Lesson 1 .

If you have installed Lesson 1, no need change anything, just keep the hardware wire connection as it is.

Connect 5-point tracking sensor board to WIFI Shield as per following table.

Sensor Module IR1 IR2 IR3 IR4 IR5 VCC GND
Wifi Shield A0 A1 A2 A3 A4 5V GND

Open-source Arduino
Download Arduino IDE here:
7 zip is a free zip
utility that un-zips zip files
Download 7zip here for free

Step 1: Install latest Arduino IDE (If you have Arduino IDE version after 1.1.16, please skip this step). Download Arduino IDE from , then install the software.

Step 2: Download , unzip the download zip file, you will see a folder called lesson3 .

Step 3: Connect Mega2560 board to PC with USB cable, Open Arduino IDE -> click file -> click Open -> choose code “lesson3.ino” in lesson folder, load the code into Arduino as following:.

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

Step 5:Adjust the sensitivity of tracking sensor modules. Turn on and hold the car and adjust the potentiometer on the tracking sensor with cross screwdriver until you get the best sensitivity status: the signal indicate LED light will turn off when sensor is above white ground, and the signal LED will turn on when the sensor is above black track.

Prepare a black track (the width of the black track must be between 20mm and 30mm) in white ground. Please be noted that the bend angle of track can’t be too sharp otherwise the car will move out of the track.

Turn on the car and put the middle of tracking sensor module facing over black track, and then the car will move along the black track automatically.

Motor Speed Tuning for better tracking performance

To get better tracking performance result, motor power(speed) value should be adjusted properly as per battery level. If motor power(speed) value is too high, your car might run too fast and easy to get out of track. If motor power(speed) is too low, the car might not even move.

To adjust the motor power value, you need change the 3 constants : MID_SPEED, HIGH_SPEED,LOW_SPEED in line 13,14,15 in mecanum-2560-lesson3B.ino sketch file. Their default values are 70,80,60 which are good when batteries are fully charged.

After batteries are running low, you might need to increase the value of these 3 constants. You can gradually add or reduce 10 each time on these values and compare which values have best tracking performance.