I have a 24V DC motor with a magnetic rotary encoder. The encoder has a 5V supply voltage. The datasheet states that it has an output voltage of 300-700mV. I have also measured it, and it gives around 0.5V. I want to interface this encoder with an STM32 microcontroller, so I want to convert it (reliably) to 3.3V. But I don't really know how. Since the datasheet states a 300mV minimum voltage, I want to build a circuit, that "turns on" at 0.25V, it is "off" below and "on" above, and gives me a clean square signal.
My first though was a transistor operated as a switch, but 0.3V is not enough for a BJT transistor's operation. Then I was thinking about a MOSFET circuit like this one, with an N-channel enhancement MOSFET:
But I have no experience with such circuits. Could this work with just 0.25V threshold? Or do I have to amplify it? What MOSFET and resistor values do I choose?
Or what other solution would be better in this situation?
Thanks for the answers!
Datasheet: https://www.power-tronic.com/wp-content/uploads/2019/11/Type-Magnetic-Incremental-2019-01-08.pdf
MCU: STM32F101R8T6 (GPIO PC8, PC9)

