Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
#include "subsystems/sensors/baro.h"
#include "generated/airframe.h"
#include "subsystems/abi.h"
#include "led.h"
Go to the source code of this file.
Macros | |
#define | BOOZ_ANALOG_BARO_THRESHOLD 850 |
threshold >0 && <1023 More... | |
#define | BOOZ_BARO_SENS 0.759837 |
scale factor to convert raw ADC measurement to pressure in Pascal. More... | |
Functions | |
void | baro_init (void) |
void | baro_periodic (void) |
void | baro_board_calibrate (void) |
Variables | |
struct BaroBoard | baro_board |
#define BOOZ_ANALOG_BARO_THRESHOLD 850 |
threshold >0 && <1023
Definition at line 37 of file baro_board.c.
#define BOOZ_BARO_SENS 0.759837 |
scale factor to convert raw ADC measurement to pressure in Pascal.
Sensor Sensitivity -> SS = 0.045 mv / Pa Sensor Gain -> G = 94.25 Sensitivity -> S = SS*G = 4.24125 mV / Pa 10 bit ADC -> A = 3.3 V / 1024 = 3.223 mV / LSB Total Sensitivity SENS = A / S = 0.759837
For the real pressure you also need to take into account the (variable) offset
supply voltage Vs = 5V real sensor sensitivity Vout = Vs * (0.009 P - 0.095) voltage variable offset Voff(DAC) = Vs / 69.23 + (DAC * 3.3 / 1024) / 21.77 ADC voltage at init Vadc = 3.3*BARO_THRESHOLD/1024 = Vout - Voff
=> Inverting these formulas can give the 'real' pressure
since we don't care that much in this case, we can take a fixed offset of 101325 Pa
Definition at line 60 of file baro_board.c.
void baro_board_calibrate | ( | void | ) |
Definition at line 95 of file baro_board.c.
References baro_board, BB_RUNNING, BOOZ_ANALOG_BARO_THRESHOLD, DACSet(), LED_ON, LED_TOGGLE, BaroBoard::offset, BaroBoard::status, and BaroBoard::value_filtered.
Referenced by baro_periodic().
void baro_init | ( | void | ) |
Definition at line 65 of file baro_board.c.
References BaroBoard::absolute, adc_buf_channel(), ADC_CHANNEL_BARO, baro_board, BB_UNINITIALIZED, BaroBoard::buf, DACSet(), DEFAULT_AV_NB_SAMPLE, LED_OFF, BaroBoard::offset, BaroBoard::status, and BaroBoard::value_filtered.
void baro_periodic | ( | void | ) |
Definition at line 80 of file baro_board.c.
References BaroBoard::absolute, adc_buf::av_nb_sample, baro_board, baro_board_calibrate(), BARO_BOARD_SENDER_ID, BB_UNINITIALIZED, BOOZ_ANALOG_BARO_THRESHOLD, BOOZ_BARO_SENS, BaroBoard::buf, get_sys_time_usec(), BaroBoard::status, adc_buf::sum, and BaroBoard::value_filtered.
struct BaroBoard baro_board |
Definition at line 63 of file baro_board.c.
Referenced by baro_board_calibrate(), baro_init(), baro_periodic(), and lisa_l_baro_event().