Shop OBEX P1 Docs P2 Docs Learn Events
stepper motor vs optical encoder! Need advice for my school project. — Parallax Forums

stepper motor vs optical encoder! Need advice for my school project.

Tony_tsiTony_tsi Posts: 98
edited 2012-03-22 22:55 in Propeller 1
I am working on a project for the college that I attend. I am building a robot that will perform certain tasks in a 4' x 8' area. I need an accurate way to to track the amount of revolutions that the wheels turn on the robot in order to more easily track the robots location. I will be using a propeller for the brain and have an option of 5 V 12 V or 24 V for the drive motors. While motor size is not a large issue is preferred that the motor be the size of a Coke can or smaller. I have a good amount of experience with stepper motors and a small amount of experience with optical encoders. I basically have two options for the drivetrain of the robot.

option #1 Stepper motors
The good part about using a stepper motor is I can count the steps and know exactly how many revolutions the wheel has turned. The bad part about stepper motors is that they're usually very large require a lot of power and a fair amount of circuitry to operate them properly.

option #2 optical encoder
The good part about using optical encoder is it would allow for a wide variety of motors. I think used correctly optical encoders can be as accurate as stepper motors. The bad part about optical encoders is that I don't have much experience with them and I was told by a friend that an optical encoder would be very hard to keep track of using a propeller.


If you any ideas or suggestions please help me out. Thank you!

Comments

  • jmgjmg Posts: 15,183
    edited 2012-03-22 00:32
    Tony_tsi wrote: »
    I am working on a project for the college that I attend. I am building a robot that will perform certain tasks in a 4' x 8' area. I need an accurate way to to track the amount of revolutions that the wheels turn on the robot in order to more easily track the robots location

    You do realize, that these two are not guaranteed to follow ? - wheel slip is very common, and needs to be allowed for.
    Tony_tsi wrote: »
    The bad part about optical encoders is that I don't have much experience with them and I was told by a friend that an optical encoder would be very hard to keep track of using a propeller.

    Quadrature counting is not hard on the prop. It is only if you want to push well into the MHz that you need care.
    Just pop into the OBEX, and search for Quadrature.
  • W9GFOW9GFO Posts: 4,010
    edited 2012-03-22 00:36
    Your friend is not correct. Keeping track of an encoder (many encoders) is the type of thing that the Propeller chip excels at. The Propeller Chip will very easily keep track of multiple optical encoders.

    There are a few objects in the OBEX for using optical encoders. Combine that with a PWM object to control the motor and some math and you are set. There is at least one object that combines all three of those. Different motor drivers are controlled in different ways. Some, like Parallax's HB-25, use a servo pulse signal to control. Others use two pwm inputs, or one pwm input and two on/offs to set direction and braking, or serial or...?

    Controlling a stepper really does not require more circuitry, It does require an additional H bridge but it also doesn't need the encoder stuff. There are plenty of stepper drivers out there that will work as easily as a regular motor driver - and there are objects in the OBEX for running steppers too. As far as knowing exactly how far the wheel has turned with a stepper... well, as long as no steps are missed that will work. You don't really count the steps, you create the steps and tell the motor to move. There is no feedback letting you know if it did what you told it to (open loop). This is where having a quadrature encoder is helpful. An encoder does tell you if it has moved, it closes the loop. You can of course put an encoder on a stepper.
  • photomankcphotomankc Posts: 943
    edited 2012-03-22 11:00
    Thrust to weight is a bit of an issue with steppers as is the current draw. A drive that can be disabled when idle will save a lot of gas. They are not terribly powerful motors and especially not when attached to wheels that are several inches in diameter and they get weaker the faster they go. I have a bot I'm building around small NEMA17 steppers but I have geared them down with belts at 4:1 so I sacrifice speed to get a bit more torque for my 3.5" wheels. For my bot, a speed of 1 foot/sec is a good clip and at 1.75 feet/sec it's really easy to stall because the steppers are spinning at higher RPM because of the gearing. It actually works well but the belts add even more error to the ideal distance traveled and they add a bit of hook to one side as well. What I need are timing belts instead of V-Belts. That would help a good bit. They work better than I expected. My bot is all aluminum and weighs in at 6lbs and they show no sign that they will not be able to move under that load any time soon. Just about half that weight is the steppers themselves though.

    The surface you run on will greatly impact the open-loop performance, especially on diff-drive spins and turns. Also, ramping the start-up and slow down phases of movement will greatly improve the ability to carry a load without stalling. Just doing simple slamming them on and off driving places big limits on the maximum RPM and load you can carry.
  • localrogerlocalroger Posts: 3,452
    edited 2012-03-22 16:17
    Backing up what jmg said, Props can read quadrature encoders quite well. I recently did a little project (which didn't work out for other reasons) using the cheap VEX Robotics encoder and I was amazed at how easy it was to use. Since I was using it on the drive for a 3/8-24 worm screw I was able to track positional changes to 1/8000 inch, which is useful (even if you learn something you didn't expect) when you are trying to cut rocks.
  • 4x5n4x5n Posts: 745
    edited 2012-03-22 16:35
    Don't want to stir the pot any but a stepper needs position sensors to ensure proper positioning. It can be as simple as an index "mark" or a quadrature encoder. When you power up the electronics there's no way to know "where" the stepper is and just because you send it a step doesn't mean that it actually moves that step.
  • W9GFOW9GFO Posts: 4,010
    edited 2012-03-22 22:55
    4x5n wrote: »
    Don't want to stir the pot any but a stepper needs position sensors to ensure proper positioning. It can be as simple as an index "mark" or a quadrature encoder. When you power up the electronics there's no way to know "where" the stepper is and just because you send it a step doesn't mean that it actually moves that step.

    In the case of a mobile robot, not really. You will "know" that the wheel is stationary when powered up but you will not know where the wheel (robot) is relative to it's surroundings. A position sensor will not help much here.

    In the case of a CNC type machine you will need* a position sensor in the form of a limit switch, although even a quadrature encoder equipped machine needs the same thing. Only a machine with absolute position encoders would not require it.

    It should not move unintentionally when power is applied. Unless the mechanics are poorly designed, the stepper will move as it is commanded. You only need an encoder on a stepper if the stepper motor misses steps, but if it missing steps then the motor is not matched to the system or it is being driven improperly.

    * Some CNC machines are powered on in a known position, no position sensor of any kind is required.
Sign In or Register to comment.