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)

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.

Hardware Installation:


机械部分基本与老款树莓派小车相同,但是不再安装PCA9685 PWM控制器,本车将直接使用树莓派自带pwm信号控制小车马达。


Brief introduction of the I/O pins:

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 right and left motors, K1 and K2 are same, K3 and K4 are same, see following pictures:
Picture 1: Motor to Model-Pi board connection map.

ENA gets PWM signal (analog current signal) from raspberry pi or Arduino. If ENA current is high, K1,K2 will have higher rotation speed.
ENB gets PWM signal (analog current signal) from raspberry pi or Arduino. If ENB current is high, K3,K4 will have higher rotation speed.

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 has 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),motor in K3 or K4 moves forward. If IN3=LOW, IN4= HIGH, K3 or K4 motor moves backward. If IN3,IN4 has same voltage , K3/K4 motor does not move.

Picture 2: Model Pi connection map to Battery and Raspberry Pi board

Sample Application:

In following  example , 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.

First ,please connect the Raspberry Pi GPIO pins to Model Pi six control pins as picture 3:
Picture 3:

Then turn on the battery and use putty or ssh to connect your raspberry Pi.

1) If you  don’t have rpi.gpio library, use following command to install rpi.gpio library:
sudo apt-get install rpi.gpio

2)Type following command to download the sample code:
wget http://osoyoo.com/driver/modelpi.py
python modelpi.py

After above python is running, you motors will move forward for 2 seconds and then move backward for two seconds.

We have write full comments in the sample python code http://osoyoo.com/driver/modelpi.py . If you have some basic python knowledge, you can easily understand how to customize the code for your own application.