I was thinking about a battery level meter as well which would need a constant voltage to compare against. The project will hopefully be powered by 3AA batteries, so my initial thought was 3.3v regulator as a reference point (I know the 20x2 doesn't have external reference, or easy access internal FVR) and then compare the battery voltage to that I do some maths (that I haven't stopped to think about as yet) to get battery level. This seemed like a plan before I read the calibadc command.
I have not played with it as yet, but the end sum of Vpsu = 255/Nref, meaning that the battery level, in theory at least, could be obtained with no extra components providing a default is programmed to start with. you could even just compare the Nref to the programmed default I suppose. 1% battery charge would be equal to 2.55, battery level = Nref/2.55. multiply out the decimal Nref*100/255 would give the battery level in percent. I have a bit of search around but and there are some thread showing voltage to 2 decimal places having a percentage is a little more helpful when in the field.
I can foresee that system not working below a certain level that isn't 0% being a problem which will need to be solved, but maybe a case of Nref-155=Battery level percentage, the 155 may vary depending on when thing start misbehaving. the final circuit maybe be able to control its own power to stop unreducible results as the project uses a comparator interrupt... That's a point, how much of an effect will calibADC have on the interrupt and the IVR?
This is more to make sure that my thing is correct more than anything else, I don't need anything super accurate. and make sure I don't too nut when thing don't work as expected when I go and experiment
I have not played with it as yet, but the end sum of Vpsu = 255/Nref, meaning that the battery level, in theory at least, could be obtained with no extra components providing a default is programmed to start with. you could even just compare the Nref to the programmed default I suppose. 1% battery charge would be equal to 2.55, battery level = Nref/2.55. multiply out the decimal Nref*100/255 would give the battery level in percent. I have a bit of search around but and there are some thread showing voltage to 2 decimal places having a percentage is a little more helpful when in the field.
I can foresee that system not working below a certain level that isn't 0% being a problem which will need to be solved, but maybe a case of Nref-155=Battery level percentage, the 155 may vary depending on when thing start misbehaving. the final circuit maybe be able to control its own power to stop unreducible results as the project uses a comparator interrupt... That's a point, how much of an effect will calibADC have on the interrupt and the IVR?
This is more to make sure that my thing is correct more than anything else, I don't need anything super accurate. and make sure I don't too nut when thing don't work as expected when I go and experiment