I'm making a major digital circuit powered by two 3.6 volt cordless phone NiCD rechargeable batteries, and one thing I want to include is a low battery detector. To protect the rest of the circuit from overheating, I use a typical 7805 voltage regulator circuit to give all my circuit 5 volts.
What I want to do is detect if the source battery is too weak to power the rest of the circuit and allow a microcontroller to detect it via a GPIO pin's logic state.
Because digital circuits ideally run on 5VDC, I figured using a zener diode rated at 5.1V with a 10K resistor for R1 would be sufficient to detect the low voltage itself but I'm not sure if it would explode the GPIO pin even though its pulled up by 5V through R2 which I may also make as 10K.
Would this circuit have potential to work or would connecting fresh batteries equaling the same voltage explode a GPIO pin?
Also, is 10K an ok value for the resistors or should I choose something different?
The microcontroller in question is at89C2051.