Would a 311 type comparator work? With the pull-up resistor on the output going to +5V I've been toying with a similar problem & this seemed more reliable / less parts than adding zeners or depending on knowing rail voltages etc. -Thomas