Connect with us

Comparison Function

Discussion in 'Electronic Basics' started by John Popelish, Apr 6, 2007.

Scroll to continue with content
  1. This sounds like a good application for a controller
    function, not a comparator function. A controller tries to
    force an error function toward zero, with tuning that allows
    for the time delays and gains in the rest if the system.

    The simplest controller is simply an output proportional to
    the difference between a setpoint value and a feedback
    value. In this the setpoint value might be the distance
    output from one range finder, and the feedback value might
    be the output from the other range finder. Or you could
    take the ratio of the two range finder values as the
    feedback value, and use a fixed value of 1 as the setpoint
    value. You adjust the gain that multiplies the error
    between setpoint and feedback values so that a useful
    correction is made without overshooting.
     
  2. Sam

    Sam Guest

    Hey everyone,

    I'm really pretty stupid when it comes to electronics, so forgive me
    if I embarrass myself here, but I really need help with this issue.
    Some friends and I are making a robot for a competition where part of
    the challenge is navigating through a mock house. A crucial function
    of the robot is being able to align itself so its sides are parrallel
    with the walls of the house...i.e. so it sets itself going straight
    down the hallway.

    The way we're doing this is looking at the outputs of 2 analog
    rangefinding sensors on the same side of the robot (1 towards the
    front, one towards the back). When the outputs are roughly the same
    we know we're roughly parrallel with the wall.

    Since our programmer is mad strapped for time and working in an
    unfamiliar language, I thought I'd try doing the comparison
    electrically instead of making him code it (that also means I don't
    have to wire up ADCs).

    Right now I have the output of each rangefinder hooked up to an LM341
    configured as a Schmitt Trigger with adjustable hysteresis. It works
    when I test it with a multimeter - I get a +3.3v output when both
    sensors read approximately the same distance (+/- accuracy depending
    on the pot setting).

    The thing is, when we try to have the robot align itself it totally
    misses the signal...like it's never worked, not even once. Sometimes,
    when we actually pick the bot up instead of letting it drive itself
    the motors will stop, but only when the hysteresis is so high that it
    ends up being worse off than when it started.

    I really don't why the hell this happens, although I wonder if it has
    anything to do with the fact that the output from the rangefinders
    isn't linear. Or the fact that I know nothing about electronics.

    Any help would be much, much appreciated (like you wouldn't believe
    how insanely appreciated it would be)!

    Thanks so much!,
    Sam
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-