Hey guys, based on Honk's work I implemented a battery monitor class. I did this because I wanted to do it a little different then his CHR6DM implementation.
The v2.0 shield has a built in voltage divider (divide by 3 using 15k and 7.5k resistors). If you setup the AREF to DEFAULT, it uses 5V as the reference without any additional circuitry.
There is a diode that protects VIN from USB power if applied, so I measured about a 0.9V drop. I added this back into the math, so when you view the voltage it is the same as should be at the battery itself. I verified this by putting a voltage monitor at the charge plug (the one that I sold at the store). It would report something like 12.1V. Then I used a DMM to measure at the output of the lipo pack itself and verified they were the same (sometimes was 0.1V off). I then left the battery monitor attached, but started viewing the voltage drop through the Configurator. They match, so I'm reasonably confident we have it working OK.
I set a warning limit to 10V, and the alarm limit to 9.5V (similar to an external low voltage alarm I use). What happens when the warning limit is reached? The quad does a "heartbeat". It will do a tiny drop in altitude once every second, and it will blink the red LED each second too. I remember this from my old X3D-BL and really liked that I had an indication that could be seen in day as well as evening.
If the alarm limit is reached it does an auto descend. That came from Honk and works EXTREMELY well! I also turn on a buzzer attached to LED out pin 7, but I haven't tested that yet (I lost my Radio Shack buzzer, will have to buy another).
Thanks Honk for starting this off! I made tiny mods to your code, so could you please tell me if I messed anything up and I'll fix it? Please check here: https://github.com/AeroQuad/AeroQuad...tteryMonitor.h Also, I'm thinking about making the Auto Descent default, since it works very well. Let me know if you object.
Please note, I should make the warning/alarm limits user definable. They guys here have been making optimizations to the code, so I dont' want to add any new EEPROM storable items yet. I plan to make a new Configurator that will load all params from file, which should eliminate the need to create a default config inside the code. So for now those values will be hardcoded but will be made configurable in a future version.
If you have any other input, let me know so I can think about it before the next release. But no worries, if after you guys start flying with it and have any other input, we can always roll it into a future release. Thanks!