×

Doing some holiday shopping? Please check here for shipping deadlines to make sure your order arrives in time.

final4eon

Member Since: June 6, 2017

Country: Singapore

  • If you were like me and experienced problems hooking up the autodriver, I hope my comment below will help. I burned 1 autodriver prior to getting this to work and you don't have to!

    Credits to the tech support team at Sparkfun, especially Mike, who worked through my setup problem via email.

    Credits to bboyho for his help comment, which is good enough for most intermediate users to get a successful setup.

    This is my working setup diagram

    Make sure the connectors are soldered on properly on the autodriver before attempting the setup as per above. I chose a 12V, 0.33A, 1.8 degree stepper motor for this setup and complimented it with a 12V, 1A DC power supply for the motor.

    Install Arduino IDE on your COM

    Install the sparkfun autodriver library

    Open SparkfundSPINexample in the IDE: File > Examples > SparkFun L6470 Autodriver >

    I spotted some mistakes on the example code:

    Mistake 1: The comments in the code suggested that the setting for "dSPIN_STEP_SEL_x" is set to full step, but I discovered that it was set to 16 microsteps per full step instead! Full step setting for "dSPIN_STEP_SEL_x" should be "dSPIN_STEP_SEL_1", not "dSPIN_STEP_SEL_1_16". This setting also means that there will be no microstepping per full step of the motor!

    dSPIN_SetParam(dSPIN_STEP_MODE, 
                      !dSPIN_SYNC_EN | 
                      dSPIN_STEP_SEL_1 | 
                      dSPIN_SYNC_SEL_1);
    

    Mistake 2: Slew rate by default was set to 180V/us, and not 290V/us as per commented in the code

    On top of that you can edit the code further if you need to (depending on your stepper motor specs). I'll list some of the main ones you'd want to check out:

    Point 1: Set the current threshold by using one of various values from "SparkFunL6470.h". For my 0.33A motor, I have chosen 750mA.

    dSPIN_SetParam(dSPIN_OCD_TH, dSPIN_OCD_TH_750mA);
    

    Point 2: You might need to play around with the setting below in iterations so as to set an appropriate upper limit on your motor speed. I had the benefit of getting the setup working even with default settings for this.

     // Configure the MAX_SPEED register- this is the maximum number
     //  of (micro)steps per second allowed. You'll want to mess 
     //  around with your desired application to see how far you can
     //  push it before the motor starts to slip. The ACTUAL 
     //  parameter passed to this function is in steps/tick; 
     //  MaxSpdCalc() will convert a number of steps/s into an 
     //  appropriate value for this function. Note that for any move 
     //  or goto type function where no speed is specified, this 
     //  value will be used.
     dSPIN_SetParam(dSPIN_MAX_SPEED, MaxSpdCalc(400));
    

    Point 3: You might need to play around with the setting below in iterations so as to impose a global scaling on the current used. I had no problems when left at default settings.

     // Configure the RUN KVAL. This defines the duty cycle of the 
     //  PWM of the bridges during running. 0xFF means that they are
     //  essentially NOT PWMed during run; this MAY result in more 
     //  power being dissipated than you actually need for the task.
     //  Setting this value too low may result in failure to turn.
     //  There are ACC, DEC, and HOLD KVAL registers as well; you may
     //  need to play with those values to get acceptable performance
     //  for a given application.
     dSPIN_SetParam(dSPIN_KVAL_RUN, 0xFF);
    

    Point 4: I wrote my own loop() function as below:

    void loop()
    {
      if (digitalRead(dSPIN_BUSYN) == HIGH) //check that L6470 chip is NOT busy
        dSPIN_Move(FWD, 50); //moves 50 microsteps, not full steps! Number of microsteps per full step is defined with dSPIN_STEP_SEL_x of dSPIN_STEP_MODE register
      else 
        dSPIN_SoftStop();
    
      delay(1000);
    }
    

    LASTLY...

    Connect the Arduino Uno via USB to your COM and switch on the DC power supply to the autodriver.

    Make sure the motor is secured as it will turn if setup is good!

    Upload the code into Arduino Uno via the IDE and wait for motor to spin.

    If you used my loop() function above, your motor should spin a degree equal to 50*[your motor step angle] every 1 second. My motor step angle is 1.8degrees, so it spins 90 degrees every 1 second.

    Success! You're on your own from here!

    If not, you probably got one of the steps earlier wrong. Check for burnt parts and wiring setup mostly.

No public wish lists :(