# Schmitt Trigger: Problems between theory and reality

I want to say that I am not a native English speaker so you may find some writing errors. Also, I am just learning electronics, so sorry if some questions are poorly formulated.

I am trying to build a proximity alarm. In order to achieve this, I want to compare an electrical signal from a distance measuring sensor unit (you can find its datasheet here: Datasheet). This sensor gives me a signal from 20 to 150 cm, so, what I want to occur is for the alarm to turn on when something is blocking the sensor at approximately 40 cm.

To generate this comparator, I am using a Schmitt Trigger. I set up (experimentally) the resistances in order to give a threshold of 40 cm. Here is the schematic.

simulate this circuit – Schematic created using CircuitLab

I have found the desired output, but with some problems:

1. The actual thresholds are not equal to the theoretical thresholds.
2. When I connect a buzzer in parallel with the output, the voltage falls a lot and it sounds very low. How can i fix this?

And the questions are:

1. Why are the experimental and theoretical thresholds not equal?
2. How can I couple a simple buzzer?
3. Is the biasing correct?
4. If I want to add an LED, how can I connect it?

PD1: The input wave is there just to give a reference because I can't simulate the sensor.

PD2: The calculations of the thresholds:

• $$\V_{high} = \frac{R3}{R1+R2+R3}V_{CC} - 0.7\text{ V} = 2.3\text{ V}\$$

• $$\V_{low} = \frac{R3}{R1 + R2 + R3 + \frac{R1 \cdot R3}{R5}}V_{CC} + 0.7\text{ V} = 2.78\text{ V}\$$

• Ad PD2, I cannot follow your Vhigh and Vlow calculation, do the resistors named the same, where is VCC? Vhigh in your example wouldn't be the voltage at the base of Q2? I would suggest neither the calculated, nor the experimentally ones are right, perhaps the simulated thresholds? Ad 2.) the buzzer would load too much of the very high impedance of output of about 10k. Dec 19, 2018 at 22:30
• The thresholds are extracted from here: instructables.com/id/… . Adding a resistor in serie with the buzzer would help to a better coupling with the schmitt trigger?. The simulated thresholds are very similar with the experimentally ones. Dec 19, 2018 at 23:15
• Some discussion of a circuit close to yours is found here.
– jonk
Dec 20, 2018 at 2:40
• I can't tell from the datasheet what the current compliance might be for the analog output. Without knowing that, you'd have to assume "not much" and that might mean a more complex circuit. Also, it's important to know what buzzer you want and its current requirements. We need lots more detail, I think.
– jonk
Dec 20, 2018 at 3:29
• @RudyGarcia One more question for you to answer. Is that a $9\:\text{V}$ battery voltage? Or the voltage from a mains-supplied DC power supply? It's important to know because the battery will have a more widely varying voltage over its lifetime of use and that fact affects some choices.
– jonk
Dec 20, 2018 at 21:21