Accelerating a stepper motor

  Рет қаралды 6,096

Maxim Kachurovskiy

Жыл бұрын

Going over 3 different options to do it.
Source code: gist.github.com/kachurovskiy/051c59d85bc0dd34c6e6f83eb4a837cd

Пікірлер: 14
@PiefacePete46
@PiefacePete46 Жыл бұрын
Excellent! I got more useful information from your 81 second video than I got from some that were 20 minutes long! Thanks for your time.
@rogerbettaney8443
@rogerbettaney8443 11 ай бұрын
Hi maxim, thank you for your informative videos, I’ve written a few simple programs requiring stepper motors and I have found that using tone to generate pulses instead of writing code takes far less time of the mc, thus speeding up the poll rate. It may be worth having a quick look. Also adequate controlled acceleration can be achieved with simple maths calculations by using the difference between target speed and actual speed. Pls keep developing the ELS as for most of us, including me, do not have the ability to code such complex programs. Many thanks Roger
@MaximKachurovskiy
@MaximKachurovskiy 11 ай бұрын
Roger, thank you. Using tone and pwm allows for much higher speeds but we no longer know how many impulses were issued exactly so precision is lost.
@rogerbettaney8443
@rogerbettaney8443 11 ай бұрын
@@MaximKachurovskiy understood, thank you for your response. I thought you may be counting output pulses on a separate input via interrupt and storing in a register for position record. But recording pulse output count directly from pulse instruction would appear to be more efficient and possibly more reliable. Many thanks Roger
@HM-Projects
@HM-Projects Жыл бұрын
Good demo, it's nice to have constant acceleration and deceleration profiles that don't stall the motor or result in lost steps. I need to update mine to something like your example. Some closed loop stepper / servo drives have built-in S-curve compensation, e.g. CTL57T.
@MaximKachurovskiy
@MaximKachurovskiy Жыл бұрын
Yes, I need to look into the s-curve. Not sure how much of a difference it really makes during those 0.07s though 🤔
@HM-Projects
@HM-Projects Жыл бұрын
@@MaximKachurovskiy dunno either, given my stepper drivers have s-curve compensation I haven't taken a serious look. On my list for later.
@carneeki
@carneeki Жыл бұрын
I like s-curve as well. There's a deep rabbit hole of acceleration profiles to look at. If you know a little calculus, you can say that speed is the derivative of position with respect to time. The second derivative is acceleration. The third derivative is called jerk which is pretty common to see mentioned in 3d printer source code and settings for slicers and is probably the edge of where most leave it, but lift engineers (as in elevators) also take it one step further... The 4th derivative is snap, and telescope and space satellite designers have been known to use 5th and 6th derivatives, "crackle" and "pop". Speed can be thought of as how quickly the position changes. Acceleration can be thought of as how quickly the speed changes. Jerk can be thought of as how quickly the acceleration changes. Snap can be thought of as how quickly the jerk changes. TinyG, G2 and Klipper all go to the extreme of 6th order (crackle) but I wouldn't be surprised if there are many diminishing returns beyond 4th order snap.
@HM-Projects
@HM-Projects Жыл бұрын
@@carneeki TIL, cheers and I thought anything more than constant acceleration might be an overkill 😆
@GoPaintman
@GoPaintman Жыл бұрын
So, in my implementation of ELS using a Teensy, I don’t use acceleration. The loop checks if the encoder position has changed, and if it has, it adds steps to a counter (based off selected feed rate/thread). This algorithm helps with the fact that i don’t always have a whole number relationship between spindle position and leadscrew movement. The counter is decremented everytime a timer interrupt fires and the stepper step pin is fired high, then on the next interrupt, low. I have the timer set up for 180khz. The Teensy also implements digitalwritefast, so I’m not getting a big delay when setting the pin. I wonder if this just works because of the torque I have with a 4A Nema 23 @ 48V?
@MaximKachurovskiy
@MaximKachurovskiy Жыл бұрын
Yeah, I'm thinking about something similar too. What happens if you get the spindle to max speed and then turn on the ELS? :)
@DeanZ
@DeanZ Жыл бұрын
Hi Why does my stepper (nema24) rotate very slowly when I move it left and right with the button? The offset is set to 2mm. I have a DM542T on which I can set a minimum of 400 microsteps. I test the motor on the table and not in the lathe.
@MaximKachurovskiy
@MaximKachurovskiy Жыл бұрын
Hi Dean, if this is about NanoEls, please start a new discussion on GitHub and we will sort out the problem. Please attach photos of your setup. Thanks!
@autoxinvr
@autoxinvr 6 ай бұрын
Pretty amazing build. What pulley did you use on the lead screw?
БИМ БАМ БУМ💥
00:14
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 2,4 МЛН
НРАВИТСЯ ЭТОТ ФОРМАТ??
00:37
МЯТНАЯ ФАНТА
Рет қаралды 8 МЛН
Secret Experiment Toothpaste Pt.4 😱 #shorts
00:35
Mr DegrEE
Рет қаралды 34 МЛН
My cat gave me a very strange plate #cat #cats
0:32
Prince Tom
Рет қаралды 39 МЛН
REAL OR FAKE?
0:10
dednahype
Рет қаралды 12 МЛН
A woman comes a plan to teach her indifferent husband a lesson #shorts
0:44
Fabiosa Best Lifehacks
Рет қаралды 3,2 МЛН
Don´t WASTE FOOD pt.3
0:20
LosWagners ENG
Рет қаралды 16 МЛН