Interfacing Raspberry pi with Motors
1 min readFeb 23, 2021
Interfacing L298N Motor Driver Module with Raspberry Pi will allow us to control a DC Motor (in fact, you can control two DC Motors). When I say to control a DC Motor, I mean you can start a motor, stop it, make it rotate in forwarding direction, backward directions, increase the speed of rotation, and also decrease the speed. For this, I’ll be using the L298N Motor Driver Module
Prerequisites
- Raspberry Pi with raspbian os installed
- Motor driver(LM298 or L293D Module & not the IC)
- Power supply(usually 12v)
- Female-Female jumper cables
Installation
- Make connections as shown in the diagram
- Connect the negative wire to raspberry pi zero GND pin
- Connect the motors to the driver (No polarity you can connect anyhow…functionality may vary according to the connection)
- Make a new file in raspberry pi
sudo nano filename.py
4. Copy and paste the code
5. Execute the program by typing
python3 filename.py