Timelapse Slider

Hi, I am making my own timelapse slider
I was already able to make it work but not the way I want to

What was I able to do: Move it left to right and right to left

What was I not able to do: Control the time it takes.

the slider is about 1 meter long and I need it to go from left to right in a time between 20 seconds and 72 hours (time is chosen by the user).

If I use delay, since it only uses whole numbers, there is a huge inaccuracy
Using other libraries for stepper motors just dont offer me the speed range that I need

I was hoping if any f you guys knew how to solve my problem.

Thanks
José Mateus

How many motor steps between extreme left and right?

Pictures of slider and slider drive system (lead-screw, toothed belt or whatever) then the code you are using with details of the interface used and motor being driven.

Without the above, your question might as well be "I have something, it doesn't work, what's wrong with it"

756E6C:
How many motor steps between extreme left and right?

It takes 68712 steps to go left to right with micro stepping (1/16)

jackrae:
Pictures of slider and slider drive system (lead-screw, toothed belt or whatever) then the code you are using with details of the interface used and motor being driven.

Without the above, your question might as well be "I have something, it doesn't work, what's wrong with it"

Okay, I will be uploading all I can

So I tried using the accelstepper library, I was able to get it functioning with the constant speed example, but the problem is that I can get the speed to be less than one. I dont remember the units for speed that this library uses, but I know that it was not enough

I also did the old way:
for(int x = 0; x < 200; x++) {
digitalWrite(stepPin,HIGH);
delayMicroseconds(500);
digitalWrite(stepPin,LOW);
delayMicroseconds(500);
}
But the problem with that is that if I use delayMicroseconds, I wont be able to make the slider go left to right for and extended period of time (say 24h+).
And if instead of using delayMicroseconds, I use delay, I will be limited in the minimum amount it takes for the slider to go left to right and I will get inaccurate results.

I created a couple of variables:
long timeR; //time recieved from bluetooth in minutes
long timeS = timeR60; //the time recieved in seconds
long timeMs = timeS
1000; //the time recieved in ms
long totalD = timeMs/68712;
long singledelay = totalD/2;

They served to get the timed received by the Bluetooth module, and convert it into delay.
The problem with that is say that I want it to take 15 minutes
1560=900
900
1000=900000
900000/68712=13.0981488
13.0981488/2=6.5490744
The problem with that is that delay does not read decimal places, so it would be as if instead of 6.5… it would be 6
Working our way back, we would see that when the delay is 6ms, it would take about 13.7 minutes instead of 15
another problem is that the delay can’t be less than one

What other way could I use to drive the stepper motor?

hazcoper,

Some time ago I made a camera slider, and documented the electronic side of it on this forum.

The following my help in your project

Ken