0.3 degree offset at 1030 steps... (esp32)

93 views
Skip to first unread message

Мини ТПА

unread,
Dec 20, 2025, 7:01:10 AM12/20/25
to accelstepper
At 1030 steps, there's a 0.3 degree shift, and at 1040 steps, everything returns to 0.
Maybe someone has encountered similar problems?


IMG_20250418_121708.jpg
#include "AccelStepper.h" // esp32

AccelStepper stepper4(AccelStepper::FULL2WIRE, 23, 27); // 4_A
bool en;

void setup()
{
    stepper4.setMaxSpeed(25000);
    stepper4.setAcceleration(25000);
}
void loop()
{
 
en = 1;

if (en == 1)  
    {
        stepper4.setMaxSpeed(25000); //4_ A
        stepper4.setAcceleration(25000);
        stepper4.runToNewPosition(1030); //                         ??????? 1040 ??????
        delay(50);

        stepper4.runToNewPosition(0);
        stepper4.setCurrentPosition(0);
        delay(50);
    }    
 }

Jim Larson

unread,
Dec 20, 2025, 4:29:32 PM12/20/25
to accelstepper
Welcome to the Accelstepper Forum!
When I know more, I can perhaps ask better questions, but here's a start.
- What driver board exactly are you using? The only reference I can find for "x42_v1.3" is in Chinese, which I cannot read.
- The comment in the code implies you are using an esp32. Correct? What version?
- Why are you using the FULL2WIRE and not the DRIVER interface type? Markings on the board show STP and DIR. You might try using this interface type.
- Are you using microstepping? If so, what ratio?
- Have you tried using lower step rates? You could try 2500 and even 250 and see if the problem persists.

I look forward to knowing more about your driver board, stepper motor, and microcontroller. In the mean time, try the things suggested and let me know what happens.

                  -jim
Message has been deleted
Message has been deleted
Message has been deleted

Мини ТПА

unread,
Dec 21, 2025, 6:26:27 AM12/21/25
to accelstepper
Hi Jim!
Thanks for your reply!
I'm not sure I understand the difference  FULL2WIRE and DRIVER .....?   The step and direction driver works.
Yes, the Chinese driver has a magnetic encoder and displays an error, but with a different driver, the motor also shifts on odd numbers (1030). When set to 1040, the motor returns to 0 correctly.
Board  ESP32-38pin
I changed the microswitch, speed, acceleration, and step loss...
I don't have access to the machine at the moment, but I'll test the DRIVER mode next week.
Sorry for my English! )
Best regards, Andre!

Jim Larson

unread,
Dec 21, 2025, 8:13:22 PM12/21/25
to accelstepper
Hi Andre -

The FULL2WIRE is designed to hook directly to the A and B sides of the motor and generate the pulses and phase needed to move the motor. The interface is assumed to be a dual H-Bridge. 
The DRIVER is designed to provide step and direction signals to the interface. The interface drives the dual H-Bridge. 
Since your interface is clearly intended to receive step and direction signals, I'm not sure what will happen when the FULL2WIRE is used. I'm eager to hear what happens when you try the DRIVER. We'll both learn something, I expect.
Do you have a data sheet for your interface board? If so, perhaps you can post a link to it.

Your English is very good, by the way! Don't worry.

                       -jim

                    -
Message has been deleted
Message has been deleted
Message has been deleted

Мини ТПА

unread,
Dec 23, 2025, 2:58:23 PM12/23/25
to accelstepper
Hi Jim!
Thanks for your reply!

воскресенье, 21 декабря 2025 г. в 00:29:32 UTC+3, jla...@pacifier.com:
Message has been deleted
Message has been deleted
Message has been deleted

Мини ТПА

unread,
Dec 23, 2025, 2:58:24 PM12/23/25
to accelstepper
Hi Jim!
Thanks for your response!
Yes, the driver with encoder nema17 is Chinese, good quality, with error output and other features, but with a different driver, the motor also shifts on odd numbers (1030). When set to 1040, the motor returns to 0 correctly...
Yes, ESP32-38pin
I'm not quite sure about the difference  FULL2WIRE and  DRIVER...?   The driver works with both step and direction.
I installed a microshmag, speed, acceleration, and step loss occurred.
I don't have access to the machine at the moment, but I'll test the mode DRIVER next week.
Sorry for my English! )
Best regards, Andre!
IMG_20251219_155104.jpg
воскресенье, 21 декабря 2025 г. в 00:29:32 UTC+3, jla...@pacifier.com:
Welcome to the Accelstepper Forum!
Emm_V5.0 Rev1.3.pdf
Message has been deleted

Мини ТПА

unread,
Dec 25, 2025, 2:30:28 AM12/25/25
to accelstepper
Hi Jim!
DRIVER::  is not working correctly, apparently the library is not compatible with ESP32.
I've already tried all the options.
вторник, 23 декабря 2025 г. в 22:58:46 UTC+3, Мини ТПА:
Question for the moderators: why are you deleting emails?

понедельник, 22 декабря 2025 г. в 04:13:22 UTC+3, jla...@pacifier.com:

Мини ТПА

unread,
Dec 26, 2025, 9:30:39 AM12/26/25
to accelstepper
I found a library for ESP32 based on AccelStepper...
FastAccelStepper.h.
It works flawlessly, and maybe someone will find it useful.
четверг, 25 декабря 2025 г. в 10:30:28 UTC+3, Мини ТПА:

Мини ТПА

unread,
Jan 21, 2026, 1:50:45 PM (12 days ago) Jan 21
to accelstepper
Hi Jim, I found out that the skipped steps are not odd numbers, they are one step skipped in each cycle, in this order starting from zero: (1,2 skipped), (3,4 no skipped), (5,6 skipped), (7,8 no skipped).....and so on ad infinitum

gjgsm...@gmail.com

unread,
Jan 22, 2026, 2:31:28 AM (12 days ago) Jan 22
to accelstepper
Hello Andre, I must admit I don't really understand exactly the issue your having except that you are getting some positioning offset at various step positions when running the motor? In reply to your comment that "the library is not compatible with ESP32", I have used ESP32 MCUs with the Accelstepper library many times over many years without any issues. The only important consideration I have found is to include (most times) the setMinPulseWidth() function in setup(), for example: stepper. setMinPulseWidth(20). The reason being, the ESP32 is a bit faster than the average Arduino (although technology is changing fast these days!) and the pulse width can be too short for normal operation. Any logic analyzer will confirm this.
What a great photo of your device! If that is a coffee making machine I want one for my workshop! Good luck with your project.
Geoff

gjgsm...@gmail.com

unread,
Jan 22, 2026, 5:45:06 AM (12 days ago) Jan 22
to accelstepper
An abbreviated translation of the manual:
Emm42_V5.0b_Translated_Selected_Sections.pdf

Мини ТПА

unread,
Jan 25, 2026, 12:16:49 PM (8 days ago) Jan 25
to accelstepper
Hi, Geoff
Yes, the positioning shifts at different steps while the motor is running.
I've also been using the Accelstepper library for a long time, and I really like it. I encountered this problem on this project.


Reply all
Reply to author
Forward
0 new messages