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

Buy from US Buy from UK Besorgen DE Acquistare IT Acheter FR Comprar ES ここでご購入を!


In this lesson, we will do a line-tracking auto-driving project. 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.

Lesson 1 must be completed before doing this line-tracking project.


OSOYOO Mecanum wheels robotic car chassis x1
OSOYOO Wheels and motors x4 (left-wheels x2/right-wheels x2)
Raspberry pi 4/5 board ( Not included in this kit )
OSOYOO PWM HAT shield x1
OSOYOO Model Y driver board x1
OSOYOO Voltage meter x1
OSOYOO 5-point tracking sensor module x1
OSOYOO Battery box x1
OSOYOO 3pin female to female jumper wire x1
OSOYOO 6pin female to female jumper wire x2
OSOYOO 7pin female to female jumper wire x1
OSOYOO 2 pin XH.25 female to female x1
18650 Batteries(3.7V) x2
Battery charger x1


Step1. Keep all Lesson 1 connections intact. (Warning: Do not remove any pre-installed wires from Lesson 1).

Step2. Connect the GND and VCC pins of the tracking sensor module to the GND and 5V pins on the OSOYOO PWM HAT shield respectively. Then link the IR1-IR5 pins to GPIO5, GPIO6, GPIO13, GPIO16, and A1 using a 7-pin 25cm F/F cable, as shown in the photo below.

step3. To adjust the tracking sensor sensitivity:

Power on the battery box while holding the car stationary. Use a Phillips screwdriver to tune the potentiometer on each tracking sensor until optimal response is achieved:
Signal LED ON when detecting black tracks
Signal LED OFF when over white surfaces.

Run following command:

wget https://osoyoo.com/driver/mecanum/linetracking5.py
python linetracking5.py

Final Testing:

Prepare a black track (20-30 mm width) on a light-colored surface. Avoid sharp turns (minimum recommended radius: 15 cm) to prevent the car from losing tracking.

Power on the car and center the tracking sensor module over the black track. The car will then follow the track autonomously.