PDA

View Full Version : motor with l293d rotating slowly and jerking



007roy
08-14-2010, 08:32 PM
i am making a line follower.the whole circuit is done.i am using a comparator(lm324) a uc(atmega8l) and a motor driver(l293d).there are 4 white leds and 4 red leds and 4 pairs of ir sensors.the power source is a 12.6v 2000mAh(2C).to the driver i have connected two tiny motors.the specs of the motors are
Working voltage : 3V to 9V
4.2 Kgf.cm torque
No-load current = 60 mA, Stall current = 700 mA
i am giving a voltage of 8.6V to drive the motors from the same power source(it being multi cell)
the motor is rotating very slowly and jerking and the all the leds are flickering on the board.but when the motor is connected to the battery it rotates properly.what could be the reason?

lolman_returns
08-14-2010, 08:44 PM
Please make the motor voltage source different from the source that is powering the uC. A simple 9V battery should be good enough for your uC.

allbits
08-14-2010, 09:33 PM
The 293D will eat up some voltage, so the motor will run at a lower speed than when connected directly to the motor. The datasheet will have the exact ratings.
There is a high chance that your uc is getting reset, when the motor starts to spin, stop to spin or changes direction. this is because of the current surges developed by the coil in the motor.
I assume you have not connected any decoupling capacitors. connect a .1uf disk cap from VCC to GND whereever possible, close to the controller pins. That will do the trick. also connect a.22uf cap across the motor terminals.
That should do it, if your code is right, and I also assume you your code is running inside an infinite loop. (which does not meet the END statement.)

vikas
08-15-2010, 08:03 PM
1. Put decoupling cap's
2. Test motors and l29d without microcontroller connected ( Do they behave as expected ? )
3. When robot is on connected check current and voltage ( some number might be helpful )
4. If possible post pic , code and schematic.

Either is a decopling issue , or your motors are causing voltage drop and uC reset .

007roy
08-17-2010, 07:01 PM
I had connected two different power sources .The motor was only slightly faster but it was still jerking and the LEDs were still flickering . Then I connected 1N4007 diodes between the mircocontroller output pins and the the motor driver input pins . After this the LEDs were not flickering . The motors were also not moving(not even a bit) . On checking the voltages at all the pins of l293d motor driver without the motors connected this is what they read.
microcontroller output pin voltages:
0v,5v,5v,0v
motor driver input pin voltages:
1.6v,4.6v,4.6v,1.6v
motor driver output pin voltages:
8.6v,8.6v,8.6v,8.6v
I am not able to understand that when the uc is giving out 0 Volts on the pin how is the motor driver getting 1.6 Volts ?And how is the motor driver showing the same voltage on all four output pins ?Has this got anything to do with the diodes? I have even connected 1.0uF capacitors between Vcc and Gnd wherever possbile.

docel
08-18-2010, 01:36 AM
Instead of so many words and posts, why don't you post a drawing of your circuits?
http://www.roboticsindia.com/showthread.php/3588-l293d-trouble

1. We still don't know if your code is correct or not. Most beginners in microcontrollers write some weird PWM routines that expect the motors to switch on and off 20times /sec and the on time @ 1/20 of the off time. All it will do is 'jerk' ofcourse !
2. It is not clear whether you have used a 5v regulator.
3. how is the En pins connected?
4. Have you grounded both the Battery -ves together?
5. Are ALL the -ve pins connected together ?
6. White red and IR combo may not always work- assuming you're using white as indicators, Red as Source for the IR sensors. Just because someone told you or used Red LEDs with IR sensors does not mean it will work with YOUR sensors.
7. How do you know the LM324 is not oscillating?
8. You may be working under a Tube light and it is getting into the sensors, so switching the motors 50times /sec. ( apart from your PWM routine)
9. you might have connected 5v to pin8 & 12v or 8.6 to pin16.
10. The Opamp may not have oh! wait !!!
Are you using the LM324 as a Comparator or an Op-Amp ?
Ooof... am out of breath... but there are even more questions - maybe i'll wait for your response before I ask....

Instead, why not be a good boy and post the circuit diagram ? :)

007roy
08-18-2010, 08:22 AM
Sorry sir .But this is my first schematic .And the black rectangle is actually the ISP port which consists of 6 pins .When i made the diagram monochrome it turned out like this .There is a 5 volt regulator (IC7805) in the circuit but i did not draw it because it was getting complex .Wherever there is +5v written it is coming from the 7805 regulator .But I have no idea where to put capacitors in the circuit .I have just put two 0.1uF capacitors between the Vcc and the Gnd wherver possible close the MCU and those are the only places in the entire circuit i have put capacitors .As i told youll it is fairly accurate .Dont think i have not drawn something .If its not there here its not there in the circuit board also .The only things missing here are the power source and the 7805 regulator .There are no capacitors even across the regulator .Can you guys give me an idea of where all to install these capacitors ?Where else do i put these bypass capacitors ?I couldnt find the LM324 comparator in the library so i had two use these four op amps to give youll an idea .So please bear with me and try to help me out.

allbits
08-18-2010, 08:29 AM
i am not sure if i am getting old, or if the circuit diagram is actually small. cant read a thing.post a bigger one.
And you dont have to convert to monochrome!!

docel
08-18-2010, 08:53 AM
:) Yes Allbits !! Had to pull out my Lens do some extensive photoshopping :)

007roy :

1. Disconnect the indicator LEDs from the points at the Microcontroller.
2. Remove the series diodes between the Micro to the L293d inputs and connect directly.
3. connect a 12v battery to Pin8.
4. Check it out .
5. take a video of the entire thing when powered up and post.
6. Post the program

007roy
08-18-2010, 11:09 PM
Sir .I accept i have bitten more than i can chew .But once i am in between a project i wont quit no matter what .So i disconnected the LEDs and the diodes from the microcontroller output .I individually tested the motordriver and even before i connected the motors i noticed that even if i give only high(5 volts) input out of the four inputs of the motor driver all the four outputs were reading 12 volts.What could be the reason for this ?Does this mean that the motor drivers are fried ?Yet to connect the capacitors youll suggested.Will try with a new motor driver tomorrow.

docel
08-19-2010, 12:19 AM
Sir .I accept i have bitten more than i can chew .But once i am in between a project i wont quit no matter what .

That is quite a commendable attitude Roy - Keep it up !!! :) It is the ONLY way one can achieve success...

Now it is not clear what you did:
1. did you connnect +5v to only one input and all the outputs went to +12v ?
What happens when all the inputs are Low ?

2. If you 'shorted" the Op pin to the Gnd pin, as it happens accidently while measuring with a DMM, the outputs will be fried instantly.

3. You get wrong readings while measuring V from -ve to output pin. You must measure between the Output pins.

4. If the OP goes to hi with the inputs low, then the Chip is fried. it will also happen if the pins 4,5,12,13 are not properly grounded.

5. Check the op logic with a new IC with out connecting anything to the input pins. With no input, the Output should be around .8v to 1.6v with reference to Ground. When ONE of the inputs is high, only the corresponding Output should go high.

allbits
08-19-2010, 01:59 AM
still..

cant you give a BIGGER circuit dia?

007roy
08-19-2010, 09:40 AM
There is something fishy about the motors .I connected an ammeter and it was showing stall current is some 3 amps and running current was some 1.2 amps .Even though the site i bought them from mentioned otherwise .Will check it out today once again and confirm .

docel
08-19-2010, 12:28 PM
Aahh...... That will teach you to "check" the motors before connecting it to the Driver :(

THis means that the Motor has fried the L293D as it exceeds the current of 600ma max. along with the battery voltage dropping below useable thresholds.