SparkFun ProDriver Hookup Guide

Favorited Favorite 3

Arduino Library Overview

Note: This example assumes you are using the latest version of the Arduino IDE on your desktop. If this is your first time using Arduino, please review our tutorial on installing the Arduino IDE. If you have not previously installed an Arduino library, please check out our installation guide.

We've written a library to easily get setup and control stepper motors with the SparkFun ProDriver. However, before we dive into spinning motors, let's take a closer look at the available functions in the library. You can install this library through the Arduino Library Manager. Search for SparkFun ProDriver TC78H670FTG Arduino Library and you should be able to install the latest version. If you prefer manually downloading the libraries from the GitHub repository, you can grab them here:

Let's get started by looking at the functions that set up the SparkFun ProDriver:


In the global scope, construct your sensor object (such as myProDriver) without arguments.

PRODRIVER myProDriver;


Below, are the available methods, which can be called:

  • .begin() - Initializes the motor driver with basic settings. It also returns false if error is detected (i.e. ERR pin is pulled low by the IC).
  • .pinSetup() - Configures pins as inputs/outputs as needed, and to default settings (disabled, standby) .enable() - Enables power to the motor output channels. .diable() - Disables power to the motor output channels
  • .controlModeSelect() - This configures the IC into the mode specified by the settings.controlMode variable.
  • .errorStat() - This function checks the status of the ERR output, which is triggered for thermal shutdown (TSD), overcurrent (ISD), or motor load open (OPD) errors.
  • .step(steps, direction, clockDelay) - Utilizes the CLOCKIN mode to step the motor a set amount of steps in a specified direction
  • .changeStepResolution(resolution) - Used to change the step resolution with clock-in stepping.
  • sendSerialCommand() - With the serial communication method, this function sends a serial command, if one of the settings for the serial control is modified.
    • Note, one of the settings (listed below) must be changed prior to calling this function, for a new command to be sent.
      • settings.phaseA
      • settings.phaseB
      • settings.currentLimA
      • settings.currentLimB
      • settings.torque
      • settings.openDetection
      • settings.mixedDecayA
      • settings.mixedDecayB
      • settings.phasePosition
  • .stepSerial(steps, direction, stepDelay) - Used with the serial communication method, to rotate the motor for a specified number of steps and direction.
    • Note, this function utilizes full steps.
  • stepSerialSingle(direction) - Used with the serial communication method, to rotate the motor with a single step in a specified direction.
  • .setTorque(newTorque) - A wrapper function to set desired torque setting.
    • Note, the changes will not take effect on the motor driver until sendSerialCommand() is called.
    • Valid torque options include the following:
      • PRODRIVER_TRQ_100 (default set in constructor)
      • PRODRIVER_TRQ_75
      • PRODRIVER_TRQ_50
      • PRODRIVER_TRQ_25
  • .setCurrentLimit(currentLimit) - A wrapper function to set desired current limit setting.
    • Note, this applies the current limit on both coils (A and B), is a percentage of VREF, and affected by the torque setting. The changes will not take effect on the motor driver until sendSerialCommand() is called.
      • currentLimit (10-bit value: 0-1023)