optical shaft encoders

i am getting some really wierd readings from my lift encoder. i start it at the lowest position on our lift at 0 then lift up to about 1200 or so then return to the down position and the encoder reads back -250. i have replaced the encoder and have hade several people look over my program. any ideas as to who it is so inaccurate.

Would you mind posting your code. I can’t help much without it. Also, make sure, if it is a gear drive, that the gears are in the same place as when they started. A nice explanation of your robot would be nice.

I had the same issue last year with a linear lift. I basically worked around the problem by resetting the encoder every time it lowered, detecting the bottom position with a limit switch.

//Andrew

i am the main programmer for team 1064A look for Nbraska Nerd Herd posts for pictures.

i put a limit switch at the bottom and it resets at the bottom and its halfway consistent now thanks guys.

You don’t even need to put the limit switch there. You can just have it zero before every action it makes.

Zeroing before every motion will still accumulate error after many actions. A limit switch assures of very low error.