Hello,
In a project for university, I use a strong stepper motor (Nema 23, with TB6600 driver and Arduino Mega2560) to make a rope move up and down. A laser and photodiode (attached to the moving arm, itself attached to the stepper) are used to reset the position in case the rope pulls too hard on the motor and there is an overtorque situation.
I do indeed expect problems when there is an overtorque... BUT I have a systematic displacement even when the load if very small, i.e. when the rope is not attached. I don't expect this to be a problem with the motor, it's quite sturdy. See this video for the problem.
My personal hypothesis is that there is a small down time in the current delivered to the motor, and mean there is no current, then gravity acts and moves the arm a tiny bit. However this would be rather surprising.
For my project, I need the average of the motion to stay precise, but I don't know how to do that 'properly'. I thought about software fixes using the photosensor seeing the laser and resetting the stepper zero position, but this seems rather silly (and needs to be gradually changed etc etc). I have the feeling that the error can be fixed otherwise and is due to my lack of understanding of what I'm doing, be it hardware or software.
Here is my code attached (over the 9000 characters limit).
Any ideas on how to avoid this drifting motion will be greatly appreciated!
PS: I'm not a great expert either in C++ or Arduino or electronics, so if my mistake could have been fixed easily with more research, sorry for the post. I'm a theoretical physicist and haven't touched experiments in a while, I'm doing this project because we were let down by the experimental team.
dev.ino (10.4 KB)