Hello everyone! I am building custom FarmBot.
And from very beginning, i.e. when first time I connected together RPI, ARDUINO , RAMPS and stepper motor, I noticed periodical hits in motor when it rotated.
I did not mentioned it for a while.
But now I decided to dig into this trouble.
What I did:
Tried other types of drivers. Other A4988s and DRV8825. No difference. (Issue disappeared when i connected Leadshine DM422C, wich has powerful brains (DSP) )
Tried original and Chineese Arduino boards. No difference.
Tried several different stepper motors. No difference.
So finally I supposed that this is arduino software(ATmega is very slow) issue.
I took oscilloscope and here it is:
I’ve really been meaning to hook an oscilloscope up to the Arduino/Farmduino and check this out. Glad someone finally got around to it. You are correct in your assumption that the Atmega 2560 chip is just a bit to slow. One thing you can do to eliminate missed steps is to reduce the speed of the motors, or increase the number of missed steps. I’ve found that there is a sweet spot of about 3-5 missed steps. I haven’t been inside the Firmware repository in an awfully long time, but last i remember, the motor control portions are pretty well optimized. We’ve limits of the CPU before, and i suspect this is just another case of that. The 2560 has a clock speed of 16 mhz or 16000000 hz, and the motor control loop executes about 250 LOC inside the motor control loop. I don’t know how many instructions this is, but i suspect with all the assignment, variable storage, and serial + string formatting calls we are just executing too may instructions per clock cycle.