Forum

Welcome Guest 

Show/Hide Header

Welcome Guest, posting in this forum requires registration.





Pages: [1]
Author Topic: Trouble getting motors to move
Xander1027
Newbie
Posts: 3
Permalink
Post Trouble getting motors to move
on: January 17, 2014, 01:27
Quote

Hey Sandy,
I want to say you have done a wonderful job with this project. Ive been following it for a while and finally decided to give it a try. Purchased all the part and had no issues until when it came to controlling the motors from the polargraph controller.

Im using an Arduino Mega 2560 and Adafruit Motorshield V2 with Nema 17 200 step motors. I can make the motors turn with the adafruit sample code. I believe I was able to integrate the new adafruit library into the server because it uploads and reads Ready in the serial port. Below is the code from the configuration.ino:

// 1. Adafruit motorshield
#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_PWMServoDriver.h"

Adafruit_MotorShield AFMS = Adafruit_MotorShield();

const int stepType = INTERLEAVE;

Adafruit_StepperMotor *afMotorA = AFMS.getStepper(motorStepsPerRev, 1);
Adafruit_StepperMotor *afMotorB = AFMS.getStepper(motorStepsPerRev, 2);

void forwarda() { afMotorA->onestep(FORWARD, stepType); }
void backwarda() { afMotorA->onestep(BACKWARD, stepType); }
AccelStepper motorA(forwarda, backwarda);

void forwardb() { afMotorB->onestep(FORWARD, stepType); }
void backwardb() { afMotorB->onestep(BACKWARD, stepType); }
AccelStepper motorB(forwardb, backwardb);

void configuration_motorSetup()
{
// no initial setup for these kinds of motor drivers
}

From the controller I can connect to the serial port and I get the green light however there is no movement from the motors when I un-pause the queue. So I feel like its an issue with the V2 motorshield? Let me know if you have any insight on this. or maybe I'm just forgetting something.

Thanks and great job on your work

Xander

sandy
Administrator
Posts: 1317
Permalink
sandy
Post Re: Trouble getting motors to move
on: January 17, 2014, 13:27
Quote

Hi Xander, thanks! I haven't actually used the motorshield v2 - it is a little more sophisticated than the original motorshield, so I wouldn't be surprised if it requires a bit more setting up - probably more like the serial stepper drivers that are in the polarshield.

A bit more prep of the pins that interface with it, or "enable" pins setting up, things like that. I would look at the adafruit examples, and see what's missing from the polargraph version. Look at impl_engageMotors() and impl_releaseMotors() in impl_mega.ino for some extra bits that might need modification for when the motors are first energised.

sandy noble

Xander1027
Newbie
Posts: 3
Permalink
Post Re: Trouble getting motors to move
on: January 18, 2014, 00:58
Quote

Thanks for the quick reply! It ended up being I needed to initialize the shield with the void.begin() which is new for the V2 motorshield.

void configuration_motorSetup()
{
AFMS.begin();// create with the default frequency 1.6KHz
}

Now I just need to wait for some last minute parts and It should be up and running soon.

sandy
Administrator
Posts: 1317
Permalink
sandy
Post Re: Trouble getting motors to move
on: January 18, 2014, 08:22
Quote

That's great news Xander, I've seen quite a few questions about the motorshield 2 lately, polargraph and accelstepper generally, and its good to find some solutions!

cheers!
sn

oscbe112
Newbie
Posts: 1
Permalink
Post Re: Trouble getting motors to move
on: March 15, 2014, 09:01
Quote

Xander thats great news!

Could you please explain the configruration steps or maybe post the code you are using?

sandy
Administrator
Posts: 1317
Permalink
sandy
Post Re: Trouble getting motors to move
on: March 15, 2014, 10:45
Quote

I am happy to host a copy of the changes on github if anyone can assure me it works (and send me teh codez). A better way would be for someone to fork my polargraph_server_a1 project, commit the changes and then do a pull request! I've never done one of those, so it would be _very_ exciting. Perhaps I don't get out much.

k3a
Newbie
Posts: 4
Permalink
Post Re: Trouble getting motors to move
on: March 23, 2014, 12:42
Quote

Hey!
Running into the same issue here. Is there any news on this by now? A .hex for the UNO would be amazing. But I figure I have to compile that myself somehow, right?

sandy
Administrator
Posts: 1317
Permalink
sandy
Post Re: Trouble getting motors to move
on: December 6, 2014, 12:51
Quote

Hexes are now added in the code bundle:
https://github.com/euphy/polargraphcontroller/releases/latest

Pages: [1]
Mingle Forum by cartpauj
Version: 1.0.34 ; Page loaded in: 0.077 seconds.