Go Down

Topic: Autonomous Robot, motor driver (Read 3 times) previous topic - next topic

husein06


Yes the code may works perfectl, but it seems to run the motors at 255 which is full speed. When you try to get the wheels to move the robot at full speed immediately, it stalls. But if you do an analogWrite(pin, 10) followed by a short delay and an analogWrite(pin, 20) etc etc it might start moving.

But instead of hard-coding the 10 and 20 etc into a zillion analogWrites, you would increment a variable called speed and have analogWrite(pin, speed) to get it up to speed gradually.


Thanks for the help, I'm going to try it now, I understood the concept but where would I increment "speed"? in what part of my code would i place it I'm just confused there?

also, my professor stated "The problem is too much load. If it works fine with the wheels off the ground the you know what the problem is.  adding a fan will help. " what do you think?

husein06

#16
Feb 22, 2013, 09:05 pm Last Edit: Feb 22, 2013, 09:08 pm by husein06 Reason: 1

Yes the code may works perfectl, but it seems to run the motors at 255 which is full speed. When you try to get the wheels to move the robot at full speed immediately, it stalls. But if you do an analogWrite(pin, 10) followed by a short delay and an analogWrite(pin, 20) etc etc it might start moving.

But instead of hard-coding the 10 and 20 etc into a zillion analogWrites, you would increment a variable called speed and have analogWrite(pin, speed) to get it up to speed gradually.


Code: [Select]

int speeds=0;
int speedstep=10;
if ( 127 > turn ){
   drive_Left();
   for (i=0; i < 255; i++)
   {
   speeds=speeds+speedstep;
  analogWrite(PWML, speeds);// speed control
  }
  }


correct?

HazardsMind

You should add a small delay in there to see the change. Also for that particular segment, I would swap analogWrite(PWML, speed), with analogWrite(PWML, i);//
Created Libraries:
TFT_Extension, OneWireKeypad, SerialServo, (UPD)WiiClassicController, VWID

husein06

#18
Feb 22, 2013, 09:26 pm Last Edit: Feb 22, 2013, 09:29 pm by husein06 Reason: 1

You should add a small delay in there to see the change. Also for that particular segment, I would swap analogWrite(PWML, speed), with analogWrite(PWML, i);//


I just tried it, worked in the Air, again put it on the carpet and it stalled.

Attached are the pictures of my bot. Did I install the motors the wrong way? Should the motor and bracket be above the chassis?

WHY THE STALL! lol its getting frustrating

HazardsMind

My guess would be the mass of the chassis. And the fact that your on carpet doesn't help either.
Created Libraries:
TFT_Extension, OneWireKeypad, SerialServo, (UPD)WiiClassicController, VWID

Go Up