# How to turn my robot 90 degrees ?

1. Jan 27, 2012

### ranoosh96

how to turn my robot 90 degrees ??

firstly I am an arabian so I wish you can talk an easy accent ^^

I will try to tell you every thing about my project in english
am working on robot which makes a square

but I couldn't turn it 90 degrees exactly

my robot has two motors dc every motor connected with one wheel
the task of my robot is Draw a square .....

I used pwm to controll the wheels so that the speed of each wheel with especially then The robot goes towards at least the wheel speed of the other

If you have an Idea to make a square without pwm plz tell me ^_^

I wish my article is right hhhhhh sorry I am not so good at english ^^

Last edited by a moderator: Jan 27, 2012
2. Jan 27, 2012

### ranoosh96

Re: how to turn mu robot 90 degrees ??

Oops! I forget to tell you that , my robot has pin in the middle of the structure of the robot
so ... the robot draws wherever it walks

3. Jan 27, 2012

### schip666!

Re: how to turn my robot 90 degrees ??

I'm going to presume that your 'bot has two wheels with the pen in the center between them (rather than something like a regular car which has four wheels where only the front ones turn). To make a 90deg turn "all you need to do" is turn on one of the motors for a specific amount of time, but this will make it turn around the other wheel rather than the pen in the center and you'll draw a curved corner. To get around that you can turn on the other wheel, going in the opposite direction, for the same amount of time -- actually, turn both on for half the time of the single motor since that will add up to the same effective distance traveled.

The problem is knowing the exact amount of time to get 90 deg, including acceleration, deceleration and wheel slip. If all you need to draw is something that looks sort-of-like a rectangle, then you can just estimate the motor on time with some experiments. Otherwise you need sensors. If your project needs accurate turn angles and repeatability you'll need to use some combination of wheel-encoders to tell you how far the wheels have gone and location devices like an electronic compass or ground sensors (In some cases the guts of a computer mouse could be used).

4. Jan 27, 2012

### skeptic2

Re: how to turn my robot 90 degrees ??

schip666 has good advice. In addition I think you will need better accuracy for making a 90 deg. turn than timing the motors. Perhaps you could incorporate a magnetic compass to tell you when you've turned 90 deg.

http://www.robotshop.com/magnetic-sensors-compass.html

5. Jan 28, 2012

### jim hardy

Re: how to turn my robot 90 degrees ??

closed loop control schipp is suggesting is always better than just "aim and shoot".

funamental principle - measure where you've gone and apply corrections to get where you're going. good life advice, too.

i like the idea of mouse sensors. they're made to measure where mouse has gone.

check out hobby robotics sites

my two cents...

Last edited: Jan 28, 2012
6. Jan 29, 2012

### ranoosh96

Re: how to turn my robot 90 degrees ??

oky thanks for all ... I found the solution finally it's so simple ..just use encoder to controll the wheels .. and when U want to make right angle (90 deg ) Make the wheel goes in the opposite direction of the second wheel ... ^_^ thank U schip666 :)