Comments: Getting Started with the AutoDriver - v13

Pages

Comments 7 comments

  • final4eon / last year * / 2

    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.

  • ——————– Tech Support Tips/Troubleshooting/Common Issues ——————–

    AutoDriver V13 MISO and MOSI Pins

    The difference between V10 and V13 of the Autodriver is the labeling and pin locations. Overall, the boards function the same.

    Unfortunately, V13 does not explicitly say what pins are MISO and MOSI. You would need to open up the Eagle files to determine what pins they are. Here’s a picture showing where the MISO and MOSI pins are if you are connecting one AutoDriver to the Arduino => https://drive.google.com/file/d/0B0jwgLkjMWzDVGVuYWE1Z01ENjg/view .

    Arduino Pin Definitions in dSPIN Example

    Comparing the example code from the GitHub Repository and the hookup guide, there are some wires not connected that is not in the hookup. This isn’t an error. It’s so that the customers can hookup to the AutoDriver and just make it work with the example code in the hookup guide. There is a note under the Fritzing diagram that indicates that the wiring is different and it is not using the same example code that is in the GitHub Repository.

    If you were using the dSPIN_example.ino [ https://github.com/sparkfun/L6470-AutoDriver/tree/master/Libraries/Arduino/examples/SparkFundSPINexample ] code, you must hook up dSPIN_BUSYN to pin 16 and dSPIN_RESET to pin 17 from AutoDriver’s “IN” or “FROM PREV BOARD” pins to the Arduino Uno. On the Arduino Uno, this would technically be A3 for pin 17 and A2 for pin 16 [ http://playground.arduino.cc/Learning/Pins ].

    #define dSPIN_RESET      17  // Wire this to the STBY line, also pin A3
    #define dSPIN_BUSYN      16 // Wire this to the BSYN line, also pin A2
    

    Wiring it up correctly, I was able to get the dSPIN_example to work. The 125 oz.in stepper motor in our catalog was able to spin in one direction with an 8V, 2.1A power supply as the code suggests. Here was the wiring between the AutoDriver and an Arduino Uno:

          AutoDriver V13     <=>  Arduino Uno
             3-5V            <=>      5V
              GND            <=>      GND
              SCK            <=>      13
    MISO(SDO)(SD to prev bd) <=>      12
    MOSI(SDI)(SD to prev bd) <=>      11
              CS             <=>      10
             BUSY            <=>      A2
            RESET            <=>      A3
    

    Note: Not all the pins (like busy, reset, and chip select) are defined the same in each of the examples. Make sure that the Arduino’s I/O pins are connected to the AutoDriver correctly with respect to the to the defined pins.

    Arduino 101?

    If you see this error when using the Arduino 101 and AutoDriverV13 with the dSPIN example:

    Arduino: 1.8.0 (Windows 7), Board: "Arduino/Genuino 101"
    
    C:\Users\...\Documents\Arduino\libraries\SparkFunAutoDriver\examples\SparkFundSPINexample\SparkFundSPINexample.ino: In function 'void setup()':
    
    SparkFundSPINexample:198: error: 'TCCR1A' was not declared in this scope
    
       TCCR1A = 0;  // No waveform generation stuff.
    
       ^
    
    SparkFundSPINexample:199: error: 'TCCR1B' was not declared in this scope
    
       TCCR1B = B00000110; // Clock on falling edge, T1 pin.
    
       ^
    
    SparkFundSPINexample:200: error: 'TCNT1' was not declared in this scope
    
       TCNT1 = 0;   // Clear the count.
    
       ^
    
    C:\Users\...\Documents\Arduino\libraries\SparkFunAutoDriver\examples\SparkFundSPINexample\SparkFundSPINexample.ino: In function 'void loop()':
    
    SparkFundSPINexample:213: error: 'TCNT1' was not declared in this scope
    
       Serial.println(TCNT1, DEC);
    
                      ^
    
    exit status 1
    'TCCR1A' was not declared in this scope
    

    , it’s probably because the timers defined in the library are not compatible with the Arduino 101’s Intel Curie. I recommend following the tutorial and using the Atmega328P that is populated on the Arduino Uno or RedBoard Programmed with Arduino.

  • Can you please update the hookup guide for the v13 boards. I would like to see a table with Arduino pins on one side and v13 AutoDriver header connections on the other.

    Notes: - v13 boards no longer have MISO / MOSI written on them. - v10 had Arduino pin 10 (chip select) going to the 6 way header (pin 4), it now goes to the 10 way. It looks like the SDO has moved as well.

    At the moment I am unable to get this board to communicate with an Arduino so my project has come to a screaming halt. Please post some pictures of a working v13 board.

    • We’ll get that fixed ASAP. In the meantime, the pin labeled “SD from prev board” is MOSI and the pin labeled “SD to prev board” is MISO. Sorry for the mixup!

    • I’ve updated the schematic on the example page to show more clearly the connections needed on the v13 board, and to match the example sketch.

      If you’re only using one board, simply omit the connections to the bottom board and leave it off. You’ll also need to remove all references to “BoardB” from the example sketch.

  • Hi! How does one change the ‘SDO to:’ jumper setting to ‘Next bd’? Thank you


If you've found a bug or have other constructive feedback for our tutorial authors, please send us your feedback!