1

Topic: RemoteXY_Handler ()

My nema 17 stutters when I include RemoteXY_Handler (); on the void loop, I tried to put RemoteXY_Handler (); outside void loop and nema spins smoothly, but I got disconnected on my ESP8266, if I put it back I am not disconnected, but the stutter is back, I guess RemoteXY_Handler (); is having a delay which is causing the void loop to slow, how to fix this?

2

Re: RemoteXY_Handler ()

Stepper motors are extremely timing sensitive.  Any code that must interrupt individual step control will cause a slight delay (stutter).  This is very common with any GUI/HMI librarys (Blynk, Virtuino, etc.) that also require a continuous share of the MCUs attention.

There are a few ways one can mitigate that, but really depends on the stepper control hardware, the way your code works and your programing abilities and experience.

For example...

- Run stepper code in called functions that do small movement processes at a time from start to finish, then return quickly back to the main loop before timeout.  But his may not be suitable for continuous movement needs.

- Use more advanced stepper hardware that takes care of the timing and thus only needs basic commands from the MCU, not simple ones that require the MCU to process each and every step.  But this may be costly.

- Use dual MCUs... one that just controls the stepper and is fed the basic directions via hardwired Serial, I2c, etc. to another MCU that runs the main show, including GUI/HMI libraries. 

- Optimize code for faster processing, no delay() commands and minimal blocking routines.

- Google around for other examples of sharing resources when using GUI/HMI links at same time as stepper motors (or other hardware requiring explicate timing, like programable LEDs)

"And voila, which is French for.......'and then I found out.'" - Ready Player One

3

Re: RemoteXY_Handler ()

I think the best solution in this case would be to use timer interrupts, in which only control signals are sent to the stepper motor. All calculation logic remains in the Loop, but the result of the calculation is processed by this interrupt.