Using the On Semiconductor NCS2200 voltage comparator this 2019 circuit was obtained from the component's own datasheet. The circuit works with voltages from 0.85 to 6 V. The formula for calculating the components is given next to the diagram.