Shop OBEX P1 Docs P2 Docs Learn Events
Encoder questions for electric wheel chair motors — Parallax Forums

Encoder questions for electric wheel chair motors

xanaduxanadu Posts: 3,347
edited 2012-06-01 16:27 in Robotics
Erco, if you clicked this you owe me $50.

I'm looking to add some hollow shaft encoders to some chair motors with the brakes removed. The shaft is 5/16 dia. and 1 1/4" long.

shaft.jpg
<- If you enlarge this you can see dimensions.

I found some nice hollow shaft quadrature optical encoders online for $60 each. They're probably a good deal but I don't want to spend $120 on encoders. EDIT: They're actually a really good deal. If I were to buy something it wouldn't be a hollow shaft, it would be a standard shaft encoder, then couple it with the motor's shaft. Doing so would drop the cost significantly.

With all the mounting options inside the end cap, I should make an encoder for it. I would like to do quadrature style optical encoders. I have looked at a lot online. Before I buy or make anything I thought I'd ask here because I've never worked with any encoders before.

Thanks for any advice you may have.
1024 x 768 - 67K
«1

Comments

  • ercoerco Posts: 20,256
    edited 2012-05-22 13:45
    I'm assuming you meant electric wheelchair motors, not electric chair motors. Different demographic... :)

    My homemade wheel encoders worked quite well: http://forums.parallax.com/showthread.php?121179-Reading-Quadrature-Encoders&p=899765&viewfull=1#post899765

    If you want to make a motor shaft encoder, that should be easy. Personally, I don't agree with conventional wisdom that you need a million PPR out of an encoder. That's useless resolution given backlash and slop. My guess is that you could paint that motor shaft half white/half black and that's all you need. Mount 2 sensors physically at 90 degrees and you're done. Any cheap optosensor could work. My favorite Hamamatsu P5587 ( http://www.junun.org/MarkIII/Info.jsp?item=48 ) is long gone, but you could use http://www.goldmine-elec-products.com/prodinfo.asp?number=G18740 ($1) or make your own out of 3mm IR LEDs & PTXs.

    See also http://forums.parallax.com/showthread.php?109024-Scribbler-Wheel-Encoder-Project&highlight=scribbler+encoder
  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2012-05-22 14:05
    I wish the motors on my large robot project was setup with an exposed shaft like that. Fitting encoders shouldn't be too hard at all.

    If you want an in-expensive option you can use the encoders from an old Microsoft mouse (Non optical). You should be able to drill out the wheel and glue it to the motor shaft. If you check at used computer stores, garage sales, and swap meets you can get those old mice really cheap. At least two encoders in each mouse. Sometimes a third if it has a scroll wheel but if you want to use that you'd probably need to get another identical mouse so you'll have a matched pair of sensors.

    Robert
  • xanaduxanadu Posts: 3,347
    edited 2012-05-22 14:20
    erco wrote: »
    My guess is that you could paint that motor shaft half white/half black and that's all you need. Mount 2 sensors physically at 90 degrees and you're done. Any cheap optosensor could work. My favorite Hamamatsu P5587 ( http://www.junun.org/MarkIII/Info.jsp?item=48 ) is long gone, but you could use http://www.goldmine-elec-products.com/prodinfo.asp?number=G18740 ($1) or make your own out of 3mm IR LEDs & PTXs.

    Excellent solution. You're absolutely right I think I was over complicating it. One 1/2 turn of that shaft moves the robot about 1/2" so that is more than enough. I'm going to get some white PVC with inside diameter of the shaft and make it half black. At this price I can build in some redundancy.

    So those IR sensors work well with some LED illumination? I could put a diffused LED right next to each one. I think I'm going to make the IR pairs as well, but I couldn't resist ordering some of the ones you sent the link for.

    Thanks Erco!
  • xanaduxanadu Posts: 3,347
    edited 2012-05-22 14:22
    I wish the motors on my large robot project was setup with an exposed shaft like that. Fitting encoders shouldn't be too hard at all.

    If you want an in-expensive option you can use the encoders from an old Microsoft mouse (Non optical). You should be able to drill out the wheel and glue it to the motor shaft. If you check at used computer stores, garage sales, and swap meets you can get those old mice really cheap. At least two encoders in each mouse. Sometimes a third if it has a scroll wheel but if you want to use that you'd probably need to get another identical mouse so you'll have a matched pair of sensors.

    Robert

    Thanks, I was about to use something along those line and pull the encoders out of roomba tires.

    roombaenc.jpg


    After reading Erco's post I don't think I need the resolution I thought I needed thanks to the low rpm gearbox on this thing.

    I do have a lot to work with using these motors. I'm really glad I ended up with them, eBay with shipping for $150 including the tires and two sets of brushes. I pulled apart the gear box the there's no chance anything in there will ever go bad while I'm using it. Rock solid older Framco stuff.
    1024 x 768 - 112K
  • ercoerco Posts: 20,256
    edited 2012-05-22 15:17
    xanadu wrote: »
    One 1/2 turn of that shaft moves the robot about 1/2" so that is more than enough.

    Of course with a quad encoder's 2 sensors, you can measure rotation to 1/4 shaft turn (4 PPR) with a half black/half white shaft. You can always paint more stripes if you need more PPR.
  • ercoerco Posts: 20,256
    edited 2012-05-22 15:25
    You can use almost any optosensor, you might have to tweak the resistor values depending on what you're interfacing them to. Sparkfun has these breakout boards for $3: http://www.sparkfun.com/products/9453

    And you could also make a slotted disk and use any number of optointerrupters:
    http://www.goldmine-elec-products.com/products.asp?dept=1371
  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2012-05-22 18:00
    xanadu wrote: »
    Thanks, I was about to use something along those line and pull the encoders out of roomba tires.

    roombaenc.jpg


    After reading Erco's post I don't think I need the resolution I thought I needed thanks to the low rpm gearbox on this thing.

    I do have a lot to work with using these motors. I'm really glad I ended up with them, eBay with shipping for $150 including the tires and two sets of brushes. I pulled apart the gear box the there's no chance anything in there will ever go bad while I'm using it. Rock solid older Framco stuff.

    You may want to double check but I'm not sure if the Roomba uses a single channel encoder or a dual channel quadrature encoder. I prefer to use both channels for a full quadrature encoder.

    Don't write off the mouse encoders until you've given them a shot. Here are some links:

    http://hackaday.com/2008/05/16/how-to-scavenge-a-mouse-for-parts/

    http://www.ing.unife.it/docenti/MarcelloBonfe/tsc/mouseHack.htm
  • xanaduxanadu Posts: 3,347
    edited 2012-05-22 22:26
    Thanks RobotWorkshop. I have dissected many mechanical mice (how can you not) and I know what you mean. I keep a few mechanical mice around in case an EMP hits... JK I think I'd use a mouse encoder on something smaller. Not because I don't thin it's a good idea, but because I don't have the skills to mount it in a reliable manner.

    The Roomba's motor encoders only have two wires from the sensor so I guess that is single channel.

    I'm going to shove a piece of black PVC pipe over the shaft. I'm going to epoxy down lead tape lengthwise in half or quarters. I've noticed that metallic tape can bounce IR well in the dark compared to white paint and might not even need external light.
  • ercoerco Posts: 20,256
    edited 2012-05-23 09:09
    xanadu wrote: »
    I'm going to shove a piece of black PVC pipe over the shaft. I'm going to epoxy down lead tape lengthwise in half or quarters. I've noticed that metallic tape can bounce IR well in the dark compared to white paint and might not even need external light.

    You may still need to paint the black PVC with flat black paint. IR penetrates and reflects off of various materials drastically different than visible light. I'm 99% sure you'll need to use an LED to illuminate the spot consistently. Typical optosensors provide an IR LED and IR phototransistor (PTX) in close proximity. You'll muck about with (rather, you'll empiricallly determine and experimentally ascertain) the series resistor values for the LED and PTX to yield the right high/low voltage divider values for your particular uC.

    Too bad the Hamamatsu P5587 is discontinued. It was much more than a sensor. It was tiny and had lots of internal circuitry for filtering and Schmitt triggering.
  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2012-05-23 11:24
    erco wrote: »
    Too bad the Hamamatsu P5587 is discontinued. It was much more than a sensor. It was tiny and had lots of internal circuitry for filtering and Schmitt triggering.

    That was a good part. Luckily it is pretty easy to add the triggering by using a 74HC14. Using a pair of those inverters cleans up the signal and works well. I've use them on the last couple robots that I needed to make custom encoders with good results.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-05-23 12:58
    erco wrote: »
    You can use almost any optosensor, you might have to tweak the resistor values depending on what you're interfacing them to. Sparkfun has these breakout boards for $3: http://www.sparkfun.com/products/9453

    I used some of those SparkFun boards on a Roboni-I robot erco made me buy.

    erco's correct about IR just passing through some plasitics. I taped Al foil to a plasitic gear and hard drew encoder lines on top of the tape. The plasitic gear by itself wouldn't reflect the IR, it just passed right on through.

    I disagree with erco about the need for a million ppr on encoders. Give a million any day. When I added encoders to my Mecanum wheeled robot, the lack of a high ppr encoder made the speed much harder to adjust. You might not need a lot of pulses to know how far you've gone, but lots of pulses sure help with speed control.
  • ercoerco Posts: 20,256
    edited 2012-05-23 13:36
    Duane Degn wrote: »
    I disagree with erco about the need for a million ppr on encoders. Give a million any day. When I added encoders to my Mecanum wheeled robot, the lack of a high ppr encoder made the speed much harder to adjust. You might not need a lot of pulses to know how far you've gone, but lots of pulses sure help with speed control.

    Duane: We can agree to disagree. We can decide not to decide. Can't we all just get along?

    Resolution required certainly varies by robot and the application. I agree your nifty mecanum bot is the rare case where exact RPM matching is exceptionally critical. But in the more common case of a 2-motor differential drive robot, low res is fine for a motor shaft encoder in most instances. The S2 has incredible resolution based on its motor encoders, but not every robot needs that. Jon has a big beautiful motor shaft staring at him and an opportunity to simplify. I maintain that simply painting it half white/half black yields 2 PPR at the motor shaft, times whatever the gear ratio is (unknown, but likely 30 or more) yields 60 or more PPR at the wheels. That's plenty for measuring distance & turns and keeping the wheels in sync to drive straight from my experiments: http://www.youtube.com/watch?v=Trv682XZ_8c

    Heck, 4 PPR is plenty good in some apps! http://www.youtube.com/watch?v=9l32qYXJfTg

    Again, if there is significant backlash in the geartrain (or sideways wheel wobble in the case of the S2), you can't use incredible motor resolution anyway. IMHO, wheel encoders are better for odometry, which is where my interests lay.

    @Jon: Please take a minute and describe your robot's drive system (wheels, motors & gear ratio), controller and its intended use. Why do you want encoders?
  • xanaduxanadu Posts: 3,347
    edited 2012-05-23 16:20
    Oops, what Duane said is something that I hadn't thought about yet. The gear ratio between this shaft I'm working with and the tire is pretty high though. I posted a video below to show you.

    My MCU has two closed loop modes, one is speed, the other is position and you can even program in modifiers. Not sure if that helps because I still have not RT%M'd it http://www.robotshop.com/content/PDF/user-manual-mdc2250.pdf

    Erco, my MCU is a Roboteq MDC2250. I completely agree about the shaft on these motors and I'm really glad they put brakes on them that can be easily removed. I don't think I could put them anywhere else on it.

    mbpic.jpg


    [video=youtube_share;j_XR071igw4]
    1024 x 768 - 146K
  • xanaduxanadu Posts: 3,347
    edited 2012-05-23 16:32
    Erco, my main reason for wanting encoders is the figure eight challenge!! I also need them because the caster wheel steers it around a bit at low speeds one motor may stall while the other keeps going which creates another adverse turning tenancy.

    To get the gear ratio is that the number of time the shaft vs tire turns? I think that's going to be about

    28:1
  • ercoerco Posts: 20,256
    edited 2012-05-23 16:43
    Fig 8 challenge? Woo Hoo, welcome aboard! That's actually a pretty low gear ratio, I previously guessed 30 at a minimum and I think that's about right after seeing your video. Worm gears, I'm guessing. My encoder experience has been using position (pulse counting). Obviously, to go straight, you vary wheel speeds on the fly to keep the pulse counts exactly equal. You can turn in place by reversing direction, still keeping the pulse counts equal. Or to carve a circular turn for the Figure 8 challenge, you can make one wheel accrue wheel counts exactly 2 or more times faster than the other. Here's my Retrobot doing a precise 2:1 circle.

    http://www.youtube.com/watch?v=mMru-ZA3yvQ

    Here's a control system description. http://www.youtube.com/watch?v=VzbKlwc4GWs

    Maybe I'll have to dust off Retrobot and git her around the Figure 8 challenge!
  • jdoleckijdolecki Posts: 726
    edited 2012-05-23 16:56
    This is how I did it

    You might not have the space but its an idea

    I mounted to the axle shaft I took of the seal cap an mounted the magnet in there

    go to this post for more pictures

    http://forums.parallax.com/showthread.php?138991-Telepresence-Robot-motor-mounts&p=1090879#post1090879

    mag mount.jpg
    1024 x 765 - 81K
  • xanaduxanadu Posts: 3,347
    edited 2012-05-23 17:18
    Thanks, in your control system video is exactly what I'm after. Nice build too, I can't believe I haven't found your yt channel before.

    The motors are 24v and running on 12v. At low speeds if one tire runs over something small, like an extension cord it steers it off course. Since the diameter of the extension cord is so small, I think I will need good encoder resolution. Either way I'm going start with what we talked about doing before and then work from there. I don't mind having to change plans at all, if I need to increase the PPR.

    I just rechecked the gear ratio is slightly closer to 29:1. So that means that the encoder will have 58 PPR.

    Here's screen shot of the MC GUI. I love this thing but it's worthless in open loop mode...

    Capture.PNG


    I'm going to get the PVC and start messing around on Thursday. One thing I've been thinking about is not having to sink power to LEDs down there. Should I consider hall effect sensors and a couple magnets? I can drill a hole in the PVC and glue them in the holes then put the PVC over the shaft with a set screw to hold it tight. Also if I use two hall sensors side-by-side would that give me quadrature or will the sensors be too close together for them to know which one is changing first?

    Thank you all very much for the help on this project.
    821 x 559 - 86K
  • xanaduxanadu Posts: 3,347
    edited 2012-05-23 17:23
    jdolecki, nice robot, except the P4 lol jk jk!

    It's funny I think i was typing the question as you were typing the answer. Do you see a benefit over using magnets combined will hall effect sensors over light?
  • jdoleckijdolecki Posts: 726
    edited 2012-05-23 17:39
    Yea cost. Industrial encoders are a couple of hundred dollars.

    Mine I built for under 25 10 bit but you can get 12 bit chips also, the magnet is the most expensive.
  • ercoerco Posts: 20,256
    edited 2012-05-23 18:56
  • ercoerco Posts: 20,256
    edited 2012-05-23 21:11
    A timely discussion. Those $1 optosensors just went on sale for 79 cents. Stock up!

    http://www.goldmine-elec-products.com/prodinfo.asp?number=G18740
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-05-23 21:33
    jdolecki, That's the AS5040 sensor you mentioned in my encoder thread isn't it?

    I couldn't find a place that sells the boards. Do you remember how much it cost?

    How are you reading it (which uC)?

    My first AS5055 PCBs are due to arrive any day in the mail (hopefully tomorrow).
  • ercoerco Posts: 20,256
    edited 2012-05-23 21:54
    @Jon: If your motors are stalling on 12V, your gear ratio is likely too low. Have you tried PWM at higher voltage? You can get a lot more torque that way, still keeping RPM low.

    My bot also uses 24V motors at lower voltage (18/12V), but they have more gear reduction and spur gears, which is advantageous. If yours are worm gears, they tend to self-lock, which may come in handy for dynamic braking.
  • xanaduxanadu Posts: 3,347
    edited 2012-05-24 17:47
    erco wrote: »
    @Jon: If your motors are stalling on 12V, your gear ratio is likely too low. Have you tried PWM at higher voltage? You can get a lot more torque that way, still keeping RPM low.

    My bot also uses 24V motors at lower voltage (18/12V), but they have more gear reduction and spur gears, which is advantageous. If yours are worm gears, they tend to self-lock, which may come in handy for dynamic braking.

    It's a tad weak at 12v at the lowest PWM that makes it move but it's also very slow and gentle. Which is nice until I get some sensors on it to stop it from doing damage. So far it has done damage inside my office so weak is good. Once I get the encoders on I'll be sure to have the sensors running by then.

    You're right about the worm gears, and the wheels do not need brakes at all. I got some stuff to work on the encoders I hope to spend some time with it this evening. I have so many people asking to remote into the robot and drive it around now because of facebook lol. I can't wait to make it easier to drive.

    Thanks again!
  • vanmunchvanmunch Posts: 568
    edited 2012-05-31 11:28
    If you're still wanting to play with a higher res encoder that works great for only ~$50, I'd recomend US Digital's E2. They work great with the duel encoder object
  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2012-05-31 12:23
    You can also often find nice encoders on ebay for a good discount. These look like they would be good for some projects as well:

    http://www.ebay.com/itm/260869973332

    I picked up a set and they seem to work well.
  • xanaduxanadu Posts: 3,347
    edited 2012-05-31 22:30
    You can also often find nice encoders on ebay for a good discount. These look like they would be good for some projects as well:

    http://www.ebay.com/itm/260869973332

    I picked up a set and they seem to work well.

    At that price they're hard to pass up. Can you tell me the pin-outs? That would probably answer all of the other questions I have. Thanks!!
  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2012-06-01 05:44
    I ended up buying several of these and ended up taking one apart to check it out and verify the connections. Starting from the black wire:

    Ground
    B
    A
    +5V

    Robert
  • ercoerco Posts: 20,256
    edited 2012-06-01 06:13
    Nice find, Robert! How many PPR?
  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2012-06-01 09:12
    erco wrote: »
    Nice find, Robert! How many PPR?

    Hello Erco,

    I've picked up a couple different styles but most seem to be 96Q128-40-00 which output 128 PPR.

    Robert
Sign In or Register to comment.