Help with setting current limit for stepper motor driver

I’ve spent the last day trying to figure out how to set the current limit for this particular stepper motor: https://www.pololu.com/product/2878.

I am not sure if I by accident damaged it by short circuiting it, or something, as when I try to read the Vref from the potentiometer it does not change when turning the potentiometer. I am using a 24v power supply from x2 AA battery packs connected in series. I am also using a Model 3 B+ Raspberry Pi. Following the schematic showed on this page: https://www.pololu.com/product/2878 under “Using the driver”, I’ve connected the drivers VMOT and GND pins (with a 100uF 50v capacitor connected across like in the schematic) to the 24v power supply, I’ve left the Bipolar stepper motor coil leads disconnected (nothing is connected to the B1/B2 or A2/A1 pins on the driver as I want to set the current limit before attaching the stepper motor. The VCC pin on the driver is connected to a 5v pin on the Raspberry Pi, and the GND pin on the driver is connected to a GND pin on the Raspberry Pi. The STEP and DIR pins on the driver are left disconnected. The STBY and FAULT pins on the driver are also left disconnected. The Mode1/Mode2/Mode3 pins on the driver are connected to programmable pins on the Raspberry Pi that are able to be sent HIGH outputs of 3.3v or LOW outputs of 0v. And, I’ve left the Enable pin on the driver disconnected as well.

When I turn on the power supply (24v pack), and plug in the Raspberry Pi and run a simple Python program that sends the corresponding pins on the Raspberry Pi GPIO connected to the mode pins of the driver a constant 0v (LOW) and place my multimeter probes on the potentiometer and GND pin on the driver and attempt to change the potentiometer it is not affected. I’ve tested to make sure that the 24v power supply is working (it is) and is sending ~24v into the driver. I’ve even tried following another forum post here on Pololu asking about a different driver saying that you can also measure and set the potentiometer by hooking up all leads of the stepper motor but one and putting your multimeter in series with that lead to measure the amperes going into the coils (and putting the driver in full step mode) — it read 0 Amps on all settings of my multimeter.

Thank you. I could not find any extra information on setting up this particular stepper motor driver on the internet, and so this help is VERY appreciated!

According to the product’s page:

When the ~STBY pin is driven low, the driver enters a low-power mode, disables the motor outputs, and resets the translation table.

There’s no information about whether this pin is pulled high or low. You stated that you left this pin floating. Try driving this pin high - it might activate the VREF signal of the potentiometer.

Unlike the ~STBY pin, the ~ENABLE pin is driven low so you don’t need to connect it to your Pi in order to enable the driver.

Hope it helps

Thank you Yinondou, I tried this, it seems I can read the Vref (I set it to 0.12 volts to get a current limit of 0.6 A using the Vref calculation equation provided: “Current limit = Vref * 5 A/V”.

So now the Vref is set, I’ve tried running a simple Python program to step the motor and nothing. I am using this stepper motor by the way: https://www.pololu.com/product/1204. The 24v power supply to the driver seems to be working (reading ~24v at the VMOT / GND pin on the driver). I am driving all three mode pins LOW to put them into full step mode, STBY is being driven HIGH by connecting it to a 3.3v pin on my Raspberry Pi GPIO. STEP / DIR are being sent HIGHs/LOWs (see Python code), B1/B2 pins are connected to the Black/Green leads on the stepper motor (those two leads connect to one coil), and the A1/A2 pins on the driver are connected to the Blue/Red leads on the stepper motor as those correspond to the other coil (as read in the stepper motor docs on Pololu). The VCC pin on the driver (for logic power supply) is connected directly to a 5v pin on the Raspberry Pi GPIO. And the GND pin next to that VCC pin on the driver is connected to a GND pin on the Raspberry Pi GPIO.

Here is the test Python code I am running:

import RPi.GPIO as GPIO
from time import sleep

GPIO.setmode(GPIO.BOARD)

mode1 = 40 # these are physical pin numbers on the Raspberry Pi Model 3 B+ GPIO, as defined above "GPIO.setmode(GPIO.BOARD)"

mode2 = 38

mode3 = 36

DIR = 37
STEP = 35
CW = 1 #1 as in True
CCW = 0 #0 as in False

SPR = 200 # Using NEMA-8 stepper motor (200 steps per revolution)

GPIO.setup(mode1, GPIO.OUT, initial=GPIO.LOW)
GPIO.setup(mode2, GPIO.OUT, initial=GPIO.LOW)
GPIO.setup(mode3, GPIO.OUT, initial=GPIO.LOW)
GPIO.setup(DIR, GPIO.OUT, initial=GPIO.HIGH)
GPIO.setup(STEP, GPIO.OUT)

step_count = SPR
delay = 0.0208

try:
    while True:
        GPIO.output(mode1, GPIO.LOW)
        GPIO.output(mode2, GPIO.LOW)
        GPIO.output(mode3, GPIO.LOW)
        
        for x in range(step_count):
            GPIO.output(STEP, GPIO.HIGH)
            sleep(delay)
            GPIO.output(STEP, GPIO.LOW)
            sleep(delay)
 
except KeyboardInterrupt:
    print("done")
    GPIO.cleanup()

Right now I don’t see anything wrong with the code. However, I have no information about your wiring. What I suggest is:

  • In order for us to be able to help you better you can show us a picture of your setup: The Pi with your driver, motor and wiring.
  • As far as I remember the pin numbers of the Pi’s GPIOs can be confusing as there are several pinouts for it. For example, physical pin 11 is BroadComm (BCM) pin 17 and is pin 0 in the WiringPi library. https://pinout.xyz/ gives you all the info about the pinouts. A quick check you can do is to simply check that setting the GPIO for the STEP pin high actually sets the pin’s voltage to 3.3v and setting it low sets it to 0. You can then rinse and repeat for the rest of the pins.

Hello, nmo.

We have a resistor on that carrier board that connects STBY to VCC, so it should not be necessary to connect that pin to anything to set VREF. Can you post pictures of your connections?

-Nathan