Shop OBEX P1 Docs P2 Docs Learn Events
Alternative to Wheel Encoder? — Parallax Forums

Alternative to Wheel Encoder?

lardomlardom Posts: 1,659
edited 2014-07-10 21:58 in General Discussion
I'm road-testing my IR controlled, 3-wheeled robot and I want to sync the wheels. The differentially steered DC motor robot curves toward the right when I pass matching values to the wheels. Two options I can think of are to install encoders or pass an offset value to one of the motors. I want to know if it is possible to sense current from a flyback diode even though I'm using a motor-driver IC.
I'd place a whisker on the wheels if necessary to detect RPM's. I only want the robot to track straight. It's not autonomous and I don't need precision so a simple solution would be great.
«1

Comments

  • Mark_TMark_T Posts: 1,981
    edited 2014-07-02 14:17
    Sensing current is not good enough, mechanical friction is a large factor in
    small motors and balancing current / torque isn't going to cure that.

    Also freewheel diode current sensing doesn't work for motors - DC motors
    can be pretty resistive in nature (as well as inductive) and its the resistive
    current that's most correlated with the load.

    Sensing current ripple, however, might be useful as that would follow the armature
    segments passing the field gap in the motor - however this isn't simple as noise
    and unwanted signals would abound.

    If you can use a hall sensor / magnet before the gearing then you'll get reasonable
    resolution and a single pulse per motor revolution would be handy.
  • lardomlardom Posts: 1,659
    edited 2014-07-02 14:41
    Thanks Mark_T for ruling out current sensing. I'm going to tinker with the values sent to the wheels first. If I'm not happy with the result I'll then learn to use the encoder disks that are stored in one of my bins!
  • jim N8RHQjim N8RHQ Posts: 85
    edited 2014-07-02 16:33
    I've used a magnet on the wheel and a reed switch to sense wheel rotation that worked pretty well.
  • jmgjmg Posts: 15,148
    edited 2014-07-02 18:50
    lardom wrote: »
    .... then learn to use the encoder disks that are stored in one of my bins!

    Encoders can still not sense wheel slip. If you just want straight, a 3rd wheel angle sense could help ?

    I did a quick search, and find Amazon have Logitech PS/2 Optical Wheel Mouse @ 8.70
    - seems cheap enough to consider for indoor surface tracking ?
  • WhitWhit Posts: 4,191
    edited 2014-07-02 19:01
    Here is a video of a idea I played with a while back - The inspiration was how we used to clip playing cards on our bicycle fork so they could click in the spokes. I used the vibra-tab
  • Alex.StanfieldAlex.Stanfield Posts: 198
    edited 2014-07-02 19:22
    lardom wrote: »
    ... then learn to use the encoder disks that are stored in one of my bins!
    If your encoder discs are metallic (or you have something metallic turning with the wheels) you could use an MLX90217 cam sensor (requires a magnet attached to the chip) works great.

    Alex
  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2014-07-03 08:34
    Whit, You're a genius! I really like this idea.
  • WhitWhit Posts: 4,191
    edited 2014-07-03 10:57
    Thanks Gordon - that means so much coing from you! Robot Builder's Bonanza was one of the books that got me going! I have two print copies and one for Kindle - I re-read it regularly for new ideas.
  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2014-07-03 12:21
    Expect to see this idea stolen borrowed for the next edition. I shall call it the Whitcoder.

    Seriously, since the first editions I've tried to find good uses for PVDF film, and this sounds like a great one. I would think the "snap" is enough mechanically to produce a nice pulse. The integrating electronics (resistor, diode if you use one, etc.) are simple, and cost virtually nothing.
  • kwinnkwinn Posts: 8,697
    edited 2014-07-03 13:23
    How about a compass chip? It could compensate for wheel slip as well as drive train differences.
  • prof_brainoprof_braino Posts: 4,313
    edited 2014-07-03 19:07
    I heard that with steppers we count steps, and with PWM brushless motor we can count pulses. Can you use the same motors with a PWM scheme somehow?
  • WhitWhit Posts: 4,191
    edited 2014-07-03 19:32
    Expect to see this idea stolen borrowed for the next edition. I shall call it the Whitcoder.

    Seriously, since the first editions I've tried to find good uses for PVDF film, and this sounds like a great one. I would think the "snap" is enough mechanically to produce a nice pulse. The integrating electronics (resistor, diode if you use one, etc.) are simple, and cost virtually nothing.

    @Gordon - I would be honored!
    @Larry - would this help you at all?
  • ercoerco Posts: 20,254
    edited 2014-07-04 06:33
    Still waiting for Ttailspin to chime in about rudder steering, which makes a lot of sense.
  • lardomlardom Posts: 1,659
    edited 2014-07-04 10:04
    I missed notifications! My solution to the tracking problem was to add an offset value to the slower motor. It helped. I have to document the code, include a schematic and then zip it.
    Steppers are easy to program. DC motors are tougher and brushless even tougher. I can think of a lot of uses for differential steering and I thought it was time for me to learn to control DC motors.
    I thought about using a compass module but the documentation said it had to be level to stay accurate. That meant I needed an accelerometer. Angle sensing is a great idea.
    The object uses 4 cogs and 5 counters. Now I'm wondering what it would take to include a camera and an arm!
    1024 x 768 - 89K
    1024 x 768 - 75K
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2014-07-04 11:12
    I heard that with steppers we count steps, and with PWM brushless motor we can count pulses. Can you use the same motors with a PWM scheme somehow?

    It's the same problem.
    Given two motors, same model and so on, their RPMs won't necessarily track equally given the same DC voltage or the same PWM.
    One will have to be part of a PID loop.
  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2014-07-04 15:49
    All this talk about encoders to keep the robot going straight, they actually have an equally important use, measuring distance. Without encoders it's anyone's wild guess to know where in a room you are. Instead of moving for timed periods, or until you hit something, you can instead measure where you really ought to be. With some math -- not my forte, but it's there -- you can target a spot in a room and move to that location, with a reasonable assumption if a sensor didn't detect a bump, that you're really there.

    Compasses, as well as beacons and other devices, are nice to correct for the natural unbounded error common in all wheel encoder systems. But encoders are the cheapest and easiest way to measure distance of travel, and therefore, approximate location within a space.
  • WhitWhit Posts: 4,191
    edited 2014-07-04 17:05
    Per Gordon's odometry comment, he covers this in Chapter 45 of Robot Builder's Bonanza (4th Edition) - a book you should have in your library! You can find this on Amazon. His book covers everything Robotic...

    The most detailed thing I've ever read on this subject of odometry for ordinary folk with some parts way above my head... (available for free) is this Parallax Document on the BoeBot Encoders by Phil Pilgrim. Lots of good info...http://www.parallax.com/sites/default/files/downloads/28107-ApplyingEncoders-v1.0.pdf


  • ercoerco Posts: 20,254
    edited 2014-07-04 18:01
    @Larry: Are you using CR servos or DC gearmotors? Sounds like servos from your description so far.


    I find it molto interessante that differential drive is the most popular robot configuration. Some advantages, some disadvantages. I've built them, as well as tricycle drive bots (one steered front drive wheel, two trailing free wheels) and I like both equally, depending on the application. The Heathkit HERO & Hero Jr robots used a rather poor incarnation of tricycle drive which never centered consistently, which was maddening. Properly done, it works well and you can get away with a single wheel encoder on tricycle drive (for distance), although you might opt to have a second encoder to read your steering angle.

    You need encoders on both wheels of a diff drive bot just to go straight, and read them constantly while running a motor speed feedback loop anytime you are moving. The S2 makes it look easy. :)

    Horses for courses.

    Edit: A few interesting bots which deviate from my descriptions above:

    Arobot, a 3-wheel bot with a single rear drive wheel (one encoder) and traditional Ackerman steering on the front two wheels. BS2-powered. I bought a used one off Craigslist. There is so much slop in the steering system that I never did much with it. http://www.arrickrobotics.com/arobot/

    Big Trak, a 1980-era MB programmable robot toy tank with diff drive and a magnetic clutch which kept both wheels sync'ed to drive straight. Very cool & unique mechanism, worth having one in your collection to study. http://www.theoldrobots.com/smallbot6.html
    http://en.wikipedia.org/wiki/Big_Trak

    The motor module with clutches was commonly available at surplus outlets for many years after BT production stopped. Pity I wasn't a hoarder back then.
  • lardomlardom Posts: 1,659
    edited 2014-07-04 22:39
    :smile: I'm going to read my copy of Robot Builder's Bonanza 4th edition and get started on encoders.
    erco, I'm using DC gear motors. What's a CR servo?
  • ercoerco Posts: 20,254
    edited 2014-07-05 02:17
    Pardon, that's a continuous rotation servo, as found on the BoeBot.
  • lardomlardom Posts: 1,659
    edited 2014-07-05 06:25
    Whit, Correction: I have the '3rd edition' of RBB, Sufficiently dog-eared.
  • WhitWhit Posts: 4,191
    edited 2014-07-05 06:35
    lardom wrote: »
    Whit, Correction: I have the '3rd edition' of RBB, Sufficiently dog-eared.

    Just as it should be! Your bot is looking great! Keep posting and asking good questions.
  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2014-07-05 08:36
    Chapter 54? That must be the Special Author's Edition that ran 8 hours in the theaters...

    To be clear for the lurkers, RBB actually has only limited detail on encoders, due to the broad nature of the book. There's little source code, for example, and no math or PID examples. While it can get you started with the concepts, I'd recommend Parallax's white paper for further study. The new Parallax encoders are easily adaptable to the BOE Bot chassis or most other small robot, and Andy presents some nice code to go along with them, suitable for any robot based on a Prop.
  • WhitWhit Posts: 4,191
    edited 2014-07-05 15:49
    Oops Gordon - That should be 45! I fixed the original post too.
  • lardomlardom Posts: 1,659
    edited 2014-07-06 09:31
    Learning PID is no piece of cake. I picked up some IR components from RadioShack to experiment with yesterday but at the moment I'm reading and scribbling thoughts on paper. I realize now I have to understand PID. I'm also thinking past getting the bot to track straight (and do 90° turns) to adding a pan/tilt camera and a crane. I know that means at least a 2nd Propeller.
  • PublisonPublison Posts: 12,366
    edited 2014-07-06 09:52
    lardom wrote: »
    Learning PID is no piece of cake. I picked up some IR components from RadioShack to experiment with yesterday but at the moment I'm reading and scribbling thoughts on paper. I realize now I have to understand PID. I'm also thinking past getting the bot to track straight (and do 90° turns) to adding a pan/tilt camera and a crane. I know that means at least a 2nd Propeller.

    Andy did a good writeup here:

    http://forums.parallax.com/showthread.php/77656-PID-Control-Intro-with-the-BASIC-Stamp

    It's for the Stamp, but basics are there.
  • WhitWhit Posts: 4,191
    edited 2014-07-06 16:00
    @Publison - How have I never seen that? Thanks so much! That is why this Forum is invaluable.
  • lardomlardom Posts: 1,659
    edited 2014-07-07 08:05
    @Publison, Andy does a great job explaining PID. Thanks for the link.
  • PublisonPublison Posts: 12,366
    edited 2014-07-07 08:46
  • ercoerco Posts: 20,254
    edited 2014-07-07 08:55
    Build a Segway style balance bot for a quick education in PID!
Sign In or Register to comment.