[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Paparazzi-devel] Airframe BAT section
From: |
Michel GORRAZ |
Subject: |
Re: [Paparazzi-devel] Airframe BAT section |
Date: |
Wed, 25 Jun 2008 07:40:03 +0200 |
Hi guys,
In " #define VoltageOfAdc(adc) ( coeff *adc) " let :
- adc
= raw value of the ADC input measuring battery voltage. LPC2148 are
10bits ADCs, so the raw value in software always between 0 and 2^10-1
(=1023)
- Vref = LPC2148 ADCs ref voltage = LPC2148 main power supply = 3.3v
- R1, R2 = resistors made up the bridge of the battery voltage measurement system (see schematic)
- R1 between Vbattery & ADC input
- R2 between ADC input & ground
The general formula to compute the coefficient is :
coeff = ( Vref / ( 2^10 - 1 ) ) x (1 + R1/R2)
coeff = ( 3.3 / ( 1024 - 1 ) ) x (1 + R1/R2)
coeff = 0,0032258 x (1 + R1/R2)
For example :
Tiny 1.1 : R7 = 15k, R15 = 3.3k => coeff = 0,0178885630
Tiny 2.1 : R1 = 15k, R2 = 3.3k => coeff = 0,0178885630
Tiny 2.11 : R1 = 10k, R2 = 1.5k => coeff = 0,0247311828
But, it's an approximate value because of the dispersions of the components :
- resistors values (+/-1% or 5%)
- power supply (not exactly 3.300v)
- etc.
So, calculate your own board "coeff" according these
two resistors values and if necessary adjust it with the GCS voltage
indication and several battery voltage values (use a power supply)
@+
Michel
PS
: note that R1 & R2 values where modified between Tiny 2.1 and 2.11
to minimize the amount of resistors values, so the cost...
2008/6/25 David Conger <
address@hidden>:
Toby,
I just went there...too much info unless you just want to read a lot about my build.
I will save you some reading :)
"Well, Update, if you did like me and used the "default" resistors for building the Tiny2.11 there is one file to modify to have the autopilot correctly report the voltage of the battery.
File is:
$PAPARAZZI_HOME/conf/autopilot/tiny_2_1.h
on my system that is: /home/david/paparazzi3/conf/autopilot/tiny_2_1.h
Go to the bottom of the file and make this change:
#ifndef VoltageOfAdc
/* #define VoltageOfAdc(adc) (0.01787109375*adc) */
#define VoltageOfAdc(adc) (0.0247311828*adc)
#endif
See, I commented the orig. line and simply duplicated it with the new multiplier. I used the same one that Michael G. posted (and I reposted in this log).
Now in GSC my battery voltage reads 10.7 ... my EXTECH 382200 Current Limiting Power Supply says: 10.8 @ 0.12A ...close enough. "
The above is about two more pages into the build.
Hope it helps.
-David
On Jun 24, 2008, at 3:09 PM, TurboTas wrote: