Motor Connection:
See following Picture and connection map:
Circuit Connection:
下图 为Model Y B 区6根控制线连接方法
ENA IN1 IN2 IN3 IN4 ENB 指 Model Y的BOUT 侧控制线
下图 为Model Y A 区6根控制线连接方法
ENA IN1 IN2 IN3 IN4 ENB 指 Model Y的AOUT 侧控制线
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:
https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-legacy
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
192.168.50.182 fd00:bc4d:fba4:fea2:c4a1:a409:4853:917d
……
in the above example, 192.168.50.182 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.
wget https://osoyoo.com/driver/mecanum/mecanum.py
Then run following command:
python mecanum.py
Note:
If you are running Bookworm OS, when you run above picar-basic.py 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 mecanum.py 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 shift to right , then shift to left , then do some omni direction move and stop.
DownLoad Url osoyoo.com