Servo vs. Stepper for Sensor Rotation
Archiver
Posts: 46,084
Hello all! For a college robotics project, I'm designing a robot to
navigate an arbitrary hallway using a BS2p-24. I'm going to use an
ultrasonic sensor (Devantech SRF08) to be able to tell where the
robot is at in relationship to the hallway walls. I'd like to not
have any "touch" sensors, but use only one SRF08.
To get a complete picture of where the robot is at, I'd like to get
distance readings in the front, right and left of the robot. Thus,
I'd like to rotate the sensor to each position, take a distance
reading, make movement (drive) decisions, then rotate again. This
will be a continuous process.
My question: to rotate the sensor to these positions (left, front and
right) should I use a stepper or servo motor?
I currently have a stepper that I'm driving with a L293D H-bridge.
It has 15 degrees/step. I'm forseeing a problem with keeping track
of where the rotation is at, and the step sequence needed to rotate
in the desired direction. For example, when the bot gets turned on,
I'd need to run a "calibration" routine to determine where "forward"
is and what "step sequence" I'm on.
My obvious alternative is a servo motor. I've no experience with
them, so I'd like some feedback before I jump into something
different.
Any suggestion as to servo vs stepper, and/or any ideas on how to
step a stepper through my rotational requirements would be GREATLY
appreciated.
Thanks in advance!
Nathan
navigate an arbitrary hallway using a BS2p-24. I'm going to use an
ultrasonic sensor (Devantech SRF08) to be able to tell where the
robot is at in relationship to the hallway walls. I'd like to not
have any "touch" sensors, but use only one SRF08.
To get a complete picture of where the robot is at, I'd like to get
distance readings in the front, right and left of the robot. Thus,
I'd like to rotate the sensor to each position, take a distance
reading, make movement (drive) decisions, then rotate again. This
will be a continuous process.
My question: to rotate the sensor to these positions (left, front and
right) should I use a stepper or servo motor?
I currently have a stepper that I'm driving with a L293D H-bridge.
It has 15 degrees/step. I'm forseeing a problem with keeping track
of where the rotation is at, and the step sequence needed to rotate
in the desired direction. For example, when the bot gets turned on,
I'd need to run a "calibration" routine to determine where "forward"
is and what "step sequence" I'm on.
My obvious alternative is a servo motor. I've no experience with
them, so I'd like some feedback before I jump into something
different.
Any suggestion as to servo vs stepper, and/or any ideas on how to
step a stepper through my rotational requirements would be GREATLY
appreciated.
Thanks in advance!
Nathan
Comments
use a servo.
I have a servo on one of my projects that has to be in one position or the
other. I use the following code to turn the servo.
I'm no expert and this may not be the best way to write this code - it is
just a way that is working for me.
You see 500 and 750 is the same position on the servo everytime. I found my
servo (the hobby servo from parallax) swings about 180 degrees so you could
make three positions for left, forward and right.
' Servo is a pin#
' Times is a byte
' These sub routines are called from the main program.
up_position:
' debug "up"
for times = 0 to 100
PULSOUT Servo,(500) ' move the servo
pause 5
next
return
down_position:
' debug "down"
for times = 0 to 100
PULSOUT Servo,(750) ' move the servo
pause 5
next
return
Original Message
From: "n8than77" <n8than77@y...>
To: <basicstamps@yahoogroups.com>
Sent: Sunday, November 17, 2002 9:56 AM
Subject: [noparse][[/noparse]basicstamps] Servo vs. Stepper for Sensor Rotation
> Hello all! For a college robotics project, I'm designing a robot to
> navigate an arbitrary hallway using a BS2p-24. I'm going to use an
> ultrasonic sensor (Devantech SRF08) to be able to tell where the
> robot is at in relationship to the hallway walls. I'd like to not
> have any "touch" sensors, but use only one SRF08.
>
> To get a complete picture of where the robot is at, I'd like to get
> distance readings in the front, right and left of the robot. Thus,
> I'd like to rotate the sensor to each position, take a distance
> reading, make movement (drive) decisions, then rotate again. This
> will be a continuous process.
>
> My question: to rotate the sensor to these positions (left, front and
> right) should I use a stepper or servo motor?
>
> I currently have a stepper that I'm driving with a L293D H-bridge.
> It has 15 degrees/step. I'm forseeing a problem with keeping track
> of where the rotation is at, and the step sequence needed to rotate
> in the desired direction. For example, when the bot gets turned on,
> I'd need to run a "calibration" routine to determine where "forward"
> is and what "step sequence" I'm on.
>
> My obvious alternative is a servo motor. I've no experience with
> them, so I'd like some feedback before I jump into something
> different.
>
> Any suggestion as to servo vs stepper, and/or any ideas on how to
> step a stepper through my rotational requirements would be GREATLY
> appreciated.
>
> Thanks in advance!
>
> Nathan
>
>
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject and
Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
In the real world Servos are mucho better, steppers are just easier.
In our world, using the RC servos has a serious limitation, how do
you know when it is in position? There is no easy way to know that.
You give the command and hope it gets there sometime!
Steppers do have to be 'Homed' on power up but then they should never
loose position ( again in our world, in the real world encoders are
used to determine where the motor really is ) and they are where you
tell them to be.
if you have a stepper working I'd stick with that...Just home it upon
startup. You usually do that by putting a switch on the motor shaft
and running the motor until you see the switch trip the slowly
backing off of the switch untill it clears. Now you know exactly
where the motor is. Oh there is a prob if you can't just run the
motor around and around without twisting up the wires, then you have
to be a little smarter about it...
--- In basicstamps@y..., "n8than77" <n8than77@y...> wrote:
> Hello all! For a college robotics project, I'm designing a robot
to
> navigate an arbitrary hallway using a BS2p-24. I'm going to use an
> ultrasonic sensor (Devantech SRF08) to be able to tell where the
> robot is at in relationship to the hallway walls. I'd like to not
> have any "touch" sensors, but use only one SRF08.
>
> To get a complete picture of where the robot is at, I'd like to get
> distance readings in the front, right and left of the robot. Thus,
> I'd like to rotate the sensor to each position, take a distance
> reading, make movement (drive) decisions, then rotate again. This
> will be a continuous process.
>
> My question: to rotate the sensor to these positions (left, front
and
> right) should I use a stepper or servo motor?
>
> I currently have a stepper that I'm driving with a L293D H-bridge.
> It has 15 degrees/step. I'm forseeing a problem with keeping track
> of where the rotation is at, and the step sequence needed to rotate
> in the desired direction. For example, when the bot gets turned
on,
> I'd need to run a "calibration" routine to determine
where "forward"
> is and what "step sequence" I'm on.
>
> My obvious alternative is a servo motor. I've no experience with
> them, so I'd like some feedback before I jump into something
> different.
>
> Any suggestion as to servo vs stepper, and/or any ideas on how to
> step a stepper through my rotational requirements would be GREATLY
> appreciated.
>
> Thanks in advance!
>
> Nathan
mini servos will do about 110 degrees or so.
Having done exactly what you want to do with a SRF04 and a BS2-SX I can tell
you it does work -- unfotunately your professor and I have an agreement that
I will not share my code with his students.
*********
> If i had to position something at 2 or three fairly exact positions, I
would
> use a servo.
>
> I have a servo on one of my projects that has to be in one position or the
> other. I use the following code to turn the servo.
>
> I'm no expert and this may not be the best way to write this code - it is
> just a way that is working for me.
>
> You see 500 and 750 is the same position on the servo everytime. I found
my
> servo (the hobby servo from parallax) swings about 180 degrees so you
could
> make three positions for left, forward and right.
>
> ' Servo is a pin#
> ' Times is a byte
> ' These sub routines are called from the main program.
>
> up_position:
> ' debug "up"
> for times = 0 to 100
> PULSOUT Servo,(500) ' move the servo
> pause 5
> next
> return
>
> down_position:
> ' debug "down"
> for times = 0 to 100
> PULSOUT Servo,(750) ' move the servo
> pause 5
> next
> return
>
>
>
Original Message
> > Hello all! For a college robotics project, I'm designing a robot to
> > navigate an arbitrary hallway using a BS2p-24. I'm going to use an
> > ultrasonic sensor (Devantech SRF08) to be able to tell where the
> > robot is at in relationship to the hallway walls. I'd like to not
> > have any "touch" sensors, but use only one SRF08.
> >
> > To get a complete picture of where the robot is at, I'd like to get
> > distance readings in the front, right and left of the robot. Thus,
> > I'd like to rotate the sensor to each position, take a distance
> > reading, make movement (drive) decisions, then rotate again. This
> > will be a continuous process.
> >
> > My question: to rotate the sensor to these positions (left, front and
> > right) should I use a stepper or servo motor?
> >
> > I currently have a stepper that I'm driving with a L293D H-bridge.
> > It has 15 degrees/step. I'm forseeing a problem with keeping track
> > of where the rotation is at, and the step sequence needed to rotate
> > in the desired direction. For example, when the bot gets turned on,
> > I'd need to run a "calibration" routine to determine where "forward"
> > is and what "step sequence" I'm on.
> >
> > My obvious alternative is a servo motor. I've no experience with
> > them, so I'd like some feedback before I jump into something
> > different.
> >
> > Any suggestion as to servo vs stepper, and/or any ideas on how to
> > step a stepper through my rotational requirements would be GREATLY
> > appreciated.
powerup using a hall effect sensor below the shaft and a small magnet on
the shaft, both available at Digikey. I ran it for about 50 hours at a
trade show, with thousands of 2 msec steps, and it never lost a step.
The code is special purpose and proprietary, so I can't share it. Check
out the Parallax application notes for stepper driver code.
Dennis
Original Message
From: kvasilak [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=PGvC705Ywa4wUd0Xrkl2_hVUsB7Uvzqwwy1In7Pbq5c6Ex91RoyO43a_SuBhkC4vJQKh1dsB0ONUsuZSSLU]my427v8@h...[/url
Sent: Sunday, November 17, 2002 9:35 AM
To: basicstamps@yahoogroups.com
Subject: [noparse][[/noparse]basicstamps] Re: Servo vs. Stepper for Sensor Rotation
Sounds like a cool project.
In the real world Servos are mucho better, steppers are just easier. In
our world, using the RC servos has a serious limitation, how do
you know when it is in position? There is no easy way to know that.
You give the command and hope it gets there sometime!
Steppers do have to be 'Homed' on power up but then they should never
loose position ( again in our world, in the real world encoders are
used to determine where the motor really is ) and they are where you
tell them to be.
if you have a stepper working I'd stick with that...Just home it upon
startup. You usually do that by putting a switch on the motor shaft
and running the motor until you see the switch trip the slowly
backing off of the switch untill it clears. Now you know exactly
where the motor is. Oh there is a prob if you can't just run the
motor around and around without twisting up the wires, then you have
to be a little smarter about it...
--- In basicstamps@y..., "n8than77" <n8than77@y...> wrote:
> Hello all! For a college robotics project, I'm designing a robot
to
> navigate an arbitrary hallway using a BS2p-24. I'm going to use an
> ultrasonic sensor (Devantech SRF08) to be able to tell where the
> robot is at in relationship to the hallway walls. I'd like to not
> have any "touch" sensors, but use only one SRF08.
>
> To get a complete picture of where the robot is at, I'd like to get
> distance readings in the front, right and left of the robot. Thus,
> I'd like to rotate the sensor to each position, take a distance
> reading, make movement (drive) decisions, then rotate again. This
> will be a continuous process.
>
> My question: to rotate the sensor to these positions (left, front
and
> right) should I use a stepper or servo motor?
>
> I currently have a stepper that I'm driving with a L293D H-bridge.
> It has 15 degrees/step. I'm forseeing a problem with keeping track
> of where the rotation is at, and the step sequence needed to rotate
> in the desired direction. For example, when the bot gets turned
on,
> I'd need to run a "calibration" routine to determine
where "forward"
> is and what "step sequence" I'm on.
>
> My obvious alternative is a servo motor. I've no experience with
> them, so I'd like some feedback before I jump into something
> different.
>
> Any suggestion as to servo vs stepper, and/or any ideas on how to
> step a stepper through my rotational requirements would be GREATLY
> appreciated.
>
> Thanks in advance!
>
> Nathan
To UNSUBSCRIBE, just send mail to:
basicstamps-unsubscribe@yahoogroups.com
from the same email address that you subscribed. Text in the Subject
and Body of the message will be ignored.
Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
current limited so as not to burn up.
put your sensor on the bar/plate whatever and put in a stop to the
left and a stop to the right. Let it swing to the stop.
for the center posistion, you could use a switch. just a mouse photo
sensor if you want.
much simplier than a stepper and much easier to setup and program
than a servo with feedback.
A little more sophisticated would be using three photo sensors, one
for each stop you have. If you take a small cresent, and put a slit
in it, it will block each sensor until the slot is lined up with a
sensor.
Of course the problem is the routine when you miss a sensor. probably
go to one end or the other and slowly return. this probably could be
done with 2 sensors, and much more accurate with 4. The 4th being a
larger opening so that as you approaced any other sensor, a larger
opeing would signal the approach and you slow down until the exact
posistion is found.
I think I would use the stops and a pair of sensors in the middle.
Dave
--- In basicstamps@y..., "n8than77" <n8than77@y...> wrote:
> Hello all! For a college robotics project, I'm designing a robot
to
> navigate an arbitrary hallway using a BS2p-24. I'm going to use an
> ultrasonic sensor (Devantech SRF08) to be able to tell where the
> robot is at in relationship to the hallway walls. I'd like to not
> have any "touch" sensors, but use only one SRF08.
>
> To get a complete picture of where the robot is at, I'd like to get
> distance readings in the front, right and left of the robot. Thus,
> I'd like to rotate the sensor to each position, take a distance
> reading, make movement (drive) decisions, then rotate again. This
> will be a continuous process.
>
> My question: to rotate the sensor to these positions (left, front
and
> right) should I use a stepper or servo motor?
>
> I currently have a stepper that I'm driving with a L293D H-bridge.
> It has 15 degrees/step. I'm forseeing a problem with keeping track
> of where the rotation is at, and the step sequence needed to rotate
> in the desired direction. For example, when the bot gets turned
on,
> I'd need to run a "calibration" routine to determine
where "forward"
> is and what "step sequence" I'm on.
>
> My obvious alternative is a servo motor. I've no experience with
> them, so I'd like some feedback before I jump into something
> different.
>
> Any suggestion as to servo vs stepper, and/or any ideas on how to
> step a stepper through my rotational requirements would be GREATLY
> appreciated.
>
> Thanks in advance!
>
> Nathan
I have done this both ways with different sensors. I would use a stepper for
a couple of reasons:
1. I've found a few simple diodes keep a stepper electrically quieter than
can be done with hobby servos. Some sensors don't like the noise, likewise,
it can be worse with multiple motors.
2. Although steppers cost a bit more in general, they are a more elegant
solution. They are physically quieter and positioning is more absolute.
There are some other nice advantages, such as the current differences
between rotation and locked that can be capitalized on in complex systems.
Yes, you will need to home it - even a small cherry 'snap' switch will
probably do in your application.
3. If you were to use one of the allegro driver chips you could send it
where it needs to go with simple clock pulses, (ie: pulseout instruction)
and one extra pin for direction. If you want to do it the hard way, 4 power
mosfets are similar in cost but will require more of that precious processor
time and a couple more pins.
I also think this is one that can be done successfully either way. I suspect
your biggest difficulty will be dealing with various conditions that will be
presented to the sensor and deciding how to respond to them. I hope by now
you picked a motor type and have moved on to the hard work...
Chris
> My question: to rotate the sensor to these positions (left, front and
> right) should I use a stepper or servo motor?
>
> I currently have a stepper that I'm driving with a L293D H-bridge.
> It has 15 degrees/step. I'm forseeing a problem with keeping track
> of where the rotation is at, and the step sequence needed to rotate
> in the desired direction. For example, when the bot gets turned on,
> I'd need to run a "calibration" routine to determine where "forward"
> is and what "step sequence" I'm on.
>
> My obvious alternative is a servo motor. I've no experience with
> them, so I'd like some feedback before I jump into something
> different.
>
> Any suggestion as to servo vs stepper, and/or any ideas on how to
> step a stepper through my rotational requirements would be GREATLY
> appreciated.
>
> Thanks in advance!
>
> Nathan
>
>
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the
> Subject and Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
>
sensors instead. The position would be fixed, you can not get out of sync,
and you might even (with a little creative software) be able to decipher
positions in between the three positions.
Jim
Original Message
From: Chris Loiacono [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=l1BEHLZZ-4PXImux41nWOXHxYVNDGhygK858mfy47UuABkfvFxmIpvWvveHiJSkPIsEnd7jJz3X3pAbW]chris@m...[/urlOn Behalf Of Chris
Loiacono (E-mail)
Sent: Monday, November 18, 2002 10:52 AM
To: basicstamps@yahoogroups.com
Subject: RE: [noparse][[/noparse]basicstamps] Servo vs. Stepper for Sensor Rotation
Nathan:
I have done this both ways with different sensors. I would use a stepper for
a couple of reasons:
1. I've found a few simple diodes keep a stepper electrically quieter than
can be done with hobby servos. Some sensors don't like the noise, likewise,
it can be worse with multiple motors.
2. Although steppers cost a bit more in general, they are a more elegant
solution. They are physically quieter and positioning is more absolute.
There are some other nice advantages, such as the current differences
between rotation and locked that can be capitalized on in complex systems.
Yes, you will need to home it - even a small cherry 'snap' switch will
probably do in your application.
3. If you were to use one of the allegro driver chips you could send it
where it needs to go with simple clock pulses, (ie: pulseout instruction)
and one extra pin for direction. If you want to do it the hard way, 4 power
mosfets are similar in cost but will require more of that precious processor
time and a couple more pins.
I also think this is one that can be done successfully either way. I suspect
your biggest difficulty will be dealing with various conditions that will be
presented to the sensor and deciding how to respond to them. I hope by now
you picked a motor type and have moved on to the hard work...
Chris
> My question: to rotate the sensor to these positions (left, front and
> right) should I use a stepper or servo motor?
>
> I currently have a stepper that I'm driving with a L293D H-bridge.
> It has 15 degrees/step. I'm forseeing a problem with keeping track
> of where the rotation is at, and the step sequence needed to rotate
> in the desired direction. For example, when the bot gets turned on,
> I'd need to run a "calibration" routine to determine where "forward"
> is and what "step sequence" I'm on.
>
> My obvious alternative is a servo motor. I've no experience with
> them, so I'd like some feedback before I jump into something
> different.
>
> Any suggestion as to servo vs stepper, and/or any ideas on how to
> step a stepper through my rotational requirements would be GREATLY
> appreciated.
>
> Thanks in advance!
>
> Nathan
>
>
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the
> Subject and Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
>
To UNSUBSCRIBE, just send mail to:
basicstamps-unsubscribe@yahoogroups.com
from the same email address that you subscribed. Text in the Subject and
Body of the message will be ignored.
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
or why 2 eyes or ears are better than one.
Dennis
Original Message
From: Jim Forkin [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=iNzuMWtRdwT6BKrumVMH0R7AQDVJbhuXt7vcIUIg99Gl4M1OOjGE7ZcD6fmSBZn4RmrxgMAQyQ]jjf@p...[/url
Sent: Monday, November 18, 2002 10:38 AM
To: basicstamps@yahoogroups.com
Subject: RE: [noparse][[/noparse]basicstamps] Servo vs. Stepper for Sensor Rotation
Another solution: Don't use a motor to redirect the sensor; use three
sensors instead. The position would be fixed, you can not get out of
sync, and you might even (with a little creative software) be able to
decipher positions in between the three positions.
Jim