II.Parts and Devices
III.Hardware Installation
IV.Circuit Connection
V.Software Installation
VI.How to play

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 (2xleft-wheels/2xright-wheels and Motor x 4)
OSOYOO Mega2560 board fully compatible with Arduino UNO/Mega2560 x 1
OSOYOO V1.0 WIFI shield x 1
OSOYOO Model X motor driver x 2
OSOYOO 3-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 3-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 VCC pin of tracking sensor module to 5V of wifi shield;

Connect GND pin of tracking sensor module to GND of wifi shield

Connect L, C, R pins to D2, D3, D4 with 5pin 20cm female to female cable as the following photo shows (Remember: DO NOT remove any existing wires installed in Lesson 1).

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 https://www.arduino.cc/en/Main/Software?setlang=en , then install the software.

Step 2: Download https://osoyoo.com/driver/mecanum/mecanum-2560-lesson3.zip , unzip the download zip file mecanum-2560-lesson3.zip, you will see a folder called mecanum-2560-lesson3.ino .

Step 3: Connect Mega2560 board to PC with USB cable, Open Arduino IDE -> click file -> click Open -> choose code “mecanum-2560-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 on when sensor is above white ground, and the signal LED will turn off 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-lesson3.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.