How can I connect a comparator to an ultrasonic sensor to show the range of sensor?

Discussion in 'The Projects Forum' started by perfect432, Jun 10, 2011.

  1. perfect432

    Thread Starter New Member

    Jun 10, 2011
    I have made an ultrasonic sensor on a breadboard using the circuit diagram on the above website.

    to improve my sensor i am connecting a comparator and 4 LED that will show the range as the LED will illuminate based on the object distance from the sensor. I am using LM339 as a comparator

    NOTE: using a multimeter, i check that as i move my hand closer or far from the sensor, the voltage values changes. so, very close to the transducer, the voltage is in mV. but as i move my hand far, the voltage value starts increasing until 5 V. i connected the multimeter +ve between the LED and R6 and the -ve on the ground part.
    For power supply i am using 6V battery.

    the real problem is that how do I connect 4 LED to LM339 and then this stuff with the sensor.
    The above website is the schematic of LM339.
    can anyone tell me what to put on V-in and V+in and also how to connect the IC in the sensor circuit????????

    I dd some searching about the comparator and the LED and found these circuit but these circuit need to be changed.
  2. Dyslexicbloke

    Well-Known Member

    Sep 4, 2010
    Search for LED bar graph there are litterally hundress of ways to go, from simple inaccurate displays to ones that will rival expensive meters.
    The simplest way is to use a dedicated bar graph chip ....

    The first thing you need to do is establish if the relationship between distance and voltage is linear, which I doubt ....
    That means a simple amplifer and linear graph just isnt going to do what you need.

    perfect432 likes this.
  3. iONic

    AAC Fanatic!

    Nov 16, 2007
    Instead of the LM339 try the LM3915. This is a 10 LED bar graph indicator with a logarithmic output to voltage, which, I believe, is the relationship between the distance from the transducer and the output voltage. The circuit will still need the LM358 or comparable opamp prior to input to the LM3915.
    perfect432 likes this.
  4. wayneh


    Sep 9, 2010
    If you want to stick with the LM339, all you need to do is establish a reference voltage for each of the 4 comparisons. I'd make them variable so that you can set them wherever you want, although once you experiment and get them set, you could replace the pots with fixed resistors. For all 4 references, use a single voltage reference (eg. a 7805 or a zener diode), and then a resistor voltage divider for each comparator's reference. BTW, this is what goes on inside the LM3915, which may be a lot less work for you.