I'd like to have a switch activated when something gets near it. Today it's just a pushbutton, that's active as long as it's depressed.
I'm going to use an analog ultrasonic ranger, using its analog output. What I'd like to do is have an analog circuit activate a mosfet when a certain range threshold is hit. My question is - how do I make this "binary?" How do I have Vgs applied to the mosfet when the analog voltage on the ranger crosses a specific value? I thought about using a zener diode with the breakdown voltage at the distance that I need (the threshold I'm looking for is about 10" away from the device, which translates to ~100mV on the analog pin). Given the low voltage the sensor will output at that distance, I assume a zener won't work.
I'd like to not involve an MCU if possible, because I'd like this to be a simple drop-in.
Answer
A simple comparator circuit will do:
simulate this circuit – Schematic created using CircuitLab
U1 can be a slow, rail-to-rail CMOS part that costs under $1 - either a general purpose op-amp, or a dedicated comparator. Ensure that there's no diode between (+) and (-) inputs. Microchip has plenty of them, for example.
Since we assume push-pull outputs like on every op-amp, there's no need for any pull-up/pull-down resistors on the output of U1. If you use an op-amp, that'll be the case. With comparators - it varies.
The ratio of R3 to R4 sets the amount of hysteresis - here it's at 1%. The turn-on voltage is set by the ratio of R1 to R2, and given by VCC * R1/(R1+R2) * (1 - R3/R4)
. R5 isolates the gate capacitance from the amplifier's output, preventing the amplifier from oscillating.
No comments:
Post a Comment