How to Control DC Motors With the Raspberry Pi
Whether it’s for a micromouse robot or a tiny IoT electric fan, knowing how to make things run using DC motors with the Raspberry Pi can unlock a broad range of creative DIY projects to keep you busy. For this guide, we are using an L298N motor controller in Raspberry Pi to send electricity to a pair of DC motors and make them spin!
Why the L298N Motor Controller Module?
The L298N motor controller module is a board that helps microcontrollers and microprocessors like the Raspberry Pi power DC motors that require more than the 3.3V or 5V they can supply.
It uses the L298N integrated circuit, powers all the logic and energy management needed to run motors, and isolates the Raspberry Pi from the higher voltage being run to the DC motors.
The L298N module is a staple motor controller in beginners’ DIY robotics kits because of its ease of use. It has header pins where you can insert jumper wires, connecting it to the Raspberry Pi without a hitch. You can also speed up or slow down the motors by applying pulse width modulation (PWM) signals to its “enable” pins.

On the circuitry side, the L298N is a form of a dual H-bridge circuit. It is actually a pair of H-bridge circuits, which is made out of a motor with four electronic switches. This allows you to set the direction of the current without having to physically rewire the motor. Reversing the current on one H-bridge also reverses the direction of the motor’s spin. The L298N has two of these, letting you control a pair of motors independently.

With that in mind, it’s time to get your hands working on some motors.
Read More: How to Control DC Motors With the Raspberry Pi – Make Tech Easier