easiest way to programatically get a DC voltage reading?

Red Squirrel

No Lifer
May 24, 2003
69,065
12,918
126
www.anyf.ca
I will be building my own UPS using an inverter charger and a battery bank. I want to be able to get a voltage reading of the bank within a Linux script/app so I can act accordingly when the voltage drops below a certain voltage. What hardware would I need to be able to do this?

I'd also like to be able to get a AC voltage reading separately so I can detect an outage. I'm thinking some kind of USB data acquisition device of some sort maybe? Just not sure what.