Reduce Momentum on Arduino Robot

good morning mates,

i have a problem with my arduino robot, but first of all let me first describe my arduino robot features.

  1. it is 2WD arduino robot driven by 2 DAGU motors, gear ratio is 1:48 power supply is 10v.
  2. it is driven by L293D chip (not the L293D shield)
  3. Power supply is coming from 2 power banks 5v total 10v at 5600mAh
  4. approx. weight of the whole robot 0.75kg
  5. at forward and backward the set speed is at 245
  6. turning set speed is 180

now, the problem is whenever the robot is moving FW/BW and i press stop the momentum of the robot moves the robot forward for about 1.5 in. how can i prevent/minimized the movement during stopping without adding any mechanical features?

can i add some codes to resolve this problem?

thank you in advance, your inputs are very much appreciated

by the way here's the layout of my robot

chassis.JPG

You can anticipate the forward coasting and command a stop a bit earlier than the goal.

You can set "brake mode" on the driver, which will short out the motors and the generated power will be expended as heat. Edit: just checked and the L293 does not support "brake mode". Other motor drivers do.

With a better motor driver, you can briefly reverse the motors for very fast brake action. This would probably destroy an L293, as when rapidly reversed, the motors briefly draw twice the stall current. This is hard on the motor brushes, too.

jremington:
Edit: just checked and the L293 does not support "brake mode".

The L293 does support 'brake' mode like other motor drivers, by taking both inputs either high or low with 'enable' high.

Shown in table 3, pages 11 and 12 of the Texas Instruments datasheet, here:- L293.pdf (That part of the table is on page 12, maybe you missed it.)

The L293 does support 'brake' mode like other motor drivers, by taking both inputs either high or low with 'enable' high.

here's my code
E1 and B1 are my enable pins

void stop()
analogWrite(E1, 0);
analogWrite(B2, 0);
digitalWrite(MotorLeft1, LOW);
digitalWrite(MotorLeft2, LOW);
digitalWrite(MotorRight2, LOW);
digitalWrite(MotorRight1, LOW);

is this what you mean sir?

analogWrite(E1, 1);
analogWrite(B2, 1);
digitalWrite(MotorLeft1, LOW);
digitalWrite(MotorLeft2, LOW);
digitalWrite(MotorRight2, LOW);
digitalWrite(MotorRight1, LOW);

Spartan1203:
is this what you mean sir?

analogWrite(E1, 1);

analogWrite(B2, 1);
digitalWrite(MotorLeft1, LOW);
digitalWrite(MotorLeft2, LOW);
digitalWrite(MotorRight2, LOW);
digitalWrite(MotorRight1, LOW);

No. These two lines won't take the enable pins high:-

analogWrite(E1, 1);
analogWrite(B2, 1);

It will just set them at a low duty-cycle.

Instead, you want this:-

void stop()
{
   pinMode(E1, OUTPUT);
   pinMode(B2, OUTPUT);
   digitalWrite(E1, HIGH);
   digitalWrite(B2, HIGH);
   digitalWrite(MotorLeft1, LOW);
   digitalWrite(MotorLeft2, LOW);
   digitalWrite(MotorRight2, LOW);
   digitalWrite(MotorRight1, LOW);
}

or this:-

void stop()
{
   analogWrite(E1, 255);
   analogWrite(B2, 255);
   digitalWrite(MotorLeft1, LOW);
   digitalWrite(MotorLeft2, LOW);
   digitalWrite(MotorRight2, LOW);
   digitalWrite(MotorRight1, LOW);
}

Here's the relevant table from the datasheet:-

And in future, please use [code]code tags[/code] when posting code, as I've done.

ok now I get it. thanks. ok next time i'll use the code tags sorry

Spartan1203:
ok now I get it. thanks. ok next time i'll use the code tags sorry

No problem. :slight_smile:

And I just added a table from the datasheet to my last reply.

Hi Spartan,

Do you want a hard stop? Are you at risk of tipping over if the deceleration range is shortened?