Read battery level

Does anyone know how to make Arduino aware of its battery level? For example, before the Arduino dies completely, I'd like to have it blink a LED to alert the user that the battery is dangerously low on charge. Maybe by somehow regulating the voltage and passing it to an analog input? Thanks for any help.

Well you can take your battery, step the voltage down so that 0-5v is scaled to the battery and feed that into one of the arduino's analog input pins.

You can use a handful of parts, zener, resistor, transistor to switch a digital pin high or low based on what an external voltage is but I've not done it yet.

Something like this but the transistor collector would be connected to a digital pin that's being pulled high by a 10k resistor to +5v. The rest I'd have to sit down and figure out how to drive the transistor as I don't think what is there will work right.

Did you have a look at ?