how to setup for Adafruit L293D motor shield?

430 views
Skip to first unread message

symel

unread,
Jun 21, 2016, 4:47:18 AM6/21/16
to accelstepper
Hi, I use Arduino R3 and Motorshield Adafruit V1 with 2 x L293D (adafruit-motor-shield-V1).
Until now I used original AccelStepper v1.2. Worked quite well.
Trying last v1.5 it doesn't work any more, even with simple code like:

AF_Stepper motorA(48, 1);
void forwardstepA() {  motorA.onestep(FORWARD, INTERLEAVE);}
void backwardstepA() {  motorA.onestep(BACKWARD, INTERLEAVE);}
AccelStepper stepperA(forwardstepA, backwardstepA); // use functions to step

void setup()
{
 
// 20 pps
  stepperA
.setSpeed(20);
}

void loop()
{
  stepperA
.runSpeed();
}

With v1.2 I had 20pps, but with v1.51 I get like 1pps.
Do I miss something?

Or should I use the new class. If yes, how should I declare the L293D shield?
AccelStepper (uint8_t interface=AccelStepper::FULL4WIRE, uint8_t pin1=2, uint8_t pin2=3, uint8_t pin3=4, uint8_t pin4=5, bool enable=true)
What are pins and interface to set?

Mike McCauley

unread,
Jun 21, 2016, 7:23:31 AM6/21/16
to accels...@googlegroups.com


Sent from my iPhone

On 21 Jun 2016, at 5:47 PM, symel <pros...@gmail.com> wrote:

Hi, I use Arduino R3 and Motorshield Adafruit V1 with 2 x L293D (adafruit-motor-shield-V1).
Until now I used original AccelStepper v1.2. Worked quite well.
Trying last v1.5 it doesn't work any more, even with simple code like:

AF_Stepper motorA(48, 1);
void forwardstepA() {  motorA.onestep(FORWARD, INTERLEAVE);}
void backwardstepA() {  motorA.onestep(BACKWARD, INTERLEAVE);}
AccelStepper stepperA(forwardstepA, backwardstepA); // use functions to step

void setup()
{
 
// 20 pps
  stepperA
.setSpeed(20);
}

void loop()
{
  stepperA
.runSpeed();
}

With v1.2 I had 20pps, but with v1.51 I get like 1pps.
Do I miss something?

Yes
You need to set the max acceleration to other then the default 1 p/s/s 


Try starting with the example sketches



Or should I use the new class. If yes, how should I declare the L293D shield?
AccelStepper (uint8_t interface=AccelStepper::FULL4WIRE, uint8_t pin1=2, uint8_t pin2=3, uint8_t pin3=4, uint8_t pin4=5, bool enable=true)
What are pins and interface to set?

--
You received this message because you are subscribed to the Google Groups "accelstepper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to accelstepper...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

symel

unread,
Jun 22, 2016, 9:37:24 AM6/22/16
to accelstepper
Thank you for prompt feedback,
So I have tried yesterday night the examples I found in library and that could suit the motor shield.
I found:

- AFMotor_ConstantSpeed/AFMotor_MultiStepper:
=> Use the "old" class. did run motor but max speed 500pps gives me 15s per round (after a gear box) while I had 12s  with v1.2 library. Bigger issue: it causes MUCH HEAT on L293
=> slow speed 20pps also caused much heat (must test again the speed, I don't remember if correct)
 
- AFMotor_ConstantSpeed:
 => this one use the new class. But didn't run the motors, only strange noises and vibrations.
Refers to same chips of motor shield, so I suppose the pins are correct.

At this stage I fixed the issue I had with lib v1.2: after first "move();" speed was 1 pps for the next moves. I had to set again the same maxSpeed, Accel,...etc
Reply all
Reply to author
Forward
0 new messages