# Comparator

The questions below are due on Wednesday April 01, 2020; 11:59:00 PM.

You are not logged in.

Note that this link will take you to an external site (https://shimmer.csail.mit.edu) to authenticate, and then you will be redirected back to this page.

On the receive stage of our doppler ultrasound system is an amplifier to amplify the received signal, and then a comparator to take the received sine wave and turn it into a digital signal, so that we can more easily process it:

The circuit that implements this functionality is:

However, any on v_{IN} will cause v_{OUT} to switch back and forth as v_{IN} crosses 2.5 V. Since we are measuring time between switchings of v_{OUT} to determine frequency, addition switchings due to noise will create error in our frequency estimate. So, we add hysteresis to the comparator using positive feedback to obtain a new input-output relation as follows.

Note that v_{OUT} switches to 5V when v_{IN} falls below v_{LOW}, and that it will not switch back to 0V until v_{IN} rises above v_{HIGH}. Similarly, note that v_{OUT} switches to 0V when v_{IN} rises above v_{HIGH}, and that it will not switch back to 5V until v_{IN} falls below v_{LOW}. The separation of v_{HIGH} and v_{LOW} adds a noise immunity margin of v_{HIGH}-v_{LOW} to the switching decision.

The op-amp-like device in the circuit is a MAX941 comparator, which works as follows:

• if the input v_+ - v_- < 0 then v_o = 0 (actually, 0.2..0.3 V)
• if the input v_+ - v_- > 0 then v_o = V_{CC} (actually, V_{CC} - 0.2..0.3 V)

Note that a comparator is a very-high-gain amplifier that is designed to switch very quickly between its two power supply values, and remain at one value until it switches to the other. This is unlike the behavior of an op amp. Despite this, the op-amp and the comparator are given the same symbol.

On our board the comparator is being driven with an upper supply of V_{CC} = 5 V and a lower supply of ground (0V).

The comparator incorporates a Schmitt Trigger architecture with hysteresis to avoid switching due to noise around v_+ - v_- = 0.

The MAX941 has an internal hysteresis circuit that provides about 1 mV of hysteresis. We want more hysteresis, so we design our own circuit around the comparator.

Let's analyze and then design this circuit. We know that the output will either be 0 V or 5 V (approximately), and so we can assume that the output acts:

• a short circuit to ground when v_o = 0 V
• a 5 V voltage source when v_o = 5 V

Let's first assume the output v_o is 0 V and the determine the voltage at pin 2 aka v_+.

v_+ [V] =

Next, assume the output is 5 V and determine the voltage at pin 2 aka v_+.

v_+ =

So we see that the external circuit is meant to provide a hysteretic voltage at v_+ that is symmetric about 2.5 V. The reason is that 2.5 V is serving as the "virtual ground" in our system.

Finally, we need to pick R10 and R11 so that there is the desired amount of hysteresis.

How much hysteresis would there be if R10=R11? Enter the difference between the upper switching voltage v_{HIGH} and lower switching voltage v_{LOW} in V: =

Choose R10 and R11 subject to the following constraints:

• 0.4 - 0.5 V of hysteresis, which is the upper switching voltage v_{HIGH} minus the lower switching voltage v_{LOW}
• resistor values in the range of 1 k\Omega and 100 k\Omega

Enter your values as a Python list in the following order: [R10, R11]. Thus, if you chose R10 = 10k, R11 = 20k, you would enter [1e4, 2e4].