Every electronics tutorial, book or course about Raspberry Pi or Arduino will use a motor driver. Very few of the courses will actually explain why do you need a Motor Driver, what is it for?
- 23 Feb 2018
- Reverse Engineering, Raspberry PI, Motor Driver, Basic, Learn At Home, Classes with students
The motors require an amount of current that is larger than the amount of current that the Raspberry Pi could handle. If we connect the motors and batteries directing to the Raspberry Pi, this will burn the controller. We need a motor driver to limit the current.
Below is a picture of a motor driver. This one is L298N H-bridge Dual Motor Controller Module 2A. It is very convenient because it is kind of large and it is easy to use it without soldering. It has a few screws that solve this problem for us.
So the convenience of the large size and that we could actually screw the cables is one advantage for our course. But this is not why Motor Drivers are used.
Driving the motors. It has to do with current.
The remote control car has a motor. It is a DC motor which means Direct Current. Which means that Current is flowing to make the motor rotate. But the amount of current that the motor needs, is larger than the amount of current that the Raspberry PI could handle before burning. This is actually all there is. For the motor to work, current must flow. It must flow from the batteries, through the raspberry pi and directly to the motor and back to the batteries. But this will burn the Raspberry Pi. It simply can not handle a current that large. Why is the Raspberry Pi designed like this will be a subject for another tutorial. Try searching the answer on your own on the Internet.
So the driver handles large current
It does a few other things. But the first reason we are using it is that it can handle current larger than what the Raspberry Pi can handle.
How does the final system work
The final system will work in the following way. The Batteries are connected to the driver. The motors are connected to the driver. The Raspberry Pi is connected to the driver. The current flows from the batteries to the driver, to the motors and back to the batteries. The Raspberry Pi only controls when should the driver allow the current to flow.
Imagine the driver as a water dam
The current from the batteries could be released to the motor. The driver is the big large concrete wall that could handle the current. The Raspberry Pi is the controlling the Spillways.
(picture of the Dam taken from https://commons.wikimedia.org/wiki/File:Condit_Dam.jpg)
Absolutely every electronics tutorial or book or course or anything connected with Raspberry Pi or Arduino will use a motor driver. It might look in a different way but it's a motor driver. Very few of the tutorials or courses or books will actually enter into more details why you need a motor driver and what it is for. Here is an explanation of why we need the motor driver. If we don't have a motor driver, we'll connect the car with the Raspberry and then we'll connect the Raspberry with the batteries. And then the current that will flow from the batteries through the Raspberry to the motors will be so big that it will burn the Raspberry. The Raspberry is not designed to handle such an amount of current. That's why we need a driver - a special element that can handle a larger current. So, we take the driver and we connect the car to the motor driver. We connect the batteries to the motor driver and we also connect the Raspberry to the motor driver. And the current is flowing from the batteries through the motor driver to the motor. And the Raspberry is on the side very far away just controlling the motor driver and telling it what to do - when to connect the batteries to the motor and when to stop. So, the Raspberry is just controlling the motor driver but the whole current flows through the motor driver because otherwise we would burn our Raspberry Pi. It is not designed to handle such current.