View unanswered posts | View active topics It is currently Sun Jan 26, 2020 5:04 pm

Reply to topic  [ 2 posts ] 
Author Message

Joined: Mon Nov 08, 2010 2:00 pm
Posts: 6
Post Encoders
I am using the encoders on the dc motors but I am having trouble figuring out how to set targets for the motors. I do not mean how to set a target for the motor to turn lets say 180 degrees, but rather have set positions. For example, if i press button 1 I want the motor to turn to "home" position. If I press button 2 i want it to go to lets say "1st base." And that if i turn the program off and on again, the home position would be the home position i want, not to zero the encoders and make the position they started in "home." This is because i want the motors to set to home through the programming rather than manually set the motor to my "home" position every time i will use the robot.
Thank You

Mon Nov 08, 2010 2:07 pm

Joined: Mon Mar 15, 2010 4:24 pm
Posts: 124
Post Re: Encoders
Yes, this type of "auto-calibration" can be really handy. It depends on the range of operation of your motor, though. If the range of operation is less than 360 degrees, you can use a touch sensor to "auto-calibrate".

Upon startup, start the motor turning slowly in the direction of "home", and stop the motor as soon as you sense that a tab attached to the motor has pressed the touch sensor. Then initialize everything to 0 or whatever. If you want "home" to be, say, halfway between two extremes, then you can try moving the motor all the way to one of the extremes until you sense the touch, then all the way to the other extreme where you sense a second touch, the move the motor half way between them and initialize everything to zero or whatever.

Another way that doesn't require a touch sensor can be used if the range of motion includes a "hard stop" at one end. Simply move the motor slowly towards the "hard stop" and watch for it to "stall" by watching for the encoder to stop changing values for awhile. Then stop the motor and you can initialize everything to zero.

Hope this helps.


Mon Nov 08, 2010 5:35 pm
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.