Reduce Wobbling - IR sensors

Hi All

I am new to Arduino projects and building a line following robot (my first project).

Our task is to build a fastest line following robot.

We are using

Adruino Leonardo
L298N Dual Motor Driver
2*IR Sensors
Two wheel with 10v DC motors

The track on which this robot will need to run is green background with a 5cm wide white line. and the way we programmed the Arduino is to keep looking for white line and make turns when the sensors move away from white line. We have placed sensors so that they are exactly on the edges of the white line and we have also tried placing them next to each other and in both the cases there is lot of wobbling and correction to stay on white line and this is slowing down the movement of the robot.

Is there anyway to reduce this wobbling and make it go straight more quickly?

Thanks in advance

Dont stop motors. reduce speed to xx%

Do some tests to determine how much reduction is needed to manage the sharpest turn.

For the fastest robot, you will need a better motor driver than the ancient L298.

Buy one that can handle the motor stall current. Pololu has an excellent selection.

knut_ny:
Dont stop motors. reduce speed to xx%

Do some tests to determine how much reduction is needed to manage the sharpest turn.

I using code below to move either right or left when sensors out.

if ((lsensor==LOW)&&(rsensor==HIGH))
{

// right sensor on black line
// turn Left

digitalWrite(lmotorf,LOW);
digitalWrite(rmotorf,HIGH);
digitalWrite(lmotorb,HIGH);
digitalWrite(rmotorb,LOW);

}

else if ((lsensor==HIGH)&&(rsensor==LOW))
{

// left sensor on black line
// turn right

digitalWrite(lmotorf,HIGH);
digitalWrite(rmotorf,LOW);
digitalWrite(lmotorb,LOW);
digitalWrite(rmotorb,HIGH);

}

where ever i am writing high to a motor would it help if i mention digitalWrite(lmotorf,HIGH*0.5)

is this what you mean?

regards

would it help if i mention digitalWrite(lmotorf,HIGH*0.5)

No, that won't work at all. digitalWrite() takes only HIGH (1) or LOW (0).

Use PWM pins and the analogWrite() function to reduce motor speed.