I want to implement a alert system using a comparator circuit. The circuit will alert the user when he is a certain distance away from an object of interest. The comparator circuit will comprise of an op-amp powered with only a +5V voltage supply. There will be a Infra-Red sensor to sense the distance. The idea is to turn on a vibration motor only when the user is 2 cm or closer to an object. The output voltage of the IR sensor is proportional to the distance of the object it is sensing. This output can, thus, simply be compared against a voltage of interest to produce an output voltage.



simulate this circuit – Schematic created using CircuitLab


As shown in the circuit above, a 5 V voltage supply will be used to power the IR sensor, vibration motor, and the operational amplifier. The voltage output of the IR sensor is proportional to the distance to the object it is sensing, and varies from 2.65 V to 0.4 V as the distance changes from 2 cm to 28 cm. This voltage is fed to the non-inverting output of the op-amp. The inverting output is connected to one terminal of the potentiometer. The knob of the potentiometer can be adjusted such that the input to the inverting input varies from 2.65 V to 0.4 V. If, suppose, the input to the inverting input is held at 2.65 V, then the output from the op-amp is 5 V (the positive voltage rail) only for distances the IR sensor detects to be less than 2 cm. If the distance is more than 2 cm, the input voltage at the non-inverting output will be less than 2.65 V, which means it will be lower than the 2.65 V voltage at the inverting output. This would normally force the output to saturate at the negative power supply voltage, which is simply not present for our circuit. This means the vibration motor will turn off for distances more than 2 cm.

Total Power consumption Estimation

  • Op-Amp input ~0
  • Op-Amp output/Vibration motor: 5 V x 75 mA
  • IR sensor: 5 V x 40 mA

My question is whether the idea of using a single voltage source, and estimates of power correct?

  • \$\begingroup\$ your circuit is wrong. You will only get 5v on the comparator input. Regarding the sensor, won't hot objects ruin the sensing distance because the signal is bigger. \$\endgroup\$
    – Andy aka
    Mar 14, 2014 at 15:50
  • \$\begingroup\$ Since comparators normally have open-collector outputs, you should connect the motor between the positive supply and the comparator output, and exchange the + and - inputs on the comparator so the output will be low when close to the target. Check the comparator datasheet to ensure that its output can handle 75 mA or more, otherwise you may need to add a transistor to drive the motor. \$\endgroup\$ Mar 14, 2014 at 16:07
  • \$\begingroup\$ @andy the inputs to the op-amp are connected to a fixed output from the pot, and to the output of the IR sensor. Which input and why would it be 5 V? Where is the heat coming from? The IR sensor will be far way from the op-amp and will point towards the object of interest. \$\endgroup\$ Mar 14, 2014 at 17:57
  • 2
    \$\begingroup\$ @meon - untrue - according to your circuit the inverting input is connected always to +5V (via a non-attenuating part of the pot) and if the wiper is taken down the pot, eventually 5V will be shorted to 0V and maybe there will be smoke. What if the object of interest is hotter - won't the sensor produce a larger signal - it is an infrared device (IR=heat) but you haven't specified the device so it's impossible to tell. \$\endgroup\$
    – Andy aka
    Mar 14, 2014 at 18:01
  • 1
    \$\begingroup\$ The 741 definitely won't work - the datasheet says the output short circuit current is 40 mA max, and it is intended to work from +/-12 volt supplies - it can't get its output less than 5 volts from the supplies with a 2K load. If you want a comparator, you should really use a comparator, like an LM311, rather than mis-using an op-amp. In any case study the datasheet for any component you intend to use. \$\endgroup\$ Mar 14, 2014 at 18:11

1 Answer 1


In order to bring order out of chaos, I enjoy looking at older questions and helping them to completion. This question, along with the good contributions from the above commentors can be moved forward to help others :

Using the IR sensor as described, I have merely modified the OP's circuit so that the stated function can be implemented.

As stated by comments above, low power op-amp needs a transistor to be able to drive the "vibration motor". Transistor Q1 has been added. Use any transistor that has V-gate threshold less than 4 volts, along with minimum Id of 100mA.

LM393 output is open collector, thus the addition of R1.

R2 was added to put some hysteresis into the circuit, so that the op-amp output doesn't oscillate (bang bang, go hi then low) when sensor signal is close to the setpoint.

Setpoint is achieved by the potentiometer.

The circuit proposed is not supposed to be an exact solution, but one that will give a starter point for others. enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.