0
\$\begingroup\$

I followed these instructions to drive a couple of stepper motors from a Raspberry Pi 4B and two DRV8825 drivers.

I made the board, plugged in the 16 pin drivers, wrote a Python script to instruct the motors and got frustrated as one driver (or motor) is dead and the other makes the motor buzz, but doesn't move, and got very hot (melted the PTEG 3D printed base.) The motor heats very fast, very hot.

For full step (no mode pins connected). I have sleep and reset bridged and always HIGH. They are connected to the Raspberry Pi’s 3.3 V power pins.

Motor:

DigiKey details , datasheet

According to the motor datasheet, it can take maximum 1500 PPS when loaded and 850 unloaded.

I'm using time.sleep() between GPIO changes, adjusted by benchmarked error

    # A Pulse implies full period. which needs to be 50% duty cycle, so signal to GPIO doubles this freq.
    # target sleep: 1/(2*1500) = 0.0.0003333333333333333
    # 1/(2*1500)*.73 = 0.00024333333333333333
    # >>> benchSleep(1/(2*1500)*.73)
    # slept 0.0003504753112792969 seconds
    # slept 0.0003421306610107422 seconds
    # Actual sleep differs by net avg 9.664361317952476e-05 or 39.71655336144853%; \
    #     with std dev 2.3774077176703874e-06 or 0.9770168702755017%;
    # Actually slept on avg 0.00033751328786214195 or 138.72309406582076%; \
    #     with std dev 5.701971382635937e-06 or 2.3435969513505697%;
    LOADED_MAX_PPS = 1500
    LOADED_SLEEP_HIGH_LOW = 0.0002433

    # target sleep: 1/(2*850) = 0.000588
    # >>> benchSleep(0.000496)
    # slept 0.0006048679351806641 seconds
    # slept 0.0005941390991210938 seconds
    # Actual sleep differs by net avg 9.250990549723315e-05 or 18.50198109944663%; \
    #     with std dev 2.652120187789779e-06 or 0.5304240375579559%;
    # Actual sleep differs by net avg 0.0005880355834960938 or 118.55556118872857%; \
    #     with std dev 3.174699532262383e-06 or 0.6400603895690288%;
    NOLOAD_MAX_PPS = 850
    NOLOAD_SLEEP_HIGH_LOW = 0.000496

The buzz pitch changes between NOLOAD_MAX_PPS and LOADED_MAX_PPS but the motor still does nothing. It is bipolar (4 wires), but according to the tutorial the driver abstracts that, I only think in terms of step+direction pins.

Any hint in the right direction is greatly appreciated.

Driver:

DRV8825

Driver Power supply

HiLetgo 5pcs XL6009 Boost Module that takes 12V from a 12V battery/DC-power supply and outputs 24V. (I plan to run everything from a 12V 7A battery: steppers, Raspberry Pi, drivers.) I got the boards from Songhe and Hiletgo

Each driver has a 330 uF electrolytic capacitor, rated 36 V.

enter image description here

Yellow: Direction Blue: Step Orange: Sleep + reset (always HIGH)

Edits

Current limiting.

After fixing the current limit to 1/2 of previously set (to 250 mA), I still get erratic behavior. I also found a great Arduino forum post on the basics of steppers, where the HIGH to the driver STEP pin is very short (10-20 us) compared to the LOW (small duty cycle, most videos/pages out there suggest 50% duty), having the LOW’s sleep time driving the frequency.

I refined my Python code to address this, but still no luck. The motor is quieter, though.

On the scope I see two issues:

  • Terrible noise of up to 3 V at ~130 kHz. I am thinking of a filtering capacitor but haven’t seen anyone using that on the STEP pin.
  • The DIR pin pulls down when the STEP pin pulls down. Not in code, not intended.

Power sources & Noise.

I noticed the noise is present only when DC power source is connected, bypassing the boost converter (12 V -> 24 V -> VMOT), When the 12 V battery is connected instead, the motor is silent, and moves inconsistently but in one direction (when DIR is LOW, DIR HIGH has the issue of DIR pulling down when STEP pulses, see images below). Code is sending a train of 50 pulses when I press a cursor key (left/right).

15uS HIGH STEP Pulses; DIR LOW

15 us HIGH STEP Pulses; DIR LOW; 190 steps per second.

15uS HIGH STEP Pulses; DIR HIGH

15 us HIGH STEP Pulses; DIR HIGH; 190 steps per second. See how DIR drops when STEP Pulses. enter image description here Closeup

High freq noise

High freq noise (130 kHz) when 24 V DC wall-plugged Power supply is on. Motors get the buzz.

setup

Setup. see only black marker. Brown is irrelevant. I sue alternative power sources 12 V battery or 24 V DC wall-plugged power supply.

Parts: HiLetgo XL6009

Hiletgo DRV8825

12V battery

24V power supply

Magically works now.

As my soldered board was glitching on STEP HIGH & DIR HIGH, I decided to rebuild it on a breadboard. In the breadboard the signals on scope where very clean, but motor didn’t move/buzz at all. So I wired back my soldered board, now it hoes clockwise and counterclockwise, with minimal noise in the STEP & SIR signals. Not sure what was wrong on the soldered one before unplugging/plugging back and what was wrong on the breadboard to have motors dead.

\$\endgroup\$
7
  • \$\begingroup\$ How did you setup the required current limit of 250 mA? \$\endgroup\$
    – Jens
    Commented Dec 15, 2023 at 16:33
  • \$\begingroup\$ @Jens Like a drunk man, I set the potentiometer in the IC to 0.250V (meaning 0.5A) as that was peak current for the motor somewhere. Now at 0.125-0.130V it rotates, not perfectly, but motor still heats a lot, the IC seems cooler tho. Thanks for the tip. I’ll debug the script a bit to see what’s next and update the question soon. The motor heats even when I’m not moving it. \$\endgroup\$
    – juanmf
    Commented Dec 15, 2023 at 18:04
  • \$\begingroup\$ @Jens updated question at the bottom. Thx. \$\endgroup\$
    – juanmf
    Commented Dec 20, 2023 at 15:44
  • \$\begingroup\$ It would help if you posted a schematic of the PCB with the DRV8825. Did you use the circuit from the datasheet and have your own PCB made, or are you using purchased DRV8825 modules? \$\endgroup\$
    – JRE
    Commented Dec 20, 2023 at 15:53
  • \$\begingroup\$ @JRE added missing details. Thx \$\endgroup\$
    – juanmf
    Commented Dec 20, 2023 at 17:13

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.