Comparator with hysteresis (Schmidt trigger) can be built using  LM339, LM239, LM2901, LM2901V, NCV2901, or MC3302  quad single supply comparator integrated circuit chips. Here is the circuit’s schematic diagram and formula:

inverting schimdt trigger op amp circuit schematic

This circuit’s output will swing to high or low using two threshold values. If the last output is high, then the output can be changed to low if the input swing above upper threshold point, and after the output is low, then it can be changed to high after the input falls under lower threshold point. You can use the formula shown in the figure to select the component values. [Circuit’s schematic source: Motorola Application Notes]