Pages: [1]   Go Down
Author Topic: Looking for help with SparkFun AutoDriver (Stepper Driver)  (Read 966 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 30
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Greetings all,



Our team has been having trouble getting this driver to work, and the tutorial that SparkFun provides is not working as specified.  I don't suppose any users are out there with experience with this device?  I've attached our code and the SparkFun Fritzing Diagram.  We've hooked it up *exactly* as shown by SparkFun.

Potential problems we see, but don't know how to troubleshoot:

1.  In all of the SparkFun Sketches, Pin 6 is referred to as the reset pin, yet pin 6 on the Arduino is never hooked up in any of the Fritzing Diagrams.
2.  Where are pins 11 and 12 initialized for SPI communications?  13 for SCK?  Is this handled internally by calling 'include AutoDriver.h' ?
3.  Doesn't the Board need another Power Source for the Motor itself?  We weren't under the impression that the motors could draw power from the Arduino.

Any assistance would be greatly appreciated - For our code, we took the 'essential' components of the example and tried to make a simple piece of code that would turn at 20 Steps per second forward, wait 1s, then backward, wait 1s, and loop.

Code:
#include <AutoDriver.h>

AutoDriver boardA(10, 6);

void setup()
{
  Serial.begin(9600);
  Serial.println("Hello world");
  dSPINConfig();
}

void loop()
{
 boardA.run(FWD, 20);
 delay(1000);
 boardA.run(REV, 20);
 delay(1000);
 Serial.println("Maybe?");
}

void dSPINConfig(void)
{
  boardA.configSyncPin(BUSY_PIN, 0);// BUSY pin low during operations;
                                    //  second paramter ignored.
  boardA.configStepMode(STEP_FS);   // 0 microsteps per step
  boardA.setMaxSpeed(10000);        // 10000 steps/s max
  boardA.setFullSpeed(10000);       // microstep below 10000 steps/s
  boardA.setAcc(10000);             // accelerate at 10000 steps/s/s
  boardA.setDec(10000);
  boardA.setSlewRate(SR_530V_us);   // Upping the edge speed increases torque.
  boardA.setOCThreshold(OC_750mA);  // OC threshold 750mA
  boardA.setPWMFreq(PWM_DIV_2, PWM_MUL_2); // 31.25kHz PWM freq
  boardA.setOCShutdown(OC_SD_DISABLE); // don't shutdown on OC
  boardA.setVoltageComp(VS_COMP_DISABLE); // don't compensate for motor V
  boardA.setSwitchMode(SW_USER);    // Switch is not hard stop
  boardA.setOscMode(INT_16MHZ_OSCOUT_16MHZ); // for boardA, we want 16MHz
  boardA.setAccKVAL(255);           // We'll tinker with these later, if needed.
  boardA.setDecKVAL(255);
  boardA.setRunKVAL(255);
  boardA.setHoldKVAL(32);           // This controls the holding current; keep it low.
}

« Last Edit: December 04, 2013, 06:28:23 pm by Priest » Logged

UK
Offline Offline
Tesla Member
***
Karma: 135
Posts: 7695
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I see connection points on your picture of the board marked motor power !!!

Yes the motor needs a separate power source - the Arduino can't supply enough power to run a motor.

You haven't described what actually happens? - perhaps nothing if there is no power for the motor?

...R
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 30
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

In this case, even when hooking up 12V / 330 mA to power the  stepper Motor, nothing happens.  We're wondering if maybe their Fritzing diagram is incorrect, as the Chip Select Pin looks to hook up to something other than that the diagram shows.
Logged

UK
Offline Offline
Tesla Member
***
Karma: 135
Posts: 7695
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

330mA seems very little power from a power supply. What motor are you using? The motor I have needs 330mA on each coil and I would expect losses between the power supply and the motor.

You should be able to get the motor to move with a short sketch that puts the step pin high for 1 millisec at a time. Repeat as needed with a short delay (perhaps 100msecs to start with) between steps. Then experiment with different timings.

I think that board defaults to 1/16th microsteps and if so it will need 16x200 steps for a revolution.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 30
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

330mA seems very little power from a power supply. What motor are you using? The motor I have needs 330mA on each coil and I would expect losses between the power supply and the motor.

You should be able to get the motor to move with a short sketch that puts the step pin high for 1 millisec at a time. Repeat as needed with a short delay (perhaps 100msecs to start with) between steps. Then experiment with different timings.

I think that board defaults to 1/16th microsteps and if so it will need 16x200 steps for a revolution.

I'm using the exact same stepper motor and power supply (turns out it's 600mA) that SparkFun uses for their example.

There is no 'step' pin with this driver.  The driver is delivered commands using the AutoDriver.h library using SPI serial communication.

The driver itself doesn't default to any sort of stepping, the setting must be specified in the code, as is with ours -
Code:
boardA.configStepMode(STEP_FS);
Logged

UK
Offline Offline
Tesla Member
***
Karma: 135
Posts: 7695
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry, I didn't realize it uses SPI. All red boards are not the same smiley

...R
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

geeze - got my boards (qty 2) just today and have them all soldered up & ready to go - i was going to use my Uno or Mega 2650. now i'm a bit concerned. very excited to get these going for my robot project - have you any further info on this?

I was looking on the SpF site for the BOB-11611 and in the comments there was mention of a "little bug" in the AutoDriverConfig.cpp code:
where it says:
stepModeConfig |= (stepModeConfig&0x07);
it should read:
stepModeConfig |= (stepMode&0x07);

dunno if this will help.

have you narrowed it down to a code problem or wiring? Please update either way. thanks,

Russ from Coral Springs
Logged

Russ from Coral Springs, Fl, USA

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So -I got wired up after looking at many sites and checking out the UNO's SPI pins just to make sure. you're sketch is correct and your wiring is correct but for one wire, and you mentioned it in one of your 1st posts - Here's what I think your problem was(is?)
When creating the boardA instance:

AutoDriver boardA(10, 6);

The 10 stands for the chip select (CS) as you have it, but the 6 is for defining the "Reset" pin.
Pin 6, while it may not be in any of the diagrams you looked at, still needs to be hooked up.
I added it when I was going for my 1st try & the system worked right away.
Thinking about you & your problem, I then powered down, detached the pin6 >-- Reset wire and powered up again. Nothing happened at all - looked to be dead.
So... this is probably where things went wrong - 1 simple (but important) wire.
my 1st half hour with the system has been revealing, I'm cautiously pleased.
for the 1st time in months (and many stepper drivers later), I'm able to run my wheels continuously without overheating motors and/or drivers. AND, i can change speeds without stopping, AND these commands do not seem to have any effect on processing speed! My robot is an "Inverted Pendulum" robot, which is a fancy name for "2-wheeled balancing robot". My Gyro/Accelerometer module has been chomping at the bit to get moving ahead, and I feel that I may have finally found the right Driver/Controller to get this done.

I'm a little concerned about the speed, but I'm using you "pared-down" version and will now move forward into different stepping modes to see if I can work with that, still @ speed set to 450 (whatever that means) , it's still fast enough to get things going.
also, speeds under 100 seem to start introducing a lot of resonance (vibration), I'm hoping to get rid of that.


Thanks for this post, and I'll write back with any positive/negative breakthroughs (hopefully positive).

Russ from Coral Springs, Fl
Logged

Russ from Coral Springs, Fl, USA

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I must make another notation on this...
I wanted to use the Arduino Mega 2560 board for my project, not the UNO...
go figure that i got stopped with SPI.
now, i'm not sure if my Mega's SPI is broken, but it does not work with using Pin 6 for Reset on the Autodriver.
there IS, however a RESET PIN on the Mega 2560, but it does NOT have a pin Number & therefore does not work with the Autodriver library which insists on a pin number.

Unfortunately, of all the devices i have experimented with so far, none of them support SPI and I'm at a loss to test my SPI bus since I do not have a scope or logic probe, yet (looks like it's about time for one)...

so, i either get a device that utilizes SPI to test on both my UNO & Mega, or i get another Mega.

another thing i can do is find out what the Reset function does, and maybe find out how to use it on the Mega, (or again, if it can be just about any digital pin, then maybe it's the Mega board) and it SHOULD be working on pin 6).

I will check back in once I have this resolved. this library is just so perfect for what i need to do, it's worth the extra time to get things done.

Russ from Coral Springs.

Logged

Russ from Coral Springs, Fl, USA

Pages: [1]   Go Up
Jump to: