element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum L293D+Arduino+DC motors setup won't deliver enough power to wheels
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 18 replies
  • Subscribers 393 subscribers
  • Views 3225 views
  • Users 0 members are here
  • dc motor
  • step-down regulator
  • l293d
  • servo
  • lipo
  • arduino
Related

L293D+Arduino+DC motors setup won't deliver enough power to wheels

roineust
roineust over 8 years ago

Hello,

i'm not getting enough power to the driving wheels on the setup described in the following diagram.

i'v done very similar cuircuits in the past with the exact same components and the driving force from DC motors was much stronger. Can't seem to find what i'm doing wrong..

The DC motors used are these: https://www.pololu.com/product/2215

image

 

Here is the code used:

 

#include <Servo.h>

 

 

#define E 5  // Enable Pin for all motors

 

#define drive_up_left_wheel1 6  // Control pin 1 for motor 1

#define drive_up_left_wheel2 7  // Control pin 2 for motor 1

#define drive_up_right_wheel1 8  // Control pin 1 for motor 2

#define drive_up_right_wheel2 9  // Control pin 2 for motor 2

#define drive_down_right_wheel1 10  // Control pin 1 for motor 3

#define drive_down_right_wheel2 11  // Control pin 2 for motor 3

#define drive_down_left_wheel1 12  // Control pin 1 for motor 4

#define drive_down_left_wheel2 13  // Control pin 2 for motor 4

 

Servo steer_up_left_wheel;

Servo steer_up_right_wheel;

Servo steer_down_right_wheel;

Servo steer_down_left_wheel;

 

void setup() {

 

     set_low_speed();  

 

    attach_steer_servos();

  

    steer_vertical();

  

    drive_down();

  

    delay(6500);

  

    drive_stop();

  

    delay(1000);

     

}

 

void loop() {  

  

    steer_horizontal();

  

    delay(1000);

  

    drive_left();

  

    delay(2500);

  

    drive_stop();

  

    steer_vertical();

  

    delay(1000);

  

    drive_up();

  

    delay(4000);

  

    drive_stop();

  

    steer_horizontal();

  

    delay(1000);

 

    drive_right();

  

    delay(2500);

  

    drive_stop();

  

    steer_vertical();

  

    delay(1000);

  

    drive_down();

  

    delay(3600);

  

    drive_stop(); 

  

}

 

 

void attach_steer_servos(){

 

    steer_up_left_wheel.attach(A1);

    steer_up_right_wheel.attach(A0);

    steer_down_right_wheel.attach(A2);

    steer_down_left_wheel.attach(A3);

  

} 

  

  

void steer_horizontal(){

     

    steer_up_left_wheel.write(48);

    steer_up_right_wheel.write(128);

    steer_down_right_wheel.write(32);

    steer_down_left_wheel.write(154); 

                

}

 

void steer_vertical(){

 

    steer_up_left_wheel.write(144);

    steer_up_right_wheel.write(35);

    steer_down_right_wheel.write(122);

    steer_down_left_wheel.write(66);

  

    delay(500);

                

}

 

void steer_sleight_right(){

     

    steer_up_left_wheel.write(52);

    steer_up_right_wheel.write(134);

    steer_down_right_wheel.write(25);

    steer_down_left_wheel.write(128); 

    

   }

 

void steer_sleight_left(){

     

    steer_up_left_wheel.write(52);

    steer_up_right_wheel.write(134);

    steer_down_right_wheel.write(25);

    steer_down_left_wheel.write(128); 

    

   }

  

void set_medium_high_speed(){

 

  analogWrite(E, 250); // Run in almost full speed

 

}

 

void set_medium_speed(){

 

  analogWrite(E, 195); // Run in half speed

 

}

 

void set_low_speed(){

 

  analogWrite(E, 30);  // Run in low speed

 

}

 

void drive_stop(){

              

    digitalWrite(drive_up_left_wheel1, LOW);

    digitalWrite(drive_up_left_wheel2, LOW);

    digitalWrite(drive_up_right_wheel1, LOW);

    digitalWrite(drive_up_right_wheel2, LOW);

    digitalWrite(drive_down_right_wheel1, LOW);

    digitalWrite(drive_down_right_wheel2, LOW);

    digitalWrite(drive_down_left_wheel1, LOW);

    digitalWrite(drive_down_left_wheel2, LOW);

    

    }  

 

void drive_right(){

  

       digitalWrite(drive_up_left_wheel1, LOW);

       digitalWrite(drive_up_left_wheel2, HIGH);

       digitalWrite(drive_up_right_wheel1, LOW);

       digitalWrite(drive_up_right_wheel2, HIGH);

       digitalWrite(drive_down_right_wheel1, LOW);

       digitalWrite(drive_down_right_wheel2, HIGH);

       digitalWrite(drive_down_left_wheel1, HIGH);

       digitalWrite(drive_down_left_wheel2, LOW);

   

    }

     

void drive_left (){

 

   digitalWrite(drive_up_left_wheel1, HIGH);

   digitalWrite(drive_up_left_wheel2, LOW);

   digitalWrite(drive_up_right_wheel1, HIGH);

   digitalWrite(drive_up_right_wheel2, LOW);

   digitalWrite(drive_down_right_wheel1, HIGH);

   digitalWrite(drive_down_right_wheel2, LOW);

   digitalWrite(drive_down_left_wheel1,LOW);

   digitalWrite(drive_down_left_wheel2, HIGH);

 

}

  

void drive_down (){

 

   digitalWrite(drive_up_left_wheel1, HIGH);

   digitalWrite(drive_up_left_wheel2, LOW);

   digitalWrite(drive_up_right_wheel1, LOW);

   digitalWrite(drive_up_right_wheel2, HIGH);

   digitalWrite(drive_down_right_wheel1, HIGH);

   digitalWrite(drive_down_right_wheel2, LOW);

   digitalWrite(drive_down_left_wheel1,HIGH);

   digitalWrite(drive_down_left_wheel2, LOW);

 

}

 

 

  void drive_up (){

  

   digitalWrite(drive_up_left_wheel1, LOW);

   digitalWrite(drive_up_left_wheel2, HIGH);

   digitalWrite(drive_up_right_wheel1, HIGH);

   digitalWrite(drive_up_right_wheel2, LOW);

   digitalWrite(drive_down_right_wheel1, LOW);

   digitalWrite(drive_down_right_wheel2, HIGH);

   digitalWrite(drive_down_left_wheel1,LOW);

   digitalWrite(drive_down_left_wheel2, HIGH);

 

}

 

 

Any ideas what could be the reason for that problem?

Thanks.

  • Sign in to reply
  • Cancel

Top Replies

  • dougw
    dougw over 8 years ago +2
    Ensure you use heavy enough wire and connectors that can handle the current. Check the voltage getting to the motors and trace it back to the supply, making sure it is good at each intermediate node.
  • dougw
    dougw over 8 years ago in reply to roineust +2
    I can offer a theory, but it is just something I have thought about - I never tested it. In a normal DC motor torque goes up as speed goes down because the current increases as the back-emf goes down.…
  • jw0752
    jw0752 over 8 years ago in reply to roineust +2
    Hi Roi, Do you have flyback protection diodes across the motors. I have seen where the counter EMF if not eliminated can mess with the outputs of the drivers. John
Parents
  • billpenner
    billpenner over 8 years ago

    You could require up to near an Amp of current to drive each wheel. That depending upon which motor you are using. Follow Douglas Wong's advice to see if you have full voltage at the motors while power is applied. You may have to modify the program so that voltage is continuously supplied to the "test motor while the voltage is being measured.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • roineust
    roineust over 8 years ago in reply to billpenner

    I'm getting 3.5V instead of 9V at the motors + and - while they are running. i'll be checking the intermediate points again soon, although i think i already did that and the only intermediate points are before and after the L293D and there i get 9V. The wires are about 1 meter long, but i think not too thin..they don't warm up, that is for sure..

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • dougw
    dougw over 8 years ago in reply to roineust

    If it is being driven with PWM, your meter may not read the voltage accurately. If it is PWM, ensure it is putting out 100% duty cycle.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • roineust
    roineust over 8 years ago in reply to dougw

    Could the PWM duty cycle be the reason not only for problems in reading the correct voltage, but also for lack of power transfer to the motors?

     

    Do you mean the following function:

     

    void set_low_speed(){

     

      analogWrite(E, 30);  // Run in low speed

     

    }

     

     

    Because when i am referring to low power transfer in comparison to previous configuration with identical components, i mean that i had much more power from motors at LOW speed..

     

    i will add to the list of measurements i have to do, also checking out the voltage when using analogWrite(E, 255);

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • billpenner
    billpenner over 8 years ago in reply to roineust

    Since you are using 6V motors you should not be using 12V or 9V for the source. you say that the voltage did not change when connected directly to battery? Did the voltage measured at the motor at that time still read 3.6V I suspect that that you are measuring the voltages after being processed by the  Arduino. In which case You are measuring the average voltage which is not DC. you may have to borrow an oscilloscope to see the true results.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • billpenner
    billpenner over 8 years ago in reply to roineust

    You say "Because when i am referring to low power transfer in comparison to previous configuration with identical components, i mean that i had much more power from motors at LOW speed." This would seem to indicate that the problem is in the supply source instead of the PWM duty cycle. Again maybe an oscilloscope may be in order.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • roineust
    roineust over 8 years ago in reply to billpenner

    Here are the results of the measurements, the problem is that in previous configurations, i'm sure i was able to get no dependency between speed and power - i was getting very nice power also at lower speed e.g. analogWrite(E,30), now i'm getting high power only when the speed is also higher and not when the speed is low. I just don't understand what is different: Same type of battery, same type of motors, same length and type of wires, same type of Arduino, same type of L293D chips, same code. This is very confusing.. it is essential for me to get good power at low speed and i'v been there already and unable to get there again.

     

     

    9V (from regulators)analogWrite(E,30);analogWrite(E,255);
    Before L293D~9.0V~9.0V
    After L293D~2.4V~7.6V
    At motors~2.4V~7.4V
    Motor Speed (S) and Power (P)

    S:med-

    P:low

    S:high

    P:high

     

    12V (bypassing regulators)analogWrite(E,30);analogWrite(E,255);
    Before L293D~12.3V~12.3V
    After L293D~4.2V~10.8V
    At motors~4.0V~10.2V
    Motor Speed (S) and Power (P)

    S:med+

    P:low+

    S:high+

    P:high+

     

     

    Do you have an idea what am i doing wrong?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • roineust
    roineust over 8 years ago in reply to dougw

    Here are the results of the measurements, the problem is that in previous configurations, i'm sure i was able to get no dependency between speed and power - i was getting very nice power also at lower speed e.g. analogWrite(E,30), now i'm getting high power only when the speed is also higher and not when the speed is low. I just don't understand what is different: Same type of battery, same type of motors, same length and type of wires, same type of Arduino, same type of L293D chips, same code. This is very confusing.. it is essential for me to get good power at low speed and i'v been there already and unable to get there again.

     

     

    9V (from regulators)analogWrite(E,30);analogWrite(E,255);
    Before L293D~9.0V~9.0V
    After L293D~2.4V~7.6V
    At motors~2.4V~7.4V
    Motor Speed (S) and Power (P)

    S:med-

    P:low

    S:high

    P:high

     

    12V (bypassing regulators)analogWrite(E,30);analogWrite(E,255);
    Before L293D~12.3V~12.3V
    After L293D~4.2V~10.8V
    At motors~4.0V~10.2V
    Motor Speed (S) and Power (P)

    S:med+

    P:low+

    S:high+

    P:high+

     

     

    Do you have an idea what am i doing wrong?

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • dougw
    dougw over 8 years ago in reply to roineust

    I can offer a theory, but it is just something I have thought about - I never tested it.

    In a normal DC motor torque goes up as speed goes down because the current increases as the back-emf goes down.

    In a stepper motor or PWM drive it is a bit different.

    DC motor torque is proportional to current in the motor.

    The current through the motor is generated by averaging a constant (peak) voltage PWM signal. The motor inductance does not allow instantaneous changes in current, so high frequency PWM just gets "filtered" to an average current. At low duty cycle this becomes a low current, and low torque.

    If you reduce the PWM frequency (but maintain the same PWM duty cycle) the individual pulses will be longer, allowing the current to build up to maximum and thus apply maximum torque during the "on" period.

    If you go too low on the frequency the motor will start to vibrate and buzz or jerk, but you may be able to find a magic frequency where the buzz is acceptable and the peak torque is increased.

    Some of the motors I have used seem to start vibrating when the frequency falls below 300 Hz and the vibration gets pronounced below 200 Hz. You could try running in this frequency range to see if it increases apparent torque.

    What PWM frequency are you running?

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
  • roineust
    roineust over 8 years ago in reply to dougw

    I don't know what PWM frequency i'm running or what is the duty cycle..

    None of them has to do with the line in the code i'm referring to all the time? which is: analogWrite(E,30); which goes from the Arduino to the L293D enable chips legs??

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • gdstew
    gdstew over 8 years ago in reply to roineust

    According to the documentation for analogWrite() on the Uno most PWM pins are approximately 490 Hz, pins 5 and 6 are approximately 980 Hz.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • jw0752
    jw0752 over 8 years ago in reply to roineust

    Hi Roi,

    Do you have flyback protection diodes across the motors. I have seen where the counter EMF if not eliminated can mess with the outputs of the drivers.

    John

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • jw0752
    jw0752 over 8 years ago in reply to roineust

    Hi Roi,

    Do you have flyback protection diodes across the motors. I have seen where the counter EMF if not eliminated can mess with the outputs of the drivers.

    John

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
Children
  • roineust
    roineust over 8 years ago in reply to jw0752

    i'll look into that John, thanks.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube