Forum

Welcome Guest 

Show/Hide Header

Welcome Guest, posting in this forum requires registration.





Pages: [1]
Author Topic: Seeking assistance with driver setup
SomePolish-
Guy
Newbie
Posts: 9
Permalink
Post Seeking assistance with driver setup
on: October 21, 2017, 19:30
Quote

Hello,
I am seeking help because I can not get the programs to work.

I am using an arduino uno with 2 easy driver boards, 2 nema 17 steppers and a sg90 servo with a 1.5A 12V power supply. The firmware zip I am using is Polargraph.2017-05-10.

After copying over the library files, I first made changes on the arduino server tab to uncomment the motorshield and instead use the stepper drivers.

// 3. Specify what kind of motor driver you are using
// ==================================================
// Only ONE set of lines below should be uncommented.

//   i. Adafruit Motorshield v1. The original, and still the best.
//   -------------------------------------------------------------
//#define ADAFRUIT_MOTORSHIELD_V1
//#include <AFMotor.h>

//   ii. Adafruit Motorshield v2. It's all squealy.
//   ----------------------------------------------
//#define ADAFRUIT_MOTORSHIELD_V2
//#include <Wire.h>
//#include <Adafruit_MotorShield.h>
//#include "utility/Adafruit_PWMServoDriver.h"

//   iii. Using discrete stepper drivers? (eg EasyDriver, stepstick, Pololu gear)
//   ----------------------------------------------------------------------------
//   Don't forget to define your pins in 'configuration.ino'.
#define SERIAL_STEPPER_DRIVERS 

//   iv. Using a signal amplifier like a UNL2003? 
//   --------------------------------------------
//   Don't forget to define your pins in 'configuration.ino'.
//  #define UNL2003_DRIVER

I then went to the navigation tab to assign the Step, Direction and Enable pins to match my wiring (see image)

/* Motor setup if you are using serial stepper drivers 
(EasyDrivers, stepsticks, Pololu etc).

If you are wiring up yourself, just put the pin numbers in here.

Note that the pen lift servo usually lives on pin 9, so avoid 
that if you can. If you can't, then you know how to change it.
*/
#ifdef SERIAL_STEPPER_DRIVERS
#define MOTOR_A_ENABLE_PIN 8
#define MOTOR_A_STEP_PIN 2
#define MOTOR_A_DIR_PIN 5
  
#define MOTOR_B_ENABLE_PIN 8
#define MOTOR_B_STEP_PIN 3
#define MOTOR_B_DIR_PIN 7
AccelStepper motorA(1,MOTOR_A_STEP_PIN, MOTOR_A_DIR_PIN); 
AccelStepper motorB(1,MOTOR_B_STEP_PIN, MOTOR_B_DIR_PIN); 
#endif

My wiring is set up from a GRBL CNC project. Green wires step, Yellow set direction, and the Blue enables leaving the Black wire to control the servo(see image)

I have only gotten the servo to move. It will not respond to the "test pen lift range" button in the controller, but it will start shifting If I send the drawing gcode.

In addition to the stepper and servo issue, the Controller will give me an error within the first 3 minutes of sending the code that the line is not on the page (see image).

I am open to any and all suggestions. I have also tried using the v2 motorshield on a second arduino after flashing the hex file, but have only had the same results.
Image
Image

sandy
Administrator
Posts: 1317
Permalink
sandy
Post Re: Seeking assistance with driver setup
on: October 21, 2017, 23:53
Quote

Looks great so far 🙂 I mean apart from the "not moving"!

#define MOTOR_B_DIR_PIN 7 should be 6 given your wiring ... but that would only ever stop one of the motors from running.

The stepper drivers I've used have inverted "enable" pins, which means they enable when the pin is pulled low. The Easydrivers you're using are not inverted, so you will need to modify a few bits in the configuration_motorSetup() function. It currently looks like this:

  pinMode(MOTOR_A_ENABLE_PIN, OUTPUT);
  digitalWrite(MOTOR_A_ENABLE_PIN, HIGH);
  pinMode(MOTOR_B_ENABLE_PIN, OUTPUT);
  digitalWrite(MOTOR_B_ENABLE_PIN, HIGH);
  motorA.setEnablePin(MOTOR_A_ENABLE_PIN);
  motorA.setPinsInverted(false, false, true);
  motorB.setEnablePin(MOTOR_B_ENABLE_PIN);
motorB.setPinsInverted(true, false, true);

Try making the modifications below:

  pinMode(MOTOR_A_ENABLE_PIN, OUTPUT);
  digitalWrite(MOTOR_A_ENABLE_PIN, LOW);    // made LOW
  pinMode(MOTOR_B_ENABLE_PIN, OUTPUT);
  digitalWrite(MOTOR_B_ENABLE_PIN, LOW);    // made LOW
  motorA.setEnablePin(MOTOR_A_ENABLE_PIN);
  motorA.setPinsInverted(false, false, false);  // False to inverting the enable pin
  motorB.setEnablePin(MOTOR_B_ENABLE_PIN);
  motorB.setPinsInverted(true, false, false);  // False to inverting the enable pin

Last thing is the interaction with the controller app - "line not on page" usually means either you haven't uploaded the machine spec (so the size of the machine in the controller doesn't match the size of the machine in the arduino's memory), OR you haven't done a "set home" before the drawing (so you've never told the machine where the pen it to begin with). Or both!

Give that a shot and see if you have any more luck. The servo thing is a bit odd - does it work correctly during the drawing?

sn

SomePolish-
Guy
Newbie
Posts: 9
Permalink
Post Re: Seeking assistance with driver setup
on: October 23, 2017, 23:36
Quote

Thank you for your quick reply!

I've been able to get everything moving, but there seems to still be a bug or two with both the servo and stepper enable pins on the drivers.

I first corrected the pin assignment from 7 to 6 (thank you for catching that).

After making the recommended modifications to invert the stepper enable functions I was still unable to get the steppers to respond. By unplugging the cable to enable the began spinning immediately. I will need to trouble shoot this as I am not sure if the lack of this function will burn out my drivers after a few drawings.

The servo seems to be lifting and falling during the drawing operation, but I am only now ready to mount these to a board. I need to print a different gear for the bead cable as well as I seem to have a size which does not match. I will follow up on that once it is drawing.

When interacting with the controller app, I have not been using the "set home" function properly before each drawing. I have done so today while troubleshooting the steppers and it appears to be the missing piece.

Thank you so much Sandy, this alone has been a great encouragement to continue the project. I should have reached out sooner.

SPG

SomePolish-
Guy
Newbie
Posts: 9
Permalink
Post Re: Seeking assistance with driver setup
on: October 27, 2017, 00:37
Quote

A quick update:
As it would turn out, the servo not working was user error not having the serial que running and sending information.

I have not been able to solve the error with the pen not on paper yet. I have the machine up and running, and it responds to point commands, but I need to scale the motor movements to the size of the paper.

I'm hoping to have this done by the weekend, It's an exciting project.

SPG

SomePolish-
Guy
Newbie
Posts: 9
Permalink
Post Re: Seeking assistance with driver setup
on: October 30, 2017, 21:32
Quote

So it would seem more user error has been the culprit of my pen location errors. I had not uploaded the changes to the machine from the processor program.

I am up and running just fine now, though I am very interested to untether this thing from my laptop and make it self dependant. I'm wondering if another arduino can be programmed to send the code to this one via serial cable from an SD card, or if another solution exists already.

Here are some pictures, and thank you for your help.

Image
Image

kongorilla
Pro
Posts: 362
Permalink
kongorilla
Post Re: Seeking assistance with driver setup
on: October 30, 2017, 23:44
Quote

Have a Raspberry Pi laying around, waiting for a use? If so, there's this solution:
https://github.com/euphy/polargraph/wiki/Standalone-command-queue-runner

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