Using the L6470 Dual Stepper Controller

Introduction

This post assumes that the reader is familiar with programming and using SPI. This post will cover how to use the Dual L6470 Stepper Controller that we manufacture.

To program the  L6470 use the dSPIN Library which can be obtained here: dSPIN. It is derived from work done by Mike Hord over at Sparkfun and as such remains in the public domain.

Connecting to the Dual Stepper Controller

The Dual Stepper Controller has the following connectors:

  • 2 x 4 pin outputs for the stepper motors
  • 2 pin input which can be used for stepper voltage input Vs
  • 14 pin header for control –  Vs can also be supplied via this header.
screenshot.52

Dual Stepper Control interface

It is important that a voltage is applied to VS in order for the L6470 to operate correctly.

The SDI pins are:

MOSI, MISO and CLK.

For Channel A and B:

  • CSx – Slave Select A/B
  • RSTx – Reset A/B
  • FLAGx – Flag A/B

These pins all have 10K pull ups.

Initializing L6470

Finally we come to code. In order to access the L6470 you need to have SPI initialized. The following code can be placed in your setup() function, it initializes SPI for communication with the L6470.

Once SPI is initialized it is possible to communicate with the L6470.

The easiest method of using dSPIN is to just derive a class from it – this will make it easier to keep track of variable for each controller. The code below initializes a linear stepper – this can be seen from the acceleration and deceleration speed – typically you would ramp up and down depending on the inertia of the system.

There is also a function to move the stepper N steps forward or in reverse depending on the value of the number of steps passed – negative will move the stepper in reverse.

As you can see the most complex portion of setting up your L6470 is selecting the parameters – these can be determined from the datasheet, or trial and error. often it is just a case of decreasing or increasing the acceleration/deceleration  profile to get a good response from your stepper motor.

Conclusion

The L6470 dSPIN is a very powerful stepper controller and has the ability to go from 1/128th of a step to full steps. It is also highly configurable to match almost any stepper profile that you need.

{ 8 comments… add one }
  • Leon January 23, 2014, 12:46 am

    Hey guys, this looks like something we can use. A couple questions: can you go up to 48V to drive two nema 23? And would you happen to have sample wiring diagrams for Arduino Uno and Beaglebone Black?

    Reply
    • gkarlsson March 12, 2014, 3:31 pm

      You could drive up to 48V I will do a tutorial on sample hookups.

      Reply
  • Marcus Wolschon December 2, 2015, 7:50 am

    Why do you call it a dual-driver? It drives only a single stepper.

    Reply
    • gkarlsson December 3, 2015, 12:54 pm

      No idea what you are talking about – the board has 2 L6470 drivers which means it can drive 2 stepper motors. We drive 4 steppers in the Thrive kiosk with one two of these boards. If you are talking about the chip itself yes it only supports a single stepper – that’s why we use 2 and call it a Dual L6470.
      In order to use the code for the second stepper you instantiate another object with the correct CS port for that port.

      Reply
  • Luke Beno December 11, 2015, 9:28 pm

    Hi,

    What stepper motor is used in this tutorial. I have tried http://www.kr4.us/stepper-motor-125-oz-in-200-stepsrev.html and http://www.ebay.com/itm/231617460499?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT with L6470. I am using 12V vin. both can move but neither produce much of any torque. I realized the first is rated for 3V, that is what prompted me to try the 12V one. Still no luck, it must be a parameter adjustment thing…

    -Luke

    Reply
    • gkarlsson February 21, 2016, 9:44 pm

      You should probably bump your voltage to 24V.

      Reply
  • Christian Rishøj April 10, 2016, 8:55 pm

    Is the SW pin on the L6470 wired and accessible?

    If not, do you have another method for automatically establishing a known absolute position?

    Reply
    • gkarlsson November 18, 2016, 12:48 pm

      Not on this revision of the board – we have new boards that have the sw exposed – we just need to build them.

      Reply

Leave a Comment