PDA

View Full Version : DC motor control problem



yamanoorsai
10-25-2007, 11:02 PM
Hi,
I am using a ready made microcontroller board where the DC motors are already connected to the AtMega16 Microcontroller through L293D. I am able to control my motor. Yet I face a small problem. One of the motor is running at a very small speed even I switch off the motor control switch when I microcontroller and L293D are switched ON.
When I switch on and start controlling through the microcontroller, one motor is rotating at a faster rate than the other. I tried measuring the voltage at the terminals. Surprisingly, one of the motor is being supplied a voltage at least twice than the other. The motor which gets the maximum voltage is actually running slower than the normal one. What could be the problem?

Should we call it a error in the code?
here is the sample code which I used:

for(;1;)
{
for (i=0; i<255; i++) /* Decrease speed of motor */
{
OCR1AL = i;
OCR1BL = i;
_delay_ms(25); // delay 25 ms
}

for( i=255; i>0; i--) /* Increase speed of motor */
{
OCR1AL = i;
OCR1BL = i;
_delay_ms(25); // delay 25 ms
}
}
}

yamanoorsai
10-26-2007, 05:17 AM
I apologise for the post I have made. Actually I made it out of frustration since I could not identify the problem. I have rectified it. The problem was with the input being given to the motors. The track laid below wasn't completed. Sorry to disturb the peace of the forum