Linear actuator without feedback. Position tracking using accumulated time?

I am looking to track the position of a linear actuator using accumulated time. The actuator has a 4.25" stroke with a speed of 2"/second. It should take 2125ms to move from end to end but some variation is introduced when under load. The actuator is freewheeling at each end so it can be mechanically home when reaching either end of its mechanical limits by running it an extra amount of time to ensure you at truly at the physical end of motion. I am looking to be able to move the actuator to ten positions along its length by tracking time to each position. When the actuator is moving TO (but not FROM) either P1 or P10 an extra time would be added to ensure we reach the actual physical endstop.

Looking for some advice on what the best programming approach would be to track time in a manner like this. I have the rest of the project under control with switch input, power output, GPS control and logic for the when to move to which position really just need some programming help to simplify the best way to track and calculate time between positions and how to add in the extra homing time when reaching an endstop.

Edit: I should say the arduino will be controlling the power to the actuator following a GPS speed control loop and user input from a up/down switch. The up/down momentary switch would tell the arduino to move the actuator to the next preset position.

The speed, 2" / second, is when it is runing. The accelleration will affect the effective time needed for a certain move. Maybe that can be measured and used in the calculations.

The speed, 2" / second, is when it is runing. The accelleration will affect the effective time needed for a certain move. Maybe that can be measured and used in the calculations.

The actuator has a very high gear reduction. The acceleration is effectively instantaneous.

I'm fine with some error being introduced as it will work itself out once it reaches either end stop. It would be nice to have position feedback but this application is underwater and the logistics of designing and adding a submersible position feedback system is too much. Really I just want a good programming approach to quickly calculate that the time to move from Position 4 to Position 6 is T4+T5, but the time to go from Position 4 to position 0 is T3+T2+T1+C and I will have those values defined in the program.

I could do it with 100 if statements if current position = position 4 and requested position equal position 0 then use this preset formula, but I would have to write a formula for 90 position moves. Seems there should be a better way.

Suppose You put the travel time for each part into an array- Index 0 is the time from position 0 to position 1 and so on. Moving from, let's say from Pos 1 to 5, read and accumulate the values at index 1, 2, 3 and 4. Then execute the move using the accumulated running time.

I created a move calculation table to calculate the time to get to position to position the hardest part is im just not sure how to use an array to call the right value. I could brute force it with if else statements but I guess I need to go learn more about arrays and how to use them.

My way opens up for unequal distances between the destinations. Just make a summing loop

``````int destArray[nrOfPos];
'     destArray[0] = distance from P0 to P1;//in milliseconds
destArray[1] = distance from P1 to P2;//in milliseconds
destArray[2] = distance from P2 to P3;//in milliseconds
.
.

int sum = 0;
for (int i=currentPosition, i < destinationPosition, i++)//positions numbered 0, 1, 2, 3 ......
{
sum = sum + destArray[i];
}
runMotor(sum);
``````

Have you considered using micros() to time how long the thing is ran from end to end?

Next put the thing under a normal load run it from end to end, get the end to end run time, using micros(). Perhaps do 10 runs and get an average run time at start up. Than divide the averaged run time by 10 to get the time for 1 positional time unit. I’d continuously, use the end to end movements and total time traveled to update the TotalEndToEndRunTIme/10= 1 positional time unit. That way you can have a self calibrating positional time unit as operating conditions change.

You want to move the thing one positional unit run the thing for 1 positional time unit. Want to move 5 units, run the thing for 5X 1 positional time unit.

Idahowalker:
Have you considered using micros() to time how long the thing is ran from end to end?

Next put the thing under a normal load run it from end to end, get the end to end run time, using micros(). Perhaps do 10 runs and get an average run time at start up. Than divide the averaged run time by 10 to get the time for 1 positional time unit. I’d continuously, use the end to end movements and total time traveled to update the TotalEndToEndRunTIme/10= 1 positional time unit. That way you can have a self calibrating positional time unit as operating conditions change.

You want to move the thing one positional unit run the thing for 1 positional time unit. Want to move 5 units, run the thing for 5X 1 positional time unit.

Thats another interesting function I haven’t yet learned about but it seems that you would need some system indication to tell you when youve reached the end of the movement. This system has no feedback, you can run the motor infinitly in either direction and the actuator will free wheel at either limit of its movement. Since this application is submerged I don’t want to drill additional holes to run sensor wires to know when I’ve reached those mechanical limits.
My application is to replace a control box that came on a boat for a stern mounted device that raises and lowers. The factory controller has died and is no longer in production. The factory controller did just run on timers because there is no position or endpoint feedback built in to the actuators at all its just 12v/-12v to move each direction and it depends on being able to freewheel at each end to mechanically home itself when reaching either limit.

My way opens up for unequal distances between the destinations. Just make a summing loop

``````int destArray[nrOfPos];
``````

’     destArray[0] = distance from P0 to P1;//in milliseconds
destArray[1] = distance from P1 to P2;//in milliseconds
destArray[2] = distance from P2 to P3;//in milliseconds
.
.

int sum = 0;
for (int i=currentPosition, i < destinationPosition, i++)//positions numbered 0, 1, 2, 3 …
{
sum = sum + destArray[i];
}
runMotor(sum);

This looks like it will work exactly for my application. The only change I might have to make is to have an if statement that if the desire posistion is position 1 or 10, then I will add in a bit of extra time on the run motor command to ensure that it mechanically homes itself when reaching the endpoints. Thank you for this, this is a tremendous!

What is the motor attached to? Why not put some sort of feedback on the attached "equipment" e.g. a pot and read the position off that. If it freewheels at the ends how do you know it is? If you want to move it to position 3 you must know where it is starting from.

If you happen to be at position 2 (which you currently can't know) and you actually think it is at position 5 and you want to move it to position 2 you reverse it by 3 position which would make it position -1 BUT because it freewheels it will be at position 0. (Now I am confused so imagine the Arduino).

I believe you really do need some form of feedback even if it is just limit switches at the ends.

Maybe You can allow the first position, "Pos 0", to be at the end stop? Of course, checking for illegal positions will protect You from really bad movements.

windoze_killa:
What is the motor attached to? Why not put some sort of feedback on the attached "equipment" e.g. a pot and read the position off that. If it freewheels at the ends how do you know it is? If you want to move it to position 3 you must know where it is starting from.

If you happen to be at position 2 (which you currently can't know) and you actually think it is at position 5 and you want to move it to position 2 you reverse it by 3 position which would make it position -1 BUT because it freewheels it will be at position 0. (Now I am confused so imagine the Arduino).

I believe you really do need some form of feedback even if it is just limit switches at the ends.

And???

windoze_killa:
And???

Add pots in an under water thing?

What about magnets and hall effect pick ups?

And you can get waterproof pots.

Maybe You can allow the first position, "Pos 0", to be at the end stop? Of course, checking for illegal positions will protect You from really bad movements.

The first and last positions are the end spots so any time it hits those I can just run an extra little bit of correction to make sure it fully reaches the end points. You can not physically run past the first and last positions even if you ran the motor infinitely. (other than eventually burn out the motor as its not made for continuous duty cycles)

This cancels out any accumulated error that happened in the middle. Getting the middle positions close is good enough - the system has been working from the factory with a timer based system for 13 years but now the control box died and can't be replaced.

windoze_killa:
What about magnets and hall effect pick ups?

And you can get waterproof pots.

I'm trying to avoid drilling holes in the hull of my boat to add more wires. The first and last position are the mechanical endstops of the actuator itself and the controller that came with the actuator system from the factory was purely time based to guess steps in between the end stops and when it reaches either end stops it self corrects any accumulated error.
I'm also hoping to open source this to the community of people who have the same boat/device as me because there are a number of people who also have a failed controller and no one making a replacement controller. My hope is to use all the factory wiring and even the factory electronics enclosure without requiring people to add sensors that were never there for precision that isn't really needed because the mechanical design of the system bypasses the need to have position feedback. It would be nice its just not in the scope of what I'm trying to do.

Count the "normal" stops, key in their positions, and (!) assign the end positions values regarding them as valid positions!

Going from the last "normal" position to an end stop You can of cource use an "if" and add some extra run time.

windoze_killa:
What is the motor attached to? Why not put some sort of feedback on the attached "equipment" e.g. a pot and read the position off that. If it freewheels at the ends how do you know it is? If you want to move it to position 3 you must know where it is starting from.

If you happen to be at position 2 (which you currently can't know) and you actually think it is at position 5 and you want to move it to position 2 you reverse it by 3 position which would make it position -1 BUT because it freewheels it will be at position 0. (Now I am confused so imagine the Arduino).

I believe you really do need some form of feedback even if it is just limit switches at the ends.

An example of the product is in this video 2018 Malibu Power Wedge II™ (I.S.P.) - YouTube
The actuator is attached to a product called power wedge by Malibu boats. My boat is an older model without the computerized touchscreen shown here but its the same mechanical concept as whats shown here. Its a drag device to cause the boat to have increased displacement and thereby larger wake produced for watersports. The geometry and mechanical design of the system are that when the actuator is fully extended - the wedge reaches its stow position all the way up. If you run the motor on the actuator the freewheel design of the actuator will not actually drive it any further than this position. When the actuator is fully retracted the wedge will then be in the lowest position and again it freewheels and can not - over retract and there wedge can not move in to an illegal position. The mechanical design of the system does not allow any illegal positions - I merely need to approximate 10 unequal steps in between the mechanical end stops and when ever I reach an endstop to actually continue driving past that end stop so that any accumulated error is taken out.