Comparison Function

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.

Reply to
John Popelish
Loading thread data ...

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

Reply to
Sam

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.