Go Down

### Topic: Help finding the best way to get position of wheel (Read 3520 times)previous topic - next topic

#### darudude

##### Feb 09, 2009, 06:42 pm
I am helping a local school with their Robotics competition as a mentor. We're currently finishing up the controls and we're stuck at the following problem:

How do you know how many degrees a wheel has turned?

Now I am not talking about forward movement. Iam talking about the wheel rotating to the left or right so the robot can steer left or right. The robot has been setup to work exactly like a car. Steer the steering wheel left the wheels should rotate left; steer to the right, rotate right.

Both wheels are encased in a holding we constructed that should be able to turn freely for up to 30 degress. We have a DC Motor handling the turning. The problem I am having is fining the best way to make sure the wheels are turned a maximum of 30 degrees in either direction.

The only method we could think of was using a potentiometer. We make some sort of cam that will turn the knob on the potentiometer as the wheel turns to the left or right. Then we calibrate the range and add that to the software. Thus if the potentiometer goes out of range one way, we only allow rotation in the other direction. I dont know if this is the best solution. Any better suggestions? Or is the method I have adequate?

#### anachrocomputer

#1
##### Feb 09, 2009, 08:57 pm
Assuming you have used a geared motor to control the steering, could you measure rotation of the armature of that motor with an encoder?  Some kind of optical encoder would do it.  You can then sense the end-points of the motion of the steering with microswitches, so that the software can calibrate itself for absolute position.

#### darudude

#2
##### Feb 09, 2009, 09:35 pm
We did think about using an encoder but our problem is there is no way to save a state when the power turns off. The encoder would work fine if the robot always started off in the same position, but if the robot turns off mid way, there is no way for the encoder to know where the wheels are.

#### weirdo557

#3
##### Feb 09, 2009, 09:50 pm
is it the FIRST competition by chance?

#### Grumpy_Mike

#4
##### Feb 09, 2009, 09:57 pm
Quote
there is no way for the encoder to know where the wheels are.

So when you power up you turn the wheel hard left until it hits an end stop or until it stalls. Then tell the encoder it is hard left and go from there.

#### darudude

#5
##### Feb 09, 2009, 10:13 pm
@weirdo557: Yes this is the FIRST competition! What gave it away I might add?

@Grumpy_Mike: We intially created the chasis without thinking of this issue and there really isn't a way for us to add a controls hard stop (through microswitch, touch sensor, etc). If there was, there would be no need for the potentiometer or the encoder - as soon as you hit the hard stop in one direction, you can't turn any more in that direction.

Therefore I am trying to think of a solution which requires no hard stop, mechanical or electrical, at all. The problem is if the robot accelerates in a turn of more than 30 degress the robot has a high chance of toppling over.

#### Grumpy_Mike

#6
##### Feb 09, 2009, 10:17 pm
In that case.
There are two sorts of optical shaft encoder, one that gives you pulses and one that gives you position. The latter is what you want but they are quite expensive.

#### weirdo557

#7
##### Feb 09, 2009, 10:25 pmLast Edit: Feb 09, 2009, 10:26 pm by weirdo557 Reason: 1
well, you said mentor, robotics competition, and tracking the position of a motor or something.

team 3035 member here, corpus christi.

#### darudude

#8
##### Feb 09, 2009, 10:26 pm
I've never even heard of a position optical encoder!

Just did a quick search on digikey but didnt find anything. Would you happen to have a link to something that might work?

I am seriously considering using and encoder with an Atmega168 to store data to the EEPROM or Flash. Then output a PWM output to the main controller through a low pass filter.

#### weirdo557

#9
##### Feb 09, 2009, 10:29 pm
ohh, also, i think the Crio controller that you are using can save text files in the memory of the controller. I'm pretty sure you can use standard C++ fstream library and redirection operators to read and write values that wont be deleted upon powering off.

#10
##### Feb 09, 2009, 10:33 pm
Quote
I've never even heard of a position optical encoder!

Just did a quick search on digikey but didnt find anything. Would you happen to have a link to something that might work?

I am seriously considering using and encoder with an Atmega168 to store data to the EEPROM or Flash. Then output a PWM output to the main controller through a low pass filter.

Coming from an industrial background this is something I've run into. Positional encoders are pretty expensive and not something you'd want to use unless you have no choice. Even most CNC machinery uses rotational encoders. If you move the machine while the encoder is off they lose their position. As you said, you could use a normal encoder and store the position to EEPROM or flash. But you can't write to the flash memory of an arduino from the program (well... you can if you write your own low level code) so you'd have to use external flash or the built in eeprom. The EEPROM is rated for 100,000 cycles so be careful how often you write to it. Ideally it would be nice if you could count on being able to save just before the robot is turned off and rarely if ever before that. Then you'll never wear out the memory. You'll still need a way to calibrate it initially and then whenever the calibration is suspect.

#### mem

#11
##### Feb 09, 2009, 10:45 pmLast Edit: Feb 09, 2009, 10:45 pm by mem Reason: 1
Quote
The problem is if the robot accelerates in a turn of more than 30 degress the robot has a high chance of toppling over.

How about using an accelerometer to sense if the robot is becoming unstable and limit the turn and/ or speed ?

#12

#### imagitronics

#13
##### Feb 10, 2009, 05:18 am
I saw an article in Nuts and Volts a while back on creating an autonomous PowerWheels (TM) vehicle. He used a DC motor to rotate a steering shaft - and he implemented it by putting reed switches on the left and right side of the car and magnets on the steering mechanism (or vice versa) either way, when the reed switch closes, you're at the maximum turn. I don't think it's an ideal solution, but it might work in your case.

I can't seem to find the article online right now, but if you're interested in hearing more, I'll find the issue# when I get home.

Tim

#### jezuz

#14
##### Feb 10, 2009, 06:30 amLast Edit: Feb 10, 2009, 06:30 am by jezuz Reason: 1
yep, in this too, wat team r u representing?

team 1155 here

Go Up