The DRV8825 stepper motor driver [1] has a maximum step frequency of 250 kHz.
The ESP32 Dev Board I'm using has 2 MHz to 60 MHz oscillator.
How can this stepper motor driver be controlled by the ESP32?
[1]
https://www.ti.com/lit/ds/symlink/drv8825.pdf#page=7
DRV8825 Stepper Motor Timer and Clock
Re: DRV8825 Stepper Motor Timer and Clock
Why did you post your question in the "Showcase" section of the forum.
-
- Posts: 9764
- Joined: Thu Nov 26, 2015 4:08 am
Re: DRV8825 Stepper Motor Timer and Clock
Good point. Moved to hardware.
Re: DRV8825 Stepper Motor Timer and Clock
The clock frequency of the ESP32 is sort of like the maximum frequency you can achieve downstream. It doesn't just automatically mean that everything runs on that frequency.
From the datasheet:
STEP 22 I Rising edge causes the indexer to move one step.
It looks like with this chip, you send pulses to the STEP pin to get the motor to move in steps. So you can setup PWM on a GPIO pin of the ESP32, and connect that GPIO to the STEP pin of the motor driver. With PWM you can define the frequency, it could be 250 kHz or below. Then you can freely adjust that PWM pin to change the stepping speed of the motor.
If you wanted more precise control, moving in a small number of finite steps, you could set up the GPIO pin simply as an output. Then toggle it with pin.value(1), pin.value(0), to send a single pulse to the STEP pin. This is kind of like manual PWM, just one pulse at a time, you lose some control of the duty cycle and frequency but you gain control over the number of pulses. You can do a loop and counter to move a predefined number of steps.
From the datasheet:
STEP 22 I Rising edge causes the indexer to move one step.
It looks like with this chip, you send pulses to the STEP pin to get the motor to move in steps. So you can setup PWM on a GPIO pin of the ESP32, and connect that GPIO to the STEP pin of the motor driver. With PWM you can define the frequency, it could be 250 kHz or below. Then you can freely adjust that PWM pin to change the stepping speed of the motor.
If you wanted more precise control, moving in a small number of finite steps, you could set up the GPIO pin simply as an output. Then toggle it with pin.value(1), pin.value(0), to send a single pulse to the STEP pin. This is kind of like manual PWM, just one pulse at a time, you lose some control of the duty cycle and frequency but you gain control over the number of pulses. You can do a loop and counter to move a predefined number of steps.
Who is online
Users browsing this forum: No registered users and 162 guests