Motor   Connection:

Circuit Connection:

下图 ENA IN1 IN2 IN3 IN4 ENB 指 Model Y的BOUT 侧控制线

Software Preparation:

Imager utility:

Win32DiskImager utility

Download for free
Format Tool:
SDformatter (Optional)
Download for free
SSH Tool:
PuTTY (for Windows users)
Download for free

Operation System for this robot car:  Raspberry Pi New Bullseye OS.

Step 1: Download  Raspberry Pi Bullseye Operation System(OS)  image file from following link:

Step 2: Connect Wifi

Firstly, Connect Raspberry Pi to your HDMI monitor or TV. Put a keyboard and mouse into Raspberry Pi USB ports. Insert an SD card into the slot on your Raspberry Pi.

Click on the wireless icon top right on the desktop, it should give a list of access points, select your wifi ssid and connect it. Once your Pi is connect to Wifi,

you can hover your mouse to the wifi icon to see your IP address, or your can type hostname -I command in the terminal. Your local ip address  will look like fd00:bc4d:fba4:fea2:c4a1:a409:4853:917d


in the above example, is your Raspberry Pi IP Address, you will use it in Step 3) ssh command.

Step 2:  Enable SSH 

press Ctrl-T and open command terminal. Then type :
sudo raspi-config

You will go to the configuration menu, select Interface Options ->SSH -> Yes ->OK ->Finish

Now reboot your Raspberry Pi, you can use Putty or SSH to remotely access raspberry pi.

Step 2:  use putty or ssh to connect your raspberry Pi by typing
ssh [email protected] (this address is from Step 1)

Admin: pi
Password: raspberry

Step 3: Enable I2C

If you have not enable I2C, please run following command to enable I2C.

sudo raspi-config

Then select Interfacing Options->I2C->Yes->Ok->Finish

Step 4: If you don’t have rpi.gpio and adafruit-pca9685 library, use the following command to install the library.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install rpi.gpio

Now install pca9685 and servokit library :
If you are using Bulleye OS, please run following commands:

sudo pip install adafruit-circuitpython-pca9685
sudo pip install adafruit-circuitpython-servokit

If you are using Bookworm system in Raspberry Pi 5, please run following commands:

sudo pip install  --break-system-packages adafruit-circuitpython-pca9685
sudo pip install  --break-system-packages adafruit-circuitpython-servokit

Step 5: Type following command to download the sample code.


Then run following command:


If you are running Bookworm OS, when you run above program, you might have an error message:

    GPIO.setup(IN1, GPIO.OUT)   
RuntimeError: Cannot determine SOC peripheral base address

Above message means your rpi.gpio library does not match Bookworm OS, you need to re-install the rpi.gpio library for Pi 5, please run following command:

sudo apt remove python3-rpi.gpio
sudo pip install  --break-system-packages rpi-lgpio

After re-install GPIO library, run command python again, the car will move accordingly.

After the above python is running, your motors will move forward for 0.75 seconds and then move backward for 0.75 seconds, turn left for 0.75 seconds and turn right for 0.75 seconds then stop.