|Buy from US||Buy from UK||Buy from DE||Buy from IT||Buy from FR||Buy from ES||ここでご購入を！|
In this lesson, we will teach you how to install the OSOYOO V2.0 Raspberry Pi Robot Car basic frame work.
And we will use Python to make a simple program to make two motors in K1 and K3 move forward for 2 seconds then move backwards for two seconds. You will learn how python sends digital data to GPIO pins, how to send PWM (analog) signal to PCA9685 module.
If you are interested in C++ programming, this project has a C++ solution in following link:
OSOYOO Car chassis with two motors x1
OSOYOO Car motors and wheels x2
Raspberry pi 4 or 3 or 3B board x1 (NOT Included)
OSOYOO Model Pi motor driver board x1
OSOYOO PCA9685 compatible module x1
OSOYOO Voltage Meter x1
18650 Battery box x1
18650 batteries x2
Some jumper wires
1) Remove the protective film on upper and low car chassis (Each car chassis has one protective film).
2) Install 4 motors with Metal Motor Holders as follows.
3) Install 2 motors on lower car chassis with screw M3*10 (screws in metal motor holder package).
4) Install OSOYOO MODEL Pi motor driver module to car low chassis with 4pcs M2.5 plastic screws, plastic pillars and plastic nuts. (Please make sure you install the OSOYOO MODEL Pi motor driver module in correct direction.)
5) Install PCA9685 compatible board on lowcar chassis with 2pcs M2.5 plastic screws, plastic pillars and plastic nuts
6) Install voltage meter on low car chassis with 2pcs M2.5 plastic screws, plastic pillars and plastic nuts.
7) Install universal wheel on low car chassis with 2pcs M3x10 hex screws and M3 nuts.
8) Install 4pcs copper pillars on low car chassis with 4pcs M3x20 hex screws and M3 nuts.
9)You need to plug 2pin 20cm female to female cable and 3pin 20cm female to female cable on PCA9685 compatible board. Use 3pin 15cm female to female cable to connect voltage meter to model pi motor driver board.
10) Install raspberry pi board on low car chassis with 4pcs M2.5 plastic screws, plastic pillars and plastic nuts.
11) Install 18650 battery box on upper car chassis with 4pcs M3x10 screws and nuts.
12)Connect battery box connector to model pi board as per following graph.
ENA connect to PCA9685 PWM0,ENB connect PCA9685 PWM1. K1 and K2 are same, K3 and K4 are same, see following pictures:
12) Connect upper chassis to lower chassis with 4pcs M3*10 hex screws and 4pcs M3 rubber rings, then install 2 wheels onto the motors.
The most important part in this project is OSOYOO Model-Pi motor drive board- an improved L298N module which can power motor and Raspberry Pi at the same time.
OSOYOO Model-Pi L298N board is perfect motor driver board for Raspberry Pi portable applications such as robots, RC cars , drones , mini weather station etc.
This board supports all the features of L298N DC motor driver, in addition, it also has a USB 5V output port which can provide stable voltage to Raspberry Pi board.
I/O pins fully compatible with L298N including EnableA/IN1/IN2/IN3/IN4/EnableB. Two Channels of PWM output and to control left and right wheels. Each Channel has two output sockets (K1/K2 for right side wheels and K3/K4 for left side wheels)
There are 6 input-signal pins ENA,IN1,IN2,IN3,IN4,ENB and two pairs of output socket (K1/K2, K3/4) which connect to left and right motors.
Input power source can be 7.5v-24v batteries (we suggest using 2pcs tandem 18650 batteries etc, or 6pcs AAA Tandem AAA batteries, or , 2pcs Parallel 9V batteries for robot project).
USB port gives stable 5V/2.4A output.
Picture 1:Connect PCA9685 compatible board to raspberry pi board as per picture 1.
Picture 2:Connect Model Pi six control pins to the Raspberry Pi GPIO pins and PCA9685 Compatible module as picture 2.
Picture 3: Model Pi connection map to Raspberry Pi board as per picture 3.
ENA gets PWM signal (analog current signal) from raspberry pi or Arduino. If ENA current is high, K1,K2 will have higher rotation speeds.
ENB gets PWM signal (analog current signal) from raspberry pi or Arduino. If ENB current is high, K3,K4 will have higher rotation speeds.
IN1, IN2 digital input pins determine the rotation direction of K1,K2 motor. If IN1=HIGH(1), IN2= LOW (0), motor in K1 or K2 moves forward. If IN1=LOW, IN2= HIGH, K1 or K2 motor moves backward. If IN1,IN2 have same voltage, K1/K2 motor does not move.
IN3,IN4 digital input pins determine the rotation direction of K3,K4 motor. If IN3=HIGH(1), IN4= LOW (0), the motor in K3 or K4 moves forward. If IN3=LOW, IN4= HIGH, K3 or K4 motor moves backward. If IN3,IN4 have same voltage , K3/K4 motor does not move.
|Download for free|
|Download for free|
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
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 :
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)
Step 3: Enable I2C
If you have not enable I2C, please run following command to enable I2C.
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 with following commands:
sudo pip3 install adafruit-circuitpython-pca9685 sudo pip3 install adafruit-circuitpython-servokit
Step 5: Type following command to download the sample code.
Then run following command:
We have write full comments in the sample Python code http://osoyoo.com/driver/picar/picar1.py . If you have some basic Python knowledge, you can easily understand how to customize the code for your own application.
DownLoad Url osoyoo.com