Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: Ustary on October 07, 2010, 09:29:12 AM

Title: Get motor position
Post by: Ustary on October 07, 2010, 09:29:12 AM
Hi, i'm now planning my first robot, finally... For a project for school, i'm going to do a robot which moves similarly to the RHEX robot(RHex (http://www.youtube.com/watch?v=pNi2ytOdbTY#)     a link for the robot moving). you can see that when moving straight, it moves 3 legs at a time, like they were a set. For this reason, and also to make it easier and cheaper, in my robot i will have each set of 3 legs connected to a single motor.

Ive been searchin around, and so far i think i will have a arduino 26$ microcontroller(since i can get it from free, from a friend), 2 motors(i still don't have, but don't think it will be much of a problem), some gears(not very worried about them), and a receptor

I'm currently running a simulation, for studying the legs, the programming, and the required motors.

Ive got a few questions:

1-How can get some input to my microcontroller, has to what is the current angle of each set of legs. I need this so i can know when one of the 2 sets of legs has ended they're rotation, so i can tell the other set to start rotating, and also to know if the robot is standing up, or if the motors need to keep it up.

2- How hard would it be for a microcontroller to handle the input from a 2 channel radio receiver?

Thank you in advance.
Title: Re: Get motor position
Post by: Soeren on October 07, 2010, 06:25:27 PM
Hi,

1-How can get some input to my microcontroller, has to what is the current angle of each set of legs. I need this so i can know when one of the 2 sets of legs has ended they're rotation, so i can tell the other set to start rotating, and also to know if the robot is standing up, or if the motors need to keep it up.
If you just need feedback on a specific position (contrary to knowing the angle at any time), the easy (and cheap) way is to use a slotted optocoupler and have a blade mounted on the rotating axle, blocking the gap of the optocoupler, when it has reached the position valid for starting the other side.


2- How hard would it be for a microcontroller to handle the input from a 2 channel radio receiver?
That depends on what the receiver puts out.
If it's a standard R/C receiver, you'll see a synch pulse followed by a number of servo pulses (2 in your case) and a pause to make a total of ~20ms. That is quite easy for the controller - how hard it will be for you to program it, I have no idea, as I don't know your experience level.
Title: Re: Get motor position
Post by: Ustary on October 08, 2010, 08:20:21 AM
Hi, Thank you so much for answering.

In response to the 1st answer: I wouldn't need  to know the exact angle of the claw, something like: "is it at least 5/10 degrees from being down", "is it 5/10 degrees from being up?", or is it to the ledt side, or right side. Something like that should do the trick, is your solution capable of something like that? also, can you please explain a litle better, since i didn't quite get it?

To the second:I can program in vb.net pretty ok, many stuff related to forms app, database or games(3d games included), i never actually programed in C(the language of the controller), but i belive the transition not to be very very hard. As long as the controller intuitivelly receives 2 numbers(one for each channel) i believe to be capable.

Thank you so much.
Title: Re: Get motor position
Post by: Soeren on October 08, 2010, 07:32:22 PM
Hi,

In response to the 1st answer: I wouldn't need  to know the exact angle of the claw, something like: "is it at least 5/10 degrees from being down", "is it 5/10 degrees from being up?", or is it to the ledt side, or right side. Something like that should do the trick, is your solution capable of something like that? also, can you please explain a litle better, since i didn't quite get it?
A slotted optocoupler is accurate to less than a degree, but can only detect a single position.
It is like a miniature light gate, with an infrared beam going from one side to the other, where it's detected by a phototransistor. Whenever something blocks the beam, the output changes.
You have to arrange a bit of plate material to interrupt the beam when the position is reached.


To the second:I can program in vb.net pretty ok, many stuff related to forms app, database or games(3d games included), i never actually programed in C(the language of the controller), but i belive the transition not to be very very hard. As long as the controller intuitivelly receives 2 numbers(one for each channel) i believe to be capable.
OK.
It won't be vb.net (far from) and it won't be 2 numbers, but rather 2 pulses where you have to measure the time intervals in between (they'll be between ~1ms and ~2ms each).
Title: Re: Get motor position
Post by: Ustary on October 09, 2010, 12:11:14 PM
Hm.. Then i guess the optocoupler wouldn't be very suited, in order to give me some flexibility of "movements" in a near future... I've been researchin, and i think a 3/4 bit "absolute rotary encoder" would be the perfect componet for what i want. Can anyone tell me where i can look for these sensors? and how expensive they would be?

Thank you for the answers, and sorry for the noob question... it's my first robot, and i really don't want to buy anything until everything is totally mapped out...
Title: Re: Get motor position
Post by: Razor Concepts on October 09, 2010, 12:32:08 PM
You can find them on digikey or mouser, or just search absolute rotary encoder and find which companies make them and who distributes them.
Title: Re: Get motor position
Post by: Ustary on October 11, 2010, 01:11:35 PM
Thank you for the advise, i've been searching, and i have already found a couple at affordable prices, which i think should do the trick.

Just to explore all other alternatives, i've been reading that servos have built in position feedback, and plus, they come already geared. Would it be suitable for me to use a modified servo(which can coontinuously rotate) for this application? Does the servo gives the microcontroller some input as to what it's position is?

Thank you for your replys
Title: Re: Get motor position
Post by: knossos on October 11, 2010, 01:30:42 PM
While it is true that servos have built in position feedback, when you modify one for continuous rotation, you loose the position feedback capability.  (See the SoR tutorial on servo modification for more details).