You can download the user manual from:  

https://osoyoo.com/manual/2021004700.pdf

Authorized Online Retailers

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

Objective

In this tutorial, we will use 5-line tracking sensor to guide Osoyoo Sport Car for Arduino to move along the black track line in the white ground automatically.

If you don’t complete the frame of car, please review lesson 1

Software Installation

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 un-zips zip files
Download 7zip here for free
https://www.7-zip.org/

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 Lesson 3 sample code , unzip the download zip file sg90car-lesson3.zip, you will see a folder called sg90car-lesson3 .
Step 3: Connect UNO R3 board to PC with USB cable, Open Arduino IDE -> click file -> click Open -> choose code “sg90car-lesson3.ino” in sg90car-lesson3 folder, load the code into arduino.
Notice: Shut off your battery or Unplug your power adapter when upload sketch code to Arduino.


Step 4: Please change the default value 90 in line 22 as the FRONT value in lesson 1. If you align the wheel direction manually as the option 1 in Step 5 of lesson1, please skip this step.

#define FRONT 90        // steering to front

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

Step 6: 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

Final Testing

1.Prepare a black track (the width of the black track is more than 20mm and less than 30mm) in white ground. Please note, the bend angle of track can’t be larger than 30 degree. If the angle is too large, the car will move out of the track.

2. Disconnect Arduino from PC and confirm that the power switch of the OSOYOO Motor Shield V1.1 is off, then put a 9V battery into battery box.
(Note: make sure polar direction is correct, otherwise it can destroy your device and cause fire hazard).

3. Put the car on the track, turn on the switch of OSOYOO Motor Shield V1.1, the car will move along the black track.
Note: If the car does not move as per above mentioned result, you should check your wire connection of tracking sensor, battery voltage (must over 7.2v).

4. If you want to change the angel of the right or left, please edit the line 23 to 26 of the code and upload the sketch again: ( Note: the angel can’t be set more than 35)

int SHARP_RIGHT=FRONT+33;
int SHARP_LEFT=FRONT-33;
int  RIGHT=FRONT+20;
int  LEFT=FRONT-20;

5. If you want to change the speed of the car, please revise the following code of the sketch  (Note: the max value is 255)

#define SPEED 90
#define FAST_SPEED 120 
#define MID_SPEED 100