I am trying to build a boat lift controller. The lifting mechanism is a gearbox driving a pipe that wraps a cable around it. I was thinking I could use an incremental rotary encoder to stop it at 3 points. The positions I want it to stop at would be a lower limit a middle limit and upper limit. I would like a switch to set the middle limit when it is where I want it. I would also want push buttons to take it to the upper limit the middle limit and lower limit and one to stop it at any position. The control for can be two contactors one for forward and one for backward motor operation. I need help with the code as I know very little about it. I would be willing to pay someone for writing the code.
The Gigs and Collaborations section (http://forum.arduino.cc/index.php?board=26.0) has members who will code for pay. You can request that a moderator move your post to there. Use the report to moderator button.
FYI: here are some of the things you, or the person doing this, have to think about:
1) If it jams, that needs to be detected and reported to operator.
2) Incremental encoders need a zero reference. If the boat is not always going to see that reference point, then you need to store the last position in memory. If someone moves the boat by hand, then the stored position won't match the real position.
3) System needs to know the maximum travel so it can stop in case of encoder failure, or slippage.
4) System should have limit switches that kill power to motors if it goes past a certain point.
5) If the encoder slips, the operator needs to know.
There's a lot to be thought through when you're building systems that can move objects large enough to cause damage. PM me by clicking on my username if you'd like to talk.
Normally you'd measure the length of cable travelled using a separate free running roller/pulley the cable runs over. This as the amount of cable per turn changes for the take-up roll, as it takes up more and more cable.
Indeed lots to think about in terms of safety and other control issues with such systems.
Yup, a string pot or a string encoder would normally be a simple, reliable feedback mechanism.
If the designer can be assured that it will never be moved other than by this control mechanism, a lot of my concerns go away. I have memories of a safety-critical system I worked on that used encoders for positioning, and all the trouble we had to go to to ensure that if someone messed with the positions while the power was off, we would always behave correctly. An awful lot of engineering went into making that fail-safe.
The encoder would be attached to a shaft on the gearbox that will drive the pipe. the only way it can move is if the motor is turned. The encoder as a limit switch os more for convenience and not safety as most systems do not have and limit switch at all. Power to the motor will be cut off when away so no one can tamper with it.
That does not a good way to measure how much cable is on the winch, as the diameter changes with the amount of cable, and this is not accurately predictable (it depends on how the cable decides to wind itself). You have to use a separate wheel for that. Of course that wheel can also be mounted on the cable in a way it can't be removed easily.
An encoder on the gearbox may let you know the thing is stalled as no pulses come in any more.
The cable doesn't wrap over itself it winds in a screw form along the pipe 2-3/8 od about 7 turns will lift 4ft. It's a 5/16 cable.
I just want the encoder to shut motor off when it reaches a set point if it drifts past a little bit that will be ok. The pipe only turns a few rpm.
Can you post a picture of the lift?
It this style
https://bh-usa.com/product/drive-4090-enclosed-gear-box/ Here is the gearbox I am using.
https://bh-usa.com/product/3k-4k-drive-shaft-2-drive-pipe/ Here is the shat that goes through the gearbox an in the pipe. I will attach the encoder to the shaft on the backside of the gearbox.