I am designing a small dongle that will have features either enabled or disabled as a function of the supply voltage. I want the device to be low-power and run, for the most part, off a 3V coin-cell battery. However, I am provisioning the design such that the bus may be powered by one of three sources: the 3V coin cell, 4.5V external battery pack, or VUSB.
The motivation for requiring that we know which source is powering the bus is that, to increase operating lifetime, certain features (like seven-segment indication) should be disabled if we are not using one of the two higher-power options (VUSB, or external 4.5V). So, the real problem to solve is how to determine if the 3V coin cell is selected, otherwise we can assume the supplement features can be enabled.
My first thought was to include a difference amplifier in the design. The implementation would have one op-amp input on the bus and the other on the 3V coin-cell rail. Although this should work, it would add a few extra dollars to the overall design cost which, of course, I would like to avoid if possible.
Another options could be something with an on-board ADC by using the 3V as the Analog Reference (AREF). But things begin to overcomplicate at this point and we begin to create unnecessary restrictions on the use-cases of the device (like always requiring the 3V cell be present).