So i am having an issue with running 4 x nema 17 stepper motors with raspberry Pi Pico W using the a4988 stepper motor drivers for my mecanum wheels rc bot . Whenever I run the test code to see if all the motors move (any direction) sometimes on 1 motor moves and someone they don't. First I was using a 12v 2amp charger to directly supply the robot with electricity . I used a breadboard power supply module to step down the voltage to 5v to supply to the raspberry Pi Pico W and directly supplied 12 to the a4988 modules. But the motors would only vibrates and not spin (the circuit is wired correctly and I even checked the stepper motors cores before wiring even tried switching the wire connections.). Then I bought 2x11.1v 2600mah Li - ion batteries and tried to use that as supply but only one motor would move. When I disconnect the moving motor. Then the other one would move but still not all the remaining 3.i tried to disconnect the second one too but the other two will still not move I don't know what the issue is. I have been supplying the a4988 vdd pin with 3.3 v from raspberry Pi Pico W is that the issue. Am I supposed to supply 5v?Code:
import timefrom machine import Pin# Stepper motor pins configurationLF_STEP_PIN = Pin(0, Pin.OUT) # Left Front wheel step pinLF_DIR_PIN = Pin(1, Pin.OUT) # Left Front wheel direction pinRF_STEP_PIN = Pin(2, Pin.OUT) # Right Front wheel step pinRF_DIR_PIN = Pin(3, Pin.OUT) # Right Front wheel direction pinLB_STEP_PIN = Pin(4, Pin.OUT) # Left Back wheel step pinLB_DIR_PIN = Pin(5, Pin.OUT) # Left Back wheel direction pinRB_STEP_PIN = Pin(6, Pin.OUT) # Right Back wheel step pinRB_DIR_PIN = Pin(7, Pin.OUT) # Right Back wheel direction pin# Constants for stepper motor movementNUM_STEPS = 200 # Number of steps to move each motorSTEP_DELAY = 0.01 # Delay between steps in seconds# Function to move stepper motordef move_stepper(stepper_pin, direction_pin): direction_pin.value(1) # Set direction for _ in range(NUM_STEPS): stepper_pin.value(1) # Step pulse time.sleep(STEP_DELAY) stepper_pin.value(0) time.sleep(STEP_DELAY)# Move all stepper motors in one directionmove_stepper(LF_STEP_PIN, LF_DIR_PIN)move_stepper(RF_STEP_PIN, RF_DIR_PIN)move_stepper(LB_STEP_PIN, LB_DIR_PIN)move_stepper(RB_STEP_PIN, RB_DIR_PIN)
Statistics: Posted by DSBPARTH — Wed May 08, 2024 10:56 am