mhough wrote:
And a battery Monitor!!!!!!!!!!!!
AWESOME!!!
A note on the battery monitor.
For starters, it's just a voltage, not a fuel gauge. LiPo batteries have a complicated discharge curve, different for each physical cell, and it's difficult to work with.
Also, The schematic shows a simple voltage divider, and implies that the battery monitor voltage is precisely half the actual battery voltage. However, I have found that since the divider has such a large resistance, the input impedance of the ADC needs to be taken into account as well. For me, this means that the input voltage has to be multiplied by about 2.27, instead of 2. I presume this is constant as long as the battery voltage is high enough to run the 3.3V regulator, and keep the chip power at 3.3V. Who knows what happens once the power supply voltage starts dropping?
How to find the constant for you: Measure the voltage from ground to V3.3, which naturally should be 3.3V plus or minus a small amount. It's 3.29 for me when the battery is fully charged. Next, measure the voltage from ground to BATT, and write it down. Finally, run the Logomatic recording AD0 for long enough to get a good sample (a few seconds is enough).
Now for some math. Take the average of the AD0 number, and divide it by 1024*(ADC Binning). Now multiply that by the V3.3 voltage measured above and you have what the battery monitor measured. Finally, the ratio between what you measured on the voltmeter from ground to BATT and the voltage the Logomatic measured should be the constant you are after.
So, for me, I measured 3.29V from ground to V3.3, and 4.20V from ground to BATT. The Logomatic was running at 100Hz (irrelevant) with 16x binning (relevant). I got a mean measurement of about 9186 on the battery monitor. Divide by 16384 to get 0.56067, multiply by 3.29V to get 1.8446. Since the actual voltage was 4.2 at the time, the ratio is 4.2/1.8446, or about 2.27. This means that the bottom rung of the voltage divider is significantly smaller than the top, maybe 800k. Since this is the 1M resistor on the board in parallel with the input impedance on the Logomatic, that input impedance must be about 4M or 5M, pretty high, but not a lot higher than the voltage divider.
A couple of requests from Sparkfun on the next hardware rev.
1) Make the battery monitor voltage divider smaller. 10k instead of 1M resistors will make this much more accurate, (constant of about 2.0001 instead of 2.27) at the cost of 165uA current draw (insignificant next to the ~100mA draw of the whole Logomatic).
2) Give me a separate pin for the RTC battery power. This is the only thing needed to make the RTC truly independent, and put the 32kiHz crystal to good use. With a coin cell hooked to this input, the Logomatic will remember the time across resets and powerdowns.
3) Expose as many of the rest of the GPIO pins as possible.
I realize the latter two requests will require more pins, but it will go a long way towards realizing the full potential of the LPC2148.