BasicX measure battery using ADC
24p is running off of?
> What is the best method to go about measuring the battery voltage...
A simple resistive voltage divider from the unregulated source to ground
will provide a lower corresponding voltage on an analog input pin. The
resistor values should be moderately high to reduce battery loading. I
chose 220k and 100k, which brings 15v down to just below 5v, the maximum
analog voltage on the pin.
To convert the analog input voltage to the battery voltage, divide by an
appropriate factor, for example:
const sDividerRatio as single = 0.3125 '100k/(220k+100K)
const Pin_BatteryAnalog as byte = 17
dim sNonDimVolt as single, sBatteryVoltage as single
call GetADC(Pin_BatteryAnalog, sNonDimVolt)
sBatteryVoltage = sNonDimVolt * 5.0 / sDividerRatio Tom