teemuatlut / TMC2130Stepper

Arduino library for Trinamic TMC2130 Stepper driver
MIT License
159 stars 50 forks source link

Problem with Running for Certain Number of Steps #60

Open Legohead259 opened 6 years ago

Legohead259 commented 6 years ago

Hello, I recently modified the Simple.ino example so that I could get my motor to step enough times to make one full revolution (200 in my case). However, I am having issues where I have to increment my step counter by some weird factor (1/250) just to get close to one revolution. I don't know what is causing this and the issue is not prevalent on my simpler stepper controllers. Any help would be appreciated.

teemuatlut commented 6 years ago

What's your microstep setting?

Legohead259 commented 6 years ago

I have it set to 1 right now. Experimented with 16 and 32 but they also require weird increments to work properly. Is there an equation I'm missing to get the number of steps correct?

On Tue, Nov 13, 2018 at 2:21 PM teemuatlut notifications@github.com wrote:

What's your microstep setting?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/teemuatlut/TMC2130Stepper/issues/60#issuecomment-438402092, or mute the thread https://github.com/notifications/unsubscribe-auth/AHtAch9G0v0uf4Hi2IzJdMJBRS36yC3Xks5uuxuwgaJpZM4YcViY .

-- Braidan Duffy Florida Institute of Technology Ocean Engineering c/o 2022 303-709-4048

teemuatlut commented 6 years ago

If you have a 200 fullsteps motor and your microstep setting is 16, then you need to send 200*16=3200 step pulses for a full rotation.

Legohead259 commented 6 years ago

Ok. I just tried it. For some reason at 16 microsteps, the motor just goes crazy; it starts whining and stuttering. It works just fine at 32 microsteps though. Any idea what could be causing that?

On Tue, Nov 13, 2018 at 3:33 PM teemuatlut notifications@github.com wrote:

If you have a 200 fullsteps motor and your microstep setting is 16, then you need to send 200*16=3200 step pulses for a full rotation.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/teemuatlut/TMC2130Stepper/issues/60#issuecomment-438426263, or mute the thread https://github.com/notifications/unsubscribe-auth/AHtActj-52-hZKzKLz7FhmCBlAAadbDvks5uuyyGgaJpZM4YcViY .

-- Braidan Duffy Florida Institute of Technology Ocean Engineering c/o 2022 303-709-4048

teemuatlut commented 6 years ago

Possibly bad config being pushed for some reason. Any time there's a read command, the library will remember the response and base the subsequent writes on that data pattern. If the read was faulty for some reason, it can affect the following writes.

Legohead259 commented 6 years ago

Interesting. Is there much of a torque difference between the microsteps (i.e. more steps=more torque) that yo know of?

On Tue, Nov 13, 2018 at 4:16 PM teemuatlut notifications@github.com wrote:

Possibly bad config being pushed for some reason. Any time there's a read command, the library will remember the response and base the subsequent writes on that data pattern. If the read was faulty for some reason, it can affect the following writes.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/teemuatlut/TMC2130Stepper/issues/60#issuecomment-438439701, or mute the thread https://github.com/notifications/unsubscribe-auth/AHtAcpJnofyLr6ui2Ne0m9HDoDb845Xqks5uuzaggaJpZM4YcViY .

-- Braidan Duffy Florida Institute of Technology Ocean Engineering c/o 2022 303-709-4048

teemuatlut commented 6 years ago

The relation with microstepping and motor torque is a myth/misunderstanding. All that matters is the angle between the rotor and the electric field (and the winding current). You often hear that increasing microstep settings decreases the motor torque, but no one ever remembers that you also take twice as many steps for the same distance/rotation and thus the electric field ends up the same.

Increasing the number of microsteps will not get you more torque, but will result in smoother motion. This is what the Trinamic microPlyer (=microstep interpolation) does.

Legohead259 commented 6 years ago

I see. Thank you for your assistance. Another follow up question: what's the best way to adjust the motor speed? Is there a dedicated register or method I can use?

On Tue, Nov 13, 2018 at 5:47 PM teemuatlut notifications@github.com wrote:

The relation with microstepping and motor torque is a myth/misunderstanding. All that matters is the angle between the rotor and the electric field (and the winding current). You often hear that increasing microstep settings decreases the motor torque, but no one ever remembers that you also take twice as many steps for the same distance/rotation and thus the electric field ends up the same.

Increasing the number of microsteps will not get you more torque, but will result in smoother motion. This is what the Trinamic microPlyer (=microstep interpolation) does.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/teemuatlut/TMC2130Stepper/issues/60#issuecomment-438468056, or mute the thread https://github.com/notifications/unsubscribe-auth/AHtAcioL1wyu9d7GfTFdTu0xQGLA6uhgks5uu0wegaJpZM4YcViY .

-- Braidan Duffy Florida Institute of Technology Ocean Engineering c/o 2022 303-709-4048

teemuatlut commented 6 years ago

Control the time between sent step pulses.

Legohead259 commented 6 years ago

Excellent. Thank you

On Nov 14, 2018 04:35, "teemuatlut" notifications@github.com wrote:

Control the time between sent step pulses.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/teemuatlut/TMC2130Stepper/issues/60#issuecomment-438597683, or mute the thread https://github.com/notifications/unsubscribe-auth/AHtAclbCZ88vIMY3UeCRwit1RheP5k4fks5uu-PMgaJpZM4YcViY .