User Manual
43
We can see 11 is the line follower’s i2c address. If it is not shown, it proves your wiring is not
correct and the i2c communication with Raspberry Pi fails too. You need to check the wiring
before the next step.
Run the test code
python test_line_module.py
pi@raspberrypi:~/SunFounder_PiCar-S/example/ $ python test_line_module.py
[58, 38, 84, 121, 112]
[58, 38, 84, 121, 112]
[58, 38, 84, 121, 112]
[58, 38, 84, 121, 112]
[59, 38, 84, 121, 112]
[58, 38, 84, 121, 112]
[58, 38, 84, 121, 112]
[58, 38, 84, 121, 112]
[58, 38, 84, 121, 112]
[58, 38, 84, 121, 112]
Calibrate the line follower
The IR sensor on the line follower should be calibrated before application. Run the line
following code python Line_Follower.py. The main program will print the data of 5 channels.
Place each of the five probes above the black line, and then above a white surface, so we
can get the gap between the two values. Adjust the potentiometer, and repeat the previous
operations to get the gap again. Thus we can get the optimal resistance of the pot when the
gap is the max value.
Step 3 Run the Code
Log into the Raspberry Pi via ssh on the computer, and get into the code directory
cd ~/SunFounder_PiCar-S/example
Run the line follower code
python line_follower.py
Calibrate the line follower on the car
A prompt of calibration will be printed on the screen when the program starts to run. We will
calibrate the module on a white surface first: place all the five probes of the line follower
above a white board. The prompt of completed calibration will be printed on the screen a
few seconds later. Then let’s move on to calibration on black line. Also the prompt of starting
is printed on the screen, and then place all the probes above the black lines. And the prompt
of calibration completed will be printed on the screen a few seconds later.
Starts Running!
When the module calibration is all completed, we can run the car then. Place the PiCar-S with
probes above the black line on the white board, and then it will go forward following the line