I am looking for a working comparator circuit that doesn't include any op-amp, using any of the basic elements like capacitors, BJTs, MOSFETs, resistors, etc.
The circuit should work as an inverting op-amp, that is, if the input voltage is below the threshold voltage, it should send VCC to output, and if the input voltage is over the threshold voltage, it should send GND to output. It is somehow like a NOT gate with a comparison threshold.
Simply, I used a divider circuit, connected the divider output to the base of mmbt2222, and then tied its emitter to GND. then pulled up its collector with another resistor. Finally, the output would be the collector pin. This way I could control the threshold, but the base input current problem arises.
Vcc is 3.3V. input voltage would be 3.7v in one case and 1.5v in another case. This circuit would be used for USB charger detection, and its output would go to the STM32F103rbt6 GPIO. battery charge is measured with analog input, but when the charger is present, analoge voltage would become the same as VCC, like when the battery is fully charged, making it inaccessible to use it for charger presence detection


