Positioning an actuator based on user input

We are doing a project for school and our group is having trouble with our actuator position.

We have a display that is displaying a number between 1 and 10. We want the user to be able to choose a "difficulty" between 1 and 10 and have our actuator position according to the users input. We have been able to have the actuator power for a time period based on the number that is chosen, but the problem arises when the user wants to change difficulty after one has already been chosen. We do not want to have to reset the actuator to the original position before going to the new input, but right now that is what we are doing.

What would be the easiest way to program in arduino to go from a difficulty of 8 to a difficulty of 4. and have the system respond quickly and end up at the position we need?

I can provide more information about the type of actuator or any other questions you may have, just in dire need of help since we're new to arduino.

Any information at all will help.

Thank you,
Joe

Gonna need more info. How do you know where you're putting it now? Time? Or is there some kind of position sensor? Explain more, and post the code you have now. Comments in the code are always good. :slight_smile:

--Donnie

jamauro18:
What would be the easiest way to program in arduino to go from a difficulty of 8 to a difficulty of 4. and have the system respond quickly and end up at the position we need?

That depends what sort of actuator you have and how you are controlling it.

Right now we are using time because the actuator does not send location information.

I can post our code a little later, i currently do not have access to it.

Hopefully this is allowed
http://www.princessauto.com/pal/en/Electric/12V-DC-2-in-Stroke--270-lb-Linear-Actuator/8507808.p

That is the actuator we ordered.
It is a Hydroworks 12V DC 2 in. Stroke 270 lb Linear Actuator

I appreciate any help
Thank you

Well, assuming startup acceleration both directions is consistent, and assuming you can't damage it by trying to make it keep going at either end of the stroke, and assuming speed once moving is consistent, time will probably work okay for this.

So you just have to keep track of position based on time in the code. It really shouldn't be terribly hard to do.

--Donnie

jamauro18:
Right now we are using time because the actuator does not send location information.

That isn't ideal - without any feedback you won't get accurate positioning, and if you're allowing movement between positions these errors would be cumulative. You might actually be better off bringing the actuator back to a home position before each movement, as you've already described.

If you definitely want to allow relative movements then you need to remember the current position of the actuator and subtract that from the desired end position to work out how far to move it and in which direction. Then you can use your timed method to move the actuator.

Thank you both!
I guess the issue we're having is just keeping track of the position based on time. So say we power it for .5 seconds for difficulty level 1. Then the next input is difficulty level 4 without going back to "home position", we're just having trouble getting it to remember that it was at difficulty 1 previously before going to difficulty 4. I guess we'll just need to add more variables to store the previous difficulty, and have a time associated with each difficulty, say 2 seconds for difficulty 4. Subtract the "old selected difficulty" from the "new selected difficulty" so it will know to power for 1.5 seconds in this case.

I do agree, it will accumulate error if the calculations are incorrect since if we're off at position 1 then we try to move to position 2 based off of position 1 then the error will add. If we are having a lot of error then we will resort to going to a home position before moving from one difficulty to the next.

It depends on the type of actuator exactly, but you could add rudimentary feedback relatively easily. Basically add some for of switch at each position, and that way you can reduce error by knowing you are at a location.

Without adding some form of feedback, this problem becomes more complicated and error prone. If you can rehome at 0 every so many changes (or whenever you get a new player), this problem is lessened. This also assumes the load on the actuator doesn't change versus position, (IE as you move further, gravity affects it more or less)