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:
- 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.
- Where are pins 11 and 12 initialized for SPI communications? 13 for SCK? Is this handled internally by calling 'include AutoDriver.h' ?
- 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.
#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.
}