Skip to content

Sending too many pulses #27

@chbeeler

Description

@chbeeler

Hi @jh247247, I can't get the encoder and the motor to be in sync, even on the desk. My encoder and closed loop stepper were used with a NanoELS h2 before. I have set the steps per rotation settings and with my 1mm leadscrew and selecting 1mm thread pitch I would expect the motor to do one turn for each turn of the encoder. If I turn the encoder very slow (like 10s for one rotation) it matches:

Image

But when I turn it slightly faster I get to many pulses.

Image

I counted all encoder and motor pulses in the following picture and while I get 60 encoder pulses the motor was sent more than 70 pulses:

Image

I tried commit 66e751d and cfa3c95 since in the latest commit on main the motor jumps back with every rotation and on boj-position-consumption-fix the motor jumps when switching to enable after the spindle has moved.

Maybe I'm using the UI wrong? My steps are:

  1. Disable Lock
  2. Switch from feed to thread mode
  3. Switch to 1mm thread pitch
  4. Press ELS_ENABLE_BUTTON to enable the motor
    Now the encoder and motor should be in sync, or am I missing something?

I made also a quick video:
https://youtu.be/MrAN45gUym8

I just added a debug variable counting every time if(sendPulse()) is entered:
// attempt to keep in sync with the leadscrew
// if sendPulse returns true, we've actually sent a pulse
if (sendPulse()) {
test_pulse_count++;

Printing test_pulse_count along with m_currentPosition shows the same discrepancy:
See "Leadscrew pulses total" vs "Leadscrew position" in this screen recording: https://github.com/user-attachments/assets/02613b07-38ff-4bee-a65e-542bac010dfe

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions