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


Mecanum Wheel Robot Car Full Package (with 18650 batteries)

Buy from US Buy from UK Buy from DE Buy from IT Buy from FR Buy from ES ここでご購入を!

The above robot cars are controlled by Arduino. If you have Raspberry Pi board, actually the robot car can also be controlled by Raspberry Pi. You can visit the following link to learn basic movement with Raspberry Pi.
Tutorial link: https://osoyoo.com/?p=31428



In this lesson3, we will add a 5-Point tracking sensor module to the robotic car built in Lesson 1.The software in this lesson will read data from the 5-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 x 1
OSOYOO Wi-Fi shield x 1
OSOYOO Model Y motor driver x 1
OSOYOO 5-Point Tracking sensor module
OSOYOO 3pin female to female jumper wire x1
OSOYOO 6pin male to female jumper wire x2
OSOYOO 7pin female to female jumper wire x1
OSOYOO 2 pin XH.25 female to female x1
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.

Step1: We have installed 2pcs M3x40 copper pillars with 2pcs M3 screws and 2pcs M3.5 rubber rings on tracking sensor in lesson1 as following pictures.

Step2. We have added a 5-Point tracking sensor module to the car chassis with M3 nuts in lesson1 as following pictures.

Start the installation from previous status of Lesson 1. If you have installed Lesson 1, no need to change anything, just keep the hardware wire connection as it is.

Step3 : Connect 5-point tracking sensor board to Wi-Fi Shield as per following picture.

Connect GND pin of tracking sensor module to GND of Wi-Fi shield;

Connect VCC pin of tracking sensor module to 5V of Wi-Fi shield;

Connect IR1,IR2,IR3,IR4,IR5 pins to A4, A3, A2,A1,A0 with 7pin female to female cable as the following photo shows (Remember: DO NOT remove any existing wires installed in Lesson 1).



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

Adjust the sensitivity of tracking sensor modules.

Turn on and hold the car and adjust the potentiometer on the tracking sensor with a Phillips screwdriver until you get the best sensitivity status: the signal indicator LED light will turn off when the sensor is above white ground, and the signal LED will turn on when the sensor is above black track.

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_metal_chassis_m2/m2-lesson3.zip, unzip the download zip file m2-lesson3.zip, you will see a folder called m2-lesson3.

Step 3: Connect Mega2560 board to PC with USB cable, Open Arduino IDE → click file → click Open → choose code “m2-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 a Phillips screwdriver until you get the best sensitivity status: the signal indicator LED light will turn off when the 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 20 mm and 30 mm) in white ground. Please be noted that the bend angle of the track can’t be too sharp, otherwise the car will move out of the track.

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

Important parameters in the sketch file

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 to change the 3 constants : MID_SPEED, HIGH_SPEED, LOW_SPEED in line 14,15,16 in m2-lesson3.ino sketch file. Their default values are 100,120,80 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.