Car Calibration

Share for us
Share on facebook
Share on twitter
Share on pinterest
Share on whatsapp


Run the Server

Run the calibration server on the Raspberry Pi, and wait for client to connect.

Make sure that the circuit is connected properly. Power the smart car, open a terminal in Linux. Connect with your Raspberry Pi via the ssh. Go to the directory Sunfounder_Smart_Video_Car_Kit_for_RaspberryPi/server, run the server if the servo gets stuck with an abnormal sound, unplug the wires at once, and redo servo adjustment for calibration in case of further damages.

cd ~/Sunfounder_Smart_Video_Car_Kit_for_RaspberryPi/server

sudo python

Then the contents of config are printed and the last line: Waiting for connection…

At this time, the car might move a bit (this is the original position set)

Run the Client

Run the calibration client on PC to connect the server on Raspberry Pi.

For Windows users:

Unzip the code package you downloaded.

Click the Start button on your computer, and type in python in the search bar, and you can find the IDLE (Python GUI). Click it and then a window will pop up.

Click File -> Open -> Sunfounder_Smart_Video_Car_Kit_for_RaspberryPi-master -> client -> to open this file, modify the value of HOST for the IP address of the Raspberry Pi.

After modification, save the file and click the Run menu, and select Run Module.

For Linux users:

Open another terminal in Linux (not via ssh on your Pi). Find the sketch downloaded and edit client/

cd client/

sudo nano

Find the variable of HOST:

Enter your own address of the Raspberry Pi there. Press Ctrl+O to save and Ctrl+exit.


sudo python

No matter what system your computer is running on, Linux or Windows, when you run, a window Raspberry Pi Smart Video Car Calibration will pop up:

In the terminal remotely connected with the Raspberry Pi, the IP address of the PC will be printed.

Then you can start calibrating. Before that, take out your package box and place it vertically with the side face to the table. Put the car onside the box and keep it balanced. The purpose is to keep the wheels of the car off the table.

By default, the front wheels should be directly pointed towards the front; the camera on the tilt servo should be face up no matter what directions the pan servo is pointed at. If not, you may adjust the directions in Raspberry Pi Smart Video Car Calibration.

Start Calibration

On the calibration UI there are three sections: MotorTurning, and Mount.

Motor Adjustment

Click Run. The car will walk forward. Check whether both the back wheels move forward together. If either fails to do so, your wiring may be wrong. But don’t worry! You don’t need to rewire; just click the corresponding Reverse in Motor section of the Calibration window shown above. After clicking, observe whether the wheel you just adjusted is turning forward. If the reversing works normally, click Run again to stop the wheels from spinning.

Turning Adjustment

Currently the front wheels should be pointed at the exact front direction. But if it is not, you need to make some adjustments. In the Turning section in the Calibration window, click the left ( ) and right ( ) arrow buttons in the upper line to make fine adjustments, and those in the lower to coarsely adjust the turning direction. Keep adjusting until the wheels is oriented to the front exactly. Then you may place the car on the table and click Run to verify whether it runs in a straight line. If not, perform the adjustment again till it does.  

Mount Adjustment            

Now the pan servo on the car should be pointed at the exact front direction and the camera face up. But if not, you may need to adjust them similarly. In the Mount section, there are the adjustments for the pan servo and tilt one. Also you have two kinds of adjustments, fine and coarse. Keep adjusting until they are pointed at the right direction.

After all the adjustments are done, click Confirm.

And the program will exit.

Then the Raspberry Pi returns to the status: Waiting for connection…

Press Ctrl + C to exit.

———————————— NOW YOUR CAR IS READY TO GO! ———————————–

Get on the Road!

Run the Server

Run the TCP server on the Raspberry Pi, and wait for the client to connect to control the car.

You need two terminals to run the server. One is to run to receive commands to control the car, and the other to run mjpg-streamer to provide video streams. In Windows, you can use PuTTy to remotely log into the Raspberry Pi to start the server.

Open a terminal.

The Raspberry Pi may be still at the server directory:

pi@raspberrypi ~/Sunfounder_Smart_Video_Car_Kit_for_RaspberryPi/server $

If not, go to the directory with cd.

cd ~/Sunfounder_Smart_Video_Car_Kit_for_RaspberryPi/server

Then run

sudo python

The server program on the Raspberry Pi will be running and waiting for the client to connect to the Raspberry Pi.

Open another terminal. Log in the Raspberry Pi remotely, and switch to the directory under which the program of MJPG-streamer lies:

cd ~/Sunfounder_Smart_Video_Car_Kit_for_RaspberryPi/mjpg-streamer/mjpg-streamer

Run the program:

sudo sh

Then the video data acquisition will start, like this:

Type in the following address (replace with the IP address of your Raspberry Pi) at the address bar of your browser (Firefox is recommended):

Press Enter and you will see the view captured by the camera displayed on the screen in a real-time manner.

Run the Client

Run the client on PC to connect the server on the Raspberry Pi.

For Windows users:

Open the IDLE

Click File -> Open -> Sunfounder_Smart_Video_Car_Kit_for_RaspberryPi-master -> client -> client to open this file, modify the value of the HOST for the IP address of the Raspberry Pi.

After modification, save the file and select Run -> Run Module.

For Linux users:

Open another terminal again. But do not log into the Raspberry Pi remotely in this terminal. Go to the client with cd and edit the file

Similar to changes in calibration, change the IP address in client program in your PC: 

After the alteration, press Ctrl + O and save and Ctrl + X to exit.

Then run the client program:

sudo python

No matter what system your computer is running on, Linux or Windows, when you run the, the following window will appear on your screen:

You can click buttons such as Forward and Backward to control the car moving remotely. Or click X+X-Y+, and Y- to control the coverage of the camera.


The server program must be run before you run the client program. Some settings must be completed for the server before the service is done. A communication endpoint needs to be created for the server to “listen” to requests from the client. Take the server as a receptionist or an operator of the bus phone in a company. Once the phone and device installation is completed and the receptionist or operator is in place, the service begins.