How to connect the Motor Driver to the Raspberry Pi Controller. Input Outputs Pro Preview

We have the L298N Motor Driver. Rear motors are connected to the driver. Now it is time to connect the Raspberry Pi. The Raspberry Pi will control the motor driver and from there the car motors.

  • #794
  • 23 Feb 2018


Input 1 to GPIO 27 - Forward; Input 2 to GPIO 22 - Backward; Input 3 to GPIO 23 - Left; Input 4 to GPIO 24 - Right;

Motor Drive Outputs

The structure of the driver is simple. We have the pins for controlling the motors. The back motor is connected to the left pins (Out1 and Out2). The front motor will be controlled by the right pins (Out 3 and Out 4) on the motor driver. So we use all the four output pins. We also have 4 input pins named 1 to 4. These four pins are connected to the output pins in the following way: Input 1 to Output 1. Input 2 to Output 2. Input 3 to Output 3. Input 4 to Output 4. Simple. The driver is built in such a way that the inputs are connected to the outputs. 

Here is the driver from below to understand where are the outputs:

Motor drivers inputs

The inputs receive signals from the controller. The inputs should be connected to the controller with the jumper cables. Picture:

If you look closely you could also see a small print next to the pins that are "In1","In2","In3","In4". In this way you know which pins are which. 

Connect them in the following way.

Motor Driver Input 1 to GPIO 27 - Forward 

Motor Driver Input 2 to GPIO 22 - Backward

Motor Driver Input 3 to GPIO 23 - Left

Motor Driver Input 4 to GPIO 24 - Right

If you need to remind yourself which GPIO is which take a look at the driver scheme


Courses and lessons with this Tutorial

This Tutorial is used in the following courses and lessons

Image for Perfect STEM course. Module 1 - Smart Car with Raspberry PI
Course icon fllcasts
  • 118
  • 42:47
  • 136
Image for Connecting Motor driver to Controller
Lesson icon fllcasts
  • 3
  • 0
  • 3
  • 3d_rotation 1