This essential circuit converts an analogue signal to a digital output:
This circuit gives a max output of 3.8V digital from a 3.8V sine input;
The Vcc can be no more than 5V else the top threshold of this circuit design is crossed and the output goes to 0V; the input must be no less than 3.7 Vpp AC else the lower threshold won’t be crossed and trigger a change, due to the concept of a Schmitt Trigger:
“It is an active circuit which converts an analogue input signal to a digital output signal. The circuit is named a “trigger” because the output retains its value until the input changes sufficiently to trigger a change. In the non-inverting configuration, when the input is higher than a chosen threshold, the output is high. When the input is below a different (lower) chosen threshold the output is low, and when the input is between the two levels the output retains its value. This dual threshold action is called hysteresis and implies that the Schmitt trigger possesses memory and can act as a bistable multivibrator (latch or flip-flop). There is a close relation between the two kinds of circuits: a Schmitt trigger can be converted into a latch and a latch can be converted into a Schmitt trigger.
Schmitt trigger devices are typically used in signal conditioning applications to remove noise from signals used in digital circuits, particularly mechanical contact bounce in switches.”
I found changing R2 to 30k and increasing Vcc to 5.4V I got a 5V logic level for a 3.6Vpp input:
The closest I got to a 5V, 50% duty cycle square wave was a 3:2 rectangle by changing R1 to 10k and Vcc at 6.8V – an insight to circuit design and limitations like power feed, component stress and stability etc.