There is a part of my circuit that uses resistance to output a voltage, in which is compared to a voltage threshold to output a digital signal.
However +Vcc can vary and any voltages too far from 5V will cause this comparator to function wrongly and toggle at the wrong resistances, since the output voltage is a percentage of +Vcc while the voltage threshold is determined by a zener diode, which won't change even if +Vcc is changed. Which makes calibrating the comparator useless since any change in +Vcc throws the entire module off.
I'm not sure which of the two solutions are the best to implement, or to do both?
- Use a linear regulator to maintain a 5V +Vcc signal, so that the output voltage will always be calibrated since +Vcc won't change at all.
- Make it such that instead of using an absolute-value threshold like a zener diode, use a voltage divider so, like the output voltage, is relative to +Vcc, therefore it will remain calibrated (the comparator will still toggle at the same resistance).
I'm kind of in for #2 because it feels like "good practice" to work relative to +Vcc, but it also introduces some problems like it is difficult to compare two voltages directly. #1 also seems nice because it allows us to work with numbers directly.
If I do both one of them may feel unnecessary. #2 may make it such that a wide range of voltages may be used (up to a certain power limit), but may be harder.
#1 may make it such that everything will be more accurate, especially when there are some unavoidable constants that won't vary with +Vcc such as the diode forward voltage.
So, #1 or #2, or both? Or something else entirely? :/