Unable To Get My Motors To Run Using L298 Motor Driver

Thread Starter

Utkarsh Verma

Joined Oct 30, 2016
102
I was making this project and after numerous hours worth of efforts, I was able to finish it. However, on powering up the project through a 9V battery (also tried two serial Li-ion 3.7V batteries as well). The PIC powers up fine but the motors don't power up. I also tried manually shorting 5V to the inputs, but no success. The results were same. I get 0V voltage reading on the motor outputs of L298. What to you think is causing the problem? Here is the schematic of L298 wiring used in the project. I also assure you that the rest parts of the project are working fine, only the L298 unit is faulty for some reason. Please help me debug it to get this LFR to work.
 
Last edited:

AlbertHall

Joined Jun 4, 2014
10,018
Where are the input pins to the L298 connected?
Are the using the code from that project entirely unchanged?
If not then please post the full code you are using.
 

AlbertHall

Joined Jun 4, 2014
10,018
Note that the diodes around the motors have to be able to handle the motor current. The 1N4148 is rated at 100mA, the 1N5818 is rated at 1A. I don't know how much current those motors draw.

the input pins are connected to PIC16f84a.
Which L298 pin is connected to which PIC pin?
 

Thread Starter

Utkarsh Verma

Joined Oct 30, 2016
102
Note that the diodes around the motors have to be able to handle the motor current. The 1N4148 is rated at 100mA, the 1N5818 is rated at 1A. I don't know how much current those motors draw.


Which L298 pin is connected to which PIC pin?
Input 1- PIC pin 6
Input 2- PIC pin 7
Input 3- PIC pin 8
Input 4- PIC pin 9
 

Thread Starter

Utkarsh Verma

Joined Oct 30, 2016
102
Note that the diodes around the motors have to be able to handle the motor current. The 1N4148 is rated at 100mA, the 1N5818 is rated at 1A. I don't know how much current those motors draw.


Which L298 pin is connected to which PIC pin?
how do i calculate the current draw? please help me
 

dendad

Joined Feb 20, 2016
3,564
It is pretty rough but will work....
Try holding your motor stalled and measure the current. Do it quick! That will be a good start for the diode rating.

Also, put a couple of LEDs in parallel but reversed, anode of one to the cathode of the other, and add a series 2K2 resistor. That will give you an "AC" led. Then connect it in place of the motor. Then you can see if he driver is running, and not worry about the motor current.
Can you see if the L298 inputs are changing? an LED with series resistor on each input is also a good debugging aid.
You need to determine if the PIC code is running.
 

Thread Starter

Utkarsh Verma

Joined Oct 30, 2016
102
It is pretty rough but will work....
Try holding your motor stalled and measure the current. Do it quick! That will be a good start for the diode rating.

Also, put a couple of LEDs in parallel but reversed, anode of one to the cathode of the other, and add a series 2K2 resistor. That will give you an "AC" led. Then connect it in place of the motor. Then you can see if he driver is running, and not worry about the motor current.
Can you see if the L298 inputs are changing? an LED with series resistor on each input is also a good debugging aid.
You need to determine if the PIC code is running.
Regarding the PIC, it is running. I know this because the project consists of several PIC based momentary switches. When I push those, the indicator LEDs do light up. That being stated, do you still think that I should test the L298 as you stated above? Also a rough schematic would be a great help. I was unable to understand what you wished to tell me.
 

Thread Starter

Utkarsh Verma

Joined Oct 30, 2016
102
Note that the diodes around the motors have to be able to handle the motor current. The 1N4148 is rated at 100mA, the 1N5818 is rated at 1A. I don't know how much current those motors draw.


Which L298 pin is connected to which PIC pin?
I was able to find out about the current draw of the motor when there is no load through a website. According to it, the current draw falls between 40-80mA when voltage is between 3-12V. Does this help?
 

Thread Starter

Utkarsh Verma

Joined Oct 30, 2016
102
Note that the diodes around the motors have to be able to handle the motor current. The 1N4148 is rated at 100mA, the 1N5818 is rated at 1A. I don't know how much current those motors draw.


Which L298 pin is connected to which PIC pin?
the instructable author had used 0.3A no load current motors while mine are a mere 80mA. Should the motor have higher current draw that 100mA(1N4148) or less than that. Please explain the whole thing.
 

shortbus

Joined Sep 30, 2009
7,760
In your first post you said you are using a 9V battery. If you mean one like in the image, that is the problem 9V but not a lot of current.
upload_2017-5-9_18-3-21.jpeg
 

dendad

Joined Feb 20, 2016
3,564
The diodes need to be able to conduct the current produced by the motor's back EMF.
This voltage is produced when the power to the motor is switched off. The magnetic field in the motor collapses and this change in the magnetic field across the motor windings acts as a generator and you need to dump the current somewhere otherwise the voltage produced can exceed the rating of the electronics and pop them. Also, if you turn the motor without it being driven it will work as a generator and the same applies to that. The diodes need to be able to conduct this current so need to be big enough to handle it.
It is not a question of having a motor to suit the diodes, but the diodes to suit the motor. Ideally you need diodes bigger then the capability of the motor to generate the current.
Also, when this "back EMF" (look it up) has a path, the motor will run smoother as this current produced in the switching actually runs through the motor and diodes and helps keep the motor running.
The same idea applies to any inductive load, like a relay. You will see a diode connected "backwards" across the relay to precent the large voltage spike produced when it switches off popping electronics or burning switch contacts.
Think of the ignition coil in a car. The spark is produced when the coil is switched off, not on. When he coil is powered, the current flowing through it builds a magnetic field around the coil, and when the power is removed, this magnetic field collapses rapidly. The faster the movement of a magnetic field across a coil the higher the voltage will be. Think of a generator. Spin it slow and there is little voltage produced, Spin it fast and more volts.
 

Thread Starter

Utkarsh Verma

Joined Oct 30, 2016
102
In your first post you said you are using a 9V battery. If you mean one like in the image, that is the problem 9V but not a lot of current.
View attachment 126371
I also thought of that, and so to check whether if it was a low current power supply issue, I soldered two 3.7V Lithium ion(800mAh each) batteries in series and hooked up my Line Follower to it. But I was still unable to get the motors to work.
 

Thread Starter

Utkarsh Verma

Joined Oct 30, 2016
102
The diodes need to be able to conduct the current produced by the motor's back EMF.
This voltage is produced when the power to the motor is switched off. The magnetic field in the motor collapses and this change in the magnetic field across the motor windings acts as a generator and you need to dump the current somewhere otherwise the voltage produced can exceed the rating of the electronics and pop them. Also, if you turn the motor without it being driven it will work as a generator and the same applies to that. The diodes need to be able to conduct this current so need to be big enough to handle it.
It is not a question of having a motor to suit the diodes, but the diodes to suit the motor. Ideally you need diodes bigger then the capability of the motor to generate the current.
Also, when this "back EMF" (look it up) has a path, the motor will run smoother as this current produced in the switching actually runs through the motor and diodes and helps keep the motor running.
The same idea applies to any inductive load, like a relay. You will see a diode connected "backwards" across the relay to precent the large voltage spike produced when it switches off popping electronics or burning switch contacts.
Think of the ignition coil in a car. The spark is produced when the coil is switched off, not on. When he coil is powered, the current flowing through it builds a magnetic field around the coil, and when the power is removed, this magnetic field collapses rapidly. The faster the movement of a magnetic field across a coil the higher the voltage will be. Think of a generator. Spin it slow and there is little voltage produced, Spin it fast and more volts.
I'm really grateful to you for explaining all this in such a good and elaborate way. I was able to understand the concept. However, I still don't get why am I being suggested by everyone to use another diode instead of 1N4148 when it can easily conduct the motor's current. As I had stated earlier my motor has current draw of 80mA while 1N4148 can withstand 100mA which is ideal. Then why do I need to replace it? Am I still missing something? On the side note, does the Back EMF's current (I looked it up just as you said) exceed the motor's current draw?
 
Top