A few issues

Development & General Chat for the superb openxvario project.

Moderator: rainer

Post Reply
Billy60
Posts: 44
Joined: Sun May 26, 2019 8:09 am
Country: -

A few issues

Post by Billy60 »

Good afternoon all,

I have made 5 Alt- Varios with VFAS-Cels monitoring plus one with Neo6 GPS.

First thing: out of the 10 pcs I got, 40% of the MS5611 I received where not functionnal, 50% f the GPS (one is working, one was refunded). So anticipate and buy more than needed ! Better use BG rather than the Bay, they seem to have better quality ?
2nd thing: the Vario and ALT features do work fine, note that I had to temperature compensate at +200 and not 800 as suggested.

Now, the issue: Impossible to get any proper Cels monitoring.
I have the same hardware connexions, wih SMD chosen resistors. Same ino sketch downloaded with the same CH340. Promini clones.
I use A2 for the first cell, A3 for the 2nd and A1 for the 1st one. Resistors are the usual 10k- 33k; 10k - 68k; 10k-120k.

In some cases I get VFAS = total VCC, and Cels at the value of one cell only.
In some cases I get the opposite: Cels is correct and VFAS is one cell value.
How to explain this ?

How do I get to know which cell has to be trimmed ? I do not have acess to any individual measurement of each cell.

Thanks a lot !

TX is FRsky, RX is X8R with S-port

mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: A few issues

Post by mstrens »

Can you put here your (2) config files.
Please note that in order to get voltage of each cell (or min), you must connect all cells simultanously. In fact oXs measures the voltage of cell1, the voltage of cells 1+2 and the voltage of cells 1+2+3. The voltage of each cell is then calculated by oXs by difference. oXs rejects the individual cell voltage if it is not in a "normal" range (e.g. less than 4.3 Volt).

In order to check if the raw voltages measured are ok, you can ask in you config that oXS transmit VOTL1 (cell1) as T1 and VOLT2 (Cells 1 + 2) as T2 and VOLT3 as VFAS. If the "raw voltages are OK, the Cell voltages transmitted to Tx should be OK if the number of cell defined in config is set on 3
Billy60
Posts: 44
Joined: Sun May 26, 2019 8:09 am
Country: -

Re: A few issues

Post by Billy60 »

Thanks Michel, I do appreciate your work and dedication indeed !
Here are the files:
// OpenXsensor https://github.com/openXsensor/
// started by Rainer Schlosshan and maintained by Michel Strens

// This is version : 8.2.12 (29 dec 2017)

//******************************************************************************************************************************************************* //
// //
// ! IMPORTANT NOTE !!!!!!!!!! Another file in this project provides detailed explanations on how to set up this file (see oXs_config_description.h). //
// //
//******************************************************************************************************************************************************* //
// Note: the oXs_config_basic.h and oXs_config_advanced.h files present on the GitHub site are not always meaningful.
// It could be that the combination of active/non active parameters is not consistent.
// This is just the result of many updates and tests in this document.
// So take always care to set up the files according to your needs and check carefully all options.
// For old version 2 and 3 of oXs, there was a program named "configurator" running on PC that allowed easier editing of a oXs_config.h file
// Still this configurator is not developped anymore. So this version request manual editing.


#ifndef OXS_CONFIG_BASIC_h
#define OXS_CONFIG_BASIC_h

// --------- 1 - Telemetry protocol ---------
#define PROTOCOL FRSKY_SPORT // select between FRSKY_SPORT , FRSKY_HUB , FRSKY_SPORT_HUB , MULTIPLEX , HOTT, JETI

// ***** 1.1 - Pin connected to Rx ************ See oXs_config_advanced.h (normally no need to change it) (default is arduino pin 4 connected to RX)
// ***** 1.2 - SPORT_SENSOR_ID (used only for Frsky Sport protocol) ***** See oXs_config_advanced.h (normally no need to change it)

// --------- 2 - Data to transmit --------- uncomment the lines below if you want to transmit some extra oXs measurements into some telemetry fields
// ***** 2.1 - Frsky data *****
#define VFAS_SOURCE VOLT_1 // select between VOLT_1, VOLT_2, VOLT_3 , VOLT_4, VOLT_5 , VOLT_6, ADS_VOLT_1, ADS_VOLT_2, ADS_VOLT_3, ADS_VOLT_4
//#define FUEL_SOURCE ADS_VOLT_1 // select between VOLT_1, VOLT_2, VOLT_3 , VOLT_4, VOLT_5 , VOLT_6, ADS_VOLT_1, ADS_VOLT_2, ADS_VOLT_3, ADS_VOLT_4
//#define A3_SOURCE ADS_VOLT_1 // select between VOLT_1, VOLT_2, VOLT_3 , VOLT_4, VOLT_5 , VOLT_6, ADS_VOLT_1, ADS_VOLT_2, ADS_VOLT_3, ADS_VOLT_4
//#define A4_SOURCE ADS_VOLT_3 // select between VOLT_1, VOLT_2, VOLT_3 , VOLT_4, VOLT_5 , VOLT_6, ADS_VOLT_1, ADS_VOLT_2, ADS_VOLT_3, ADS_VOLT_4
//#define ACCX_SOURCE TEST_1 // select between TEST_1, TEST_2, TEST_3, GLIDER_RATIO , SECONDS_SINCE_T0 ,AVERAGE_VSPEED_SINCE_TO , VOLT_1, VOLT_2, VOLT_3, VOLT_4, VOLT_5, VOLT_6, PITCH, ROLL , YAW, ADS_VOLT_1, ADS_VOLT_2, ADS_VOLT_3, ADS_VOLT_4
//#define ACCY_SOURCE TEST_2 // select between TEST_1, TEST_2, TEST_3, GLIDER_RATIO , SECONDS_SINCE_T0 ,AVERAGE_VSPEED_SINCE_TO , VOLT_1, VOLT_2, VOLT_3, VOLT_4, VOLT_5, VOLT_6, PITCH, ROLL , YAW, ADS_VOLT_1, ADS_VOLT_2, ADS_VOLT_3, ADS_VOLT_4
//#define ACCZ_SOURCE TEST_3 // select between TEST_1, TEST_2, TEST_3, GLIDER_RATIO , SECONDS_SINCE_T0 ,AVERAGE_VSPEED_SINCE_TO , VOLT_1, VOLT_2, VOLT_3, VOLT_4, VOLT_5, VOLT_6, PITCH, ROLL , YAW, ADS_VOLT_1, ADS_VOLT_2, ADS_VOLT_3, ADS_VOLT_4
//#define T1_SOURCE SENSITIVITY // select between TEST_1, TEST_2, TEST_3 , GLIDER_RATIO , SECONDS_SINCE_T0 ,AVERAGE_VSPEED_SINCE_TO , SENSITIVITY, PPM, VOLT_1, VOLT_2, VOLT_3, VOLT_4, VOLT_5, VOLT_6, ADS_VOLT_1, ADS_VOLT_2, ADS_VOLT_3, ADS_VOLT_4
//#define T2_SOURCE PPM // select between TEST_1, TEST_2, TEST_3, , GLIDER_RATIO, SECONDS_SINCE_T0 ,AVERAGE_VSPEED_SINCE_TO , SENSITIVITY, PPM, VOLT_1, VOLT_2, VOLT_3, VOLT_4, VOLT_5, VOLT_6, ADS_VOLT_1, ADS_VOLT_2, ADS_VOLT_3, ADS_VOLT_4

// ***** 2.2 - Hott data *****
//#define CELL_UNDERVOLTAGE_WARNING 3300 // Warning threshold in mV;
//#define BATTERY_1_SOURCE ADS_VOLT_1 // select between VOLT_1, VOLT_2, VOLT_3, VOLT_4, VOLT_5, VOLT_6, ADS_VOLT_1, ADS_VOLT_2, ADS_VOLT_3, ADS_VOLT_4
//#define BATTERY_2_SOURCE ADS_VOLT_2 // select between VOLT_1, VOLT_2, VOLT_3, VOLT_4, VOLT_5, VOLT_6, ADS_VOLT_1, ADS_VOLT_2, ADS_VOLT_3, ADS_VOLT_4
//#define MAIN_BATTERY_SOURCE ADS_VOLT_3 // select between VOLT_1, VOLT_2, VOLT_3, VOLT_4, VOLT_5, VOLT_6, ADS_VOLT_1, ADS_VOLT_2, ADS_VOLT_3, ADS_VOLT_4
//#define TEMPERATURE_1_SOURCE VOLT_1 // select between VOLT_1, VOLT_2, VOLT_3, VOLT_4, VOLT_5, VOLT_6, TEST_1, TEST_2, TEST_3 , GLIDER_RATIO , SENSITIVITY , PPM
//#define TEMPERATURE_2_SOURCE PPM // select between VOLT_1, VOLT_2, VOLT_3, VOLT_4, VOLT_5, VOLT_6, TEST_1, TEST_2, TEST_3 , GLIDER_RATIO , SENSITIVITY, PPM

// ***** 2.3 - Multiplex data *****
//#define SETUP_MULTIPLEX_DATA_TO_SEND \
5 , REL_ALTIMETER , 1 , 1 , 0 , -16384 , 16383 , \
6 , VERTICAL_SPEED , 1 , 1 , 0, -500 , 500 , \
7 , ALTIMETER_MAX , 1 , 1 , 0 , -16384 , 16383
// 8 , VOLT_1 , 1, 1 , 0 , -16384 , 16383
// 6 , CURRENTMA , 1 , 1, 0 , -16384 , 16383 ,\
// 7 , MILLIAH , 1 , 1, 0 , -16384 , 16383
// 7 , CELL_TOT , 1 , 1 , 0 , -16384 , 16383 , \
// 4 , VOLT_4 , 1 , 1 , 0 , -16384 , 16383 , \
// 9 , PPM , 1 , 1 , 0 , -16384 , 16383
// 3 , ALTIMETER , 1 , 1 , 0 , -16384 , 16383 , \

// ***** 2.4 - Jeti data *****
//#define VOLTAGE_SOURCE VOLT_1 // select between VOLT_1, VOLT_2, VOLT_3 , VOLT_4, VOLT_5 , VOLT_6
//#define TEMPERATURE_SOURCE NTC // select between MS5611 and NTC

// ***** 2.5 - How to fill TEST_1, TEST_2, TEST_3 ****** see oXs_config_advanced.h (required only when some measurements have to be filled in TEST_1, TEST_2 or TEST_3)

// --------- 3 - PPM settings --------- see oXs_config_advanced.h (default, this option is not active)

// --------- 4 - Vario settings ---------
// ***** 4.1 - Connecting 1 or 2 barometric sensor(s) *****
#define FIRST_BARO_SENSOR_USE MS5611 // select between NO_BARO , MS5611, GY86 , BMP085 , BMP180 , GY87, BMP280
// Note : when used, second sensor is to define in oXs_config_advanced.h

// ***** 4.2 - Type of Vspeed to transmit *****
#define VSPEED_SOURCE FIRST_BARO // select between FIRST_BARO, BARO_AND_IMU, SECOND_BARO , AVERAGE_FIRST_SECOND, AIRSPEED_COMPENSATED or PPM_SELECTION

// ***** 4.3 - Sensitivity predefined by program ***** see oXs_config_advanced.h (normally no need to change it)
// ***** 4.4 - Sensitivity adjusted from the TX ***** see oXs_config_advanced.h (normally no need to change it)
// ***** 4.5 - Hysteresis parameter & Alt compensation based on sensor temp ***** see oXs_config_advanced.h (normally no need to change it)
// ***** 4.6 - Vertical speeds calculations based on PPM **** see oXs_config_advanced.h (change only if PPM_SELECTION is used)
// ***** 4.7 - Analog vertical speed ***** see oXs_config_advanced.h (change if you want to activate it)
// ***** 4.8 - Calculating glider ratio, average sink/climb rate ************** see oXs_config_advanced.h (change if you want to get those measurement)
// --------- 5 - Airspeed settings --------- see oXs_config_advanced.h for additionnal parameters (normally no need to change them)
#define AIRSPEED_SENSOR_USE NO_AIRSPEED // select between NO_AIRSPEED , MS4525 , MPXV7002

// --------- 6 - Voltages & Current sensor settings ---------

// ***** 6.1 - Voltage Reference to measure voltages and current ***** see oXs_config_advanced.h when voltage reference is not Vcc and 5 volt

// ***** 6.2 - Voltage parameters ***** see oXs_config_advanced.h for additionnal parameters when YES
#define ARDUINO_MEASURES_VOLTAGES YES // select between YES , NO (When NO, following line is discarded)

// ***** 6.3 - Max number of Lipo cells to measure (and transmit to Tx) *****
#define NUMBEROFCELLS 3 // Put this line as comment or set value to 0 (zero) if you do not want to transmit cell voltages.

// ***** 6.4 - Convert voltage to temperature (° Celcius) ***** see oXs_config_advanced.h if you want to measure temperature(s) with thermistor

// ***** 6.5 - Current parameters ***** see also oXs_config_advanced.h for additionnal parameters if you want to measure current with a current sensor
#define ARDUINO_MEASURES_A_CURRENT NO // select between YES , NO

// ***** 6.6 - Ads1115 parameters ***** see oXs_config_advanced.h for additional parameters when AN_ADS1115_IS_CONNECTED is YES
#define AN_ADS1115_IS_CONNECTED NO // select between YES , NO

// --------- 7 - RPM (rotations per minute) settings --------- see oXs_config_advanced.h for additional parameter about the number of pulses per rotation
#define CALCULATE_RPM NO // select between YES , NO

// --------- 8 - Persistent memory settings --------- ( see also oXs_config_advanced.h - used mainly when a flow sensor is connected )
#define SAVE_TO_EEPROM NO

// --------- 9 - GPS --------------- see oXs_config_advanced.h for additionnal parameters (normally no need to change them)
#define A_GPS_IS_CONNECTED YES // select between YES , NO

// --------- 10 - IMU 6050 --- (accelerometer + gyro) and HMC5883 (magnetometer) -- see oXs_config_advanced.h for additionnal parameters e.g. about calibration
// ***** 10.1 - IMU 6050 *****
#define A_MPU6050_IS_CONNECTED NO // select between YES , NO

// ***** 10.2 - HMC5883 *****
#define CALCULATE_YAW_WITH_HMC5883 NO // select between YES , NO ; YES requires that A_MPU6050_IS_CONNECTED is YES here above

// --------- 11 - Flow sensor --------------- if YES, see also oXs_config_advanced.h
#define A_FLOW_SENSOR_IS_CONNECTED NO // select between YES , NO

// --------- 20 - Sequencer --------- see oXs_config_advanced.h (only when oXs has to generate signals in sequence)


#endif// End define OXS_CONFIG_BASIC_h
Now, the Advanced file:

//******************************************************************************************************************************************************* //
// //
// ! IMPORTANT NOTE !!!!!!!!!! Another file in this project provides detailed explanations on how to set up this file (see oXs_config_description.h). //
// //
//******************************************************************************************************************************************************* //
// Note: the oXs_config_advanced.h file present on the GitHub site is not always meaningful.
// It could be that the combination of active/non active parameters is not consistent.
// This is just the result of many updates and tests in this document.
// So take always care to set up the oXs_config_basic.h and oXs_config_advanced.h files according to your needs and check carefully all options.

#ifndef OXS_CONFIG_ADVANCED_h
#define OXS_CONFIG_ADVANCED_h
#include "oXs_config_basic.h"


// --------- 1 - Telemetry protocol --------- Protocol is defined in oXs_config_basic.h file

// ****** 1.1 - Pin connected to Rx ********
#define PIN_SERIALTX 4 // The pin which transmits the serial data to the telemetry receiver, Usually pin 4 (otherwise pin 2)

// ***** 1.2 - SPORT_SENSOR_ID used (only for Frsky Sport protocol) ***** See list of available values in oXs_config_descripion.h
#define DATA_ID_VARIO 0x00 // = sensor 0 used for Alt and Vspeed
#define DATA_ID_FLVSS 0xA1 // 1 used for Cell values
#define DATA_ID_FAS 0x22 // 2 used for vfas , current and fuel
#define DATA_ID_GPS 0x83 // 3 used for GPS data
#define DATA_ID_RPM 0xE4 // 4 used for rpm, T1, T2, airspeed
#define DATA_ID_ACC 0x67 // 7 used for Acc X, Y, Z
#define DATA_ID_TX 0x0D // used to read data sent by Tx in order to adjust some oXs parameters (flow sensor or ppm)
// --------- 2 - Data to transmit ---------
// ***** 2.1 - Frsky data ***** see oXs_config_basic.h file
// ***** 2.2 - Hott data ***** see oXs_config_basic.h file
// ***** 2.3 - Multiplex data ***** see oXs_config_basic.h file
// ***** 2.4 - Jeti data ***** see oXs_config_basic.h file

// ***** 2.5 - How to fill TEST_1, TEST_2, TEST_3 ******
//define FILL_TEST_3_WITH_EXPECTED_ALT // uncomment this line if oXs has to calculate an expected Alt in the future based on current Alt, Vspeed and vertical Acc
//#define EXPECTED_ALT_AT_SEC 0.2 // time (in sec) for expected Alt (this line must be uncommented wen previous is uncommented

//#define FILL_TEST_1_2_3_WITH_LINEAR_ACC // uncomment this line if oXs has to fill TEST_1, TEST_2, TEST_3 with linear Acc

//#define FILL_TEST_1_2_WITH_VSPEED_AND_ALT_FROM_SECOND_VARIO // uncomment to activate this option

//#define FILL_TEST_1_WITH_DTE // uncomment to activate this option

//#define FILL_TEST_2_WITH_PPM_AIRSPEED_COMPENSATION // uncomment to activate this option

//#define FILL_TEST_1_WITH_YAWRATE // uncomment to activate this option

//#define FILL_TEST1_WITH_HEADING_FROM_MAGNETOMETER // uncomment to activate this option

//#define FILL_TEST_1_2_3_WITH_FLOW_SENSOR_CONSUMPTION // uncomment to activate this option

// --------- 3 - PPM settings ---------
//#define PIN_PPM 2 // Uncomment this line in order to use a Rx channel to control oXs; default is 2 but my own device use 3
//#define PPM_MIN_100 988 // default 1500 - 512 ; // pulse width (usec) when TX sends a channel = -100
//#define PPM_PLUS_100 2012 // default 1500 + 512 ; // pulse width (usec) when TX sends a channel = +100

//#define PPM_VIA_SPORT // uncomment this line to get ppm data over SPORT protocol instead of from a PWM channel (it requires a Tx with openTx running LUA script)

// --------- 4 - Vario settings --------- Type of baro is defined in oXs_config_basic.h file

// ***** 4.1 - Connecting 1 or 2 barometric sensor(s) *****
#define SECOND_BARO_SENSOR_USE NO_BARO // select between NO_BARO , MS5611

// ***** 4.2 - Type of Vspeed to transmit ***** Is defined only in oXs_config_basic.h file

// ***** 4.3 - Sensitivity predefined by program *****
#define SENSITIVITY_MIN 40 // normal value for MS5611; for BMP, it is probably better to use a lower value like 20
#define SENSITIVITY_MAX 300
#define SENSITIVITY_MIN_AT 100
#define SENSITIVITY_MAX_AT 1000

// ***** 4.4 - Sensitivity adjusted from the TX *****
//#define SENSITIVITY_MIN_AT_PPM 10 // sensitivity will be changed by OXS only when PPM signal is between the specified range enlarged by -5 / +5
//#define SENSITIVITY_MAX_AT_PPM 40
//#define SENSITIVITY_PPM_MIN 50 // common value for vario is 20
//#define SENSITIVITY_PPM_MAX 200 // common value for vario is 100

// ***** 4.5 - Hysteresis parameter & Alt compensation based on sensor temp *****
#define VARIOHYSTERESIS 5
#define ALT_TEMP_COMPENSATION 190

// ***** 4.6 - Vertical speeds calculations based on PPM *****
//#define VARIO_PRIMARY FIRST_BARO // select between FIRST_BARO, SECOND_BARO , AVERAGE_FIRST_SECOND, AIRSPEED_COMPENSATED , BARO_AND_IMU
//#define VARIO_SECONDARY AIRSPEED_COMPENSATED // select between FIRST_BARO, SECOND_BARO , AVERAGE_FIRST_SECOND, AIRSPEED_COMPENSATED , BARO_AND_IMU
//#define SWITCH_VARIO_MIN_AT_PPM 10
//#define SWITCH_VARIO_MAX_AT_PPM 90

// ***** 4.7 - Analog vertical speed *****
#define PIN_ANALOG_VSPEED 3 // Uncomment this line to get an analog voltage related to Vspeed
#define ANALOG_VSPEED_MIN -3
#define ANALOG_VSPEED_MAX 3

// ***** 4.8 - Calculating glider ratio, average sink/climb rate ******************************
#define GLIDER_RATIO_CALCULATED_AFTER_X_SEC 1 // Uncomment this line as comment if a calculation must be performed ; value must be higher or equal to 1 (sec)
#define SPEED_TOLERANCE 5 // in % of speed
#define VSPEED_MIN_TOLERANCE -200 // out of tolerance when Vspeed is lower than this value (cm/sec)
#define VSPEED_MAX_TOLERANCE -10 // out of tolerance when Vspeed is upper than this value (cm/sec)
#define GLIDER_RATIO_ON_AT_PPM -100 // Glider ratio is calculated when PPM has this value ; keep as comment when ppm is not used

// --------- 5 - Airspeed settings ---------
//#define AIRSPEED_AT_SEA_LEVEL_AND_15C // if this line is commented, airspeed is calculated using baro pressure and temperature (so being "true" airspeed instead of normalised airspeed)
//#define AIRSPEED_IN_KMH // uncomment this line if airspeed has to be in km/h instead of knot/h ( except some old versions, openTx expects knot/h)

#define AIRSPEED_RESET_AT_PPM 100

#define COMPENSATION_MIN_AT_PPM 60
#define COMPENSATION_MAX_AT_PPM 90
#define COMPENSATION_PPM_MIN 80
#define COMPENSATION_PPM_MAX 140

// --------- 6 - Voltages & Current sensor settings ---------

// ***** 6.1 - Voltage Reference to measure voltages and current *****
#define USE_INTERNAL_REFERENCE // uncomment this line if you use 1.1 volt internal reference instead of Vcc (voltage divider mst be used to reduce voltages to 1.1 volt max)
//#define USE_EXTERNAL_REFERENCE // uncomment this line if you use an external reference instead of Vcc
//#define REFERENCE_VOLTAGE 4970 // set value in milliVolt; if commented, oXs will use or 1100 (if internal ref is used) or 5000 (if internal ref is not used)

// ***** 6.2 - Voltage parameters *****
#define PIN_VOLTAGE A2 , A3 , A1 , 8 , 8 , 8 // Fill 6 values; set to 0 up to 7 for analog pins A0 up to A7 ; set the value to 8 for the voltage(s) not to be measured.
#define RESISTOR_TO_GROUND 10 , 10 , 10 , 0 , 0 , 0 // set value to 0 when no divider is used for a voltage; can contains decimals
#define RESISTOR_TO_VOLTAGE 33 , 68 , 120 , 0 , 0 , 0 // set value to 0 when no divider is used for a voltage; can contains decimals
#define OFFSET_VOLTAGE 0 , 0 , 0 , 0 , 0 , 0 // optionnal, can be negative, must be integer, in principe in mv
#define SCALE_VOLTAGE 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 // optionnal, can be negative, can have decimals

// ***** 6.3 - Max number of Lipo cells to measure (and transmit to Tx) ***** Is defined only in oXs_config_basic.h file

// ***** 6.4 - Convert voltage to temperature (° Celcius) *****
//#define FIRST_NTC_ON_VOLT_NR 1 // uncomment this line when thermistor are used; specify index of first voltage being used for conversion to temperature (e.g. 5 means VOLT_5)
#define LAST_NTC_ON_VOLT_NR 1 // specify index of last voltage being used for conversion to temperature (e.g. 6 means VOLT_6)
#define SERIE_RESISTOR 4700 // resistance connected to Arduino Vcc (in Ohm)
#define STEINHART_A 7.00111E-4 // these parameters are specific to the NTC being used.
#define STEINHART_B 2.1644E-4
#define STEINHART_C 1.0619E-07

//#define TERMISTOR_NOMINAL 100000 // nominal resistor of NTC (in Ohm) Those 3 parameters are not used anymore (replaced by STEINHART8A B and C
//#define TEMPERATURE_NOMINAL 25 // nominal temperature of NTC (in degree Celcius)
//#define B_COEFFICIENT 3950 // B coefficient of NTC

// ***** 6.5 - Current parameters *****
#define PIN_CURRENTSENSOR 1 // Arduino pin used to measure the voltage provided by a current sensor
#define MVOLT_AT_ZERO_AMP 2500 // in millivolt
#define MVOLT_PER_AMP 60 // in milliVolt per Amp
#define RESISTOR_TO_GROUND_FOR_CURRENT 0 // put as comment or set to 0 if no divider is used (e.g. 19.8 for 1.1 internal ref)
#define RESISTOR_TO_CURRENT_SENSOR 0 // put as comment or set to 0 if no divider is used (e.g 39 for 1.1 internal ref)
/*
// ***** 6.6 - Ads1115 parameters *****
#define ADS_MEASURE A0_TO_A1 , ADS_OFF , ADS_OFF , ADS_OFF // select 4 values between A0_TO_A1, A0_TO_A3, A1_TO_A3, A2_TO_A3, A0_TO_GND, A1_TO_GND, A2_TO_GND, A3_TO_GND, ADS_OFF
#define ADS_FULL_SCALE_VOLT MV2048, MV4096, MV6144, MV4096 // select between MV6144 MV4096 MV2048 MV1024 MV512 MV256
#define ADS_OFFSET 0, 0 , 0 , 0 // must be an integer (positive or negative)
#define ADS_SCALE 1, 1, 1, 1 // can be a float
#define ADS_RATE MS2 , MS9, MS9 , MS2 // select between MS137, MS69, MS35, MS18, MS9, MS5, MS3 , MS2
#define ADS_AVERAGING_ON 10 , 20, 30, 50 // number of values used for averaging (must be between 1 and 254)
//#define ADS_CURRENT_BASED_ON ADS_VOLT_1 // uncomment if current, and comsumption have to be calculated based on one of ADS voltage measurement; select then the voltage to be used between ADS_VOLT_1, ADS_VOLT_2, ADS_VOLT_3, ADS_VOLT_4
#define ADS_AIRSPEED_BASED_ON ADS_VOLT_1 // uncomment if airspeed (and dte) have to be calculated based on one of ADS voltage measurement ; select then the voltage to be used between ADS_VOLT_1, ADS_VOLT_2, ADS_VOLT_3, ADS_VOLT_4

// --------- 7 - RPM (rotations per minute) settings ---------
#define PULSES_PER_ROTATION 2

// --------- 8 - Persistent memory settings ---------
//#define PIN_PUSHBUTTON 2 // default is 10 but my own device is 2
*/
// --------- 9 - GPS ------------------------------------------------------------------------------------------------
#define GPS_SPEED_IN_KMH // uncomment this line if GPS speed has to be sent in km/h instead of knot/h (only for Frsky protocol)
#define GPS_SPEED_3D // uncomment this line if GPS speed has to be the 3d speed instead of the 2d speed (note: 3d is probably less accurate - to test)
#define GPS_REFRESH_RATE 5 // rate at which GPS sent new data; select between 1, 5 or 10 (Hz). Default = 5 Hz; Ublox NEO6 does not support 10 hz

// --------- 10 - IMU 6050 --- (accelerometer + gyro) and HMC5883 (magnetometer) --------------------------------------
// ***** 10.1 - IMU 6050 *****
#define PIN_INT_6050 2 // Interrupt from 6050 has to be connected to Arduino pin 2 or pin 3 (do not use here the same pin as PPM)

//#define DISPLAY_ACC_OFFSET // used ONLY in order to display the acceleration offset on pc terminal; KEEP AS COMMENT once offsets have been setup

//#define ACC_OFFSET_X 0 // fill here the first value reported when DISPLAY_ACC_OFFSET is activated (eg. -160)
//#define ACC_OFFSET_Y 0 // fill here the second value reported when DISPLAY_ACC_OFFSET is activated (eg. -150)
//#define ACC_OFFSET_Z 0 // fill here the third value reported when DISPLAY_ACC_OFFSET is activated (eg. -1100)

// ***** 10.2 - HMC5883 *****
//#define GENERATE_MAG_CALIBRATION_DATA // uncomment this line when HMC5883 calibration has to be performed. Set back as comment once calibration parameters have been introduced

/*#define XMAG_OFFSET 2.4683 // must be an integer
#define YMAG_OFFSET -1.3694 // must be an integer
#define ZMAG_OFFSET 138.9683 // must be an integer
#define XXMAG_CORRECTION 0.122082 // can have decimals
#define XYMAG_CORRECTION -0.00204026
#define XZMAG_CORRECTION 0.00377534
#define YXMAG_CORRECTION -0.00204026
#define YYMAG_CORRECTION 0.130413
#define YZMAG_CORRECTION -0.00491189
#define ZXMAG_CORRECTION 0.00377534
#define ZYMAG_CORRECTION -0.00491189
#define ZZMAG_CORRECTION 0.138038

// --------- 11 - Flow sensor ---------
#define PULSES_PER_ML 10.0 // number of pulses per milli liter (depends on sensor); can have decimals
#define TANK_CAPACITY 1000 // tank capacity in ml
#define INIT_FLOW_PARAM 30 , 100 , 500 , 700 , 0 , 0, 0, 0 // define at 4 levels of flow (in mliter/min) (e.g. 30, 100, 500, 700) 4 correction parameters (in %; e.g. 20, 10, -5, 15); flow levels have to be sorted from low to high
#define FLOW_SENSOR_RESET_AT_PPM 95 // when absolute value of ppm is greater than this, flow counter is reset.
*/
// --------- 20 - Sequencer ---------
//#define SEQUENCE_OUTPUTS 0b100000
#define SEQUENCE_UNIT 2
#define SEQUENCE_m100 1 , 0b100000 , 3 , 0b000000 , 1 , 0b100000 , 3 , 0b000000
//#define SEQUENCE_m75 1 , 0b100000 , 1 , 0b000000 , 2 , 0b100000 , 2 , 0b000000
//#define SEQUENCE_m50 5 , 0b100000 , 5 , 0b000000
//#define SEQUENCE_m25 5 , 0b100000 , 5 , 0b000000 , 0 , 0b100000
#define SEQUENCE_0 3 , 0b100000 , 1 , 0b000000
//#define SEQUENCE_25 2 , 0b100000 , 2 , 0b000000
//#define SEQUENCE_50 5 , 0b100000 , 5 , 0b000000
//#define SEQUENCE_75 7 , 0b100000 , 7 , 0b000000
#define SEQUENCE_100 8 , 0b100000 , 16 , 0b000000 , 24 , 0b100000 , 32 , 0b000000
//#define SEQUENCE_LOW 10 , 0b100000 ,10 , 0b000000 // sequence for Low voltage
//#define SEQUENCE_MIN_VOLT_6 4000 // sequence_100 will be activated if voltage 6 is lower that the value.
//#define SEQUENCE_MIN_CELL 3000 // sequence_100 will be activated if lowest cell is lower that the value.


// --------- xx - Reserved for developer. DEBUG must be activated here when we want to debug one or several functions in some other files. ---------
//#define DEBUG
///#define DEBUG_BLINK // use by developper in order to blink the led without using uart for debugging


#define BASED_ON_AIRSPEED 0
#define BASED_ON_GPS_SPEED 1
#define AVERAGING_DELAY_MILLISEC AVERAGING_TOLERANCE * 100

#define FIRST_BARO 1
#define SECOND_BARO 2
#define AVERAGE_FIRST_SECOND 4
#define AIRSPEED_COMPENSATED 3
#define BARO_AND_IMU 5
#define PPM_SELECTION 6

#include <Arduino.h>
struct ONE_MEASUREMENT {
uint8_t available ;
int32_t value ;
} ;

#define FRSKY_SPORT 1
#define FRSKY_HUB 2
#define FRSKY_SPORT_HUB 3
#define MULTIPLEX 4
#define HOTT 5
#define JETI 6

#define NO_BARO 1
#define MS5611 2
#define GY86 3
#define BMP085 4
#define BMP180 5
#define BMP280 6
#define GY87 7

#define NO_AIRSPEED 1
#define MS4525 2
#define MVPX7002 3

#define NO 1
#define YES 2

#define NTC 20

#define SECONDS_SINCE_T0 32
#define AVERAGE_VSPEED_SINCE_TO 33

/***************************************************************************************/
/* oXs code used by Flow sensor and for SPORT Lua scripts */
/***************************************************************************************/
#define TX_FIELD_FLOW_1 0
#define TX_FIELD_FLOW_2 1
#define TX_FIELD_FLOW_3 2
#define TX_FIELD_FLOW_4 3
#define TX_FIELD_FLOW_CORR_1 4
#define TX_FIELD_FLOW_CORR_2 5
#define TX_FIELD_FLOW_CORR_3 6
#define TX_FIELD_FLOW_CORR_4 7
#define TX_FIELD_TANK_CAPACITY 8
#define TX_FIELD_RESET_FUEL 9
#define TX_FIELD_PPM 0x10


#ifdef DEBUG
//#include "HardwareSerial.h"
#endif

#ifdef GPS_INSTALLED
//#include "HardwareSerial.h"
#endif



#ifdef FIRST_BARO_SENSOR_USE
#if (FIRST_BARO_SENSOR_USE == MS5611 ) || (FIRST_BARO_SENSOR_USE == GY86 ) || (FIRST_BARO_SENSOR_USE == BMP085 ) || (FIRST_BARO_SENSOR_USE == BMP180 ) || (FIRST_BARO_SENSOR_USE == BMP280 ) || (FIRST_BARO_SENSOR_USE == GY87 )
#define VARIO
#endif
#if (FIRST_BARO_SENSOR_USE == BMP085 ) || (FIRST_BARO_SENSOR_USE == BMP180 ) || (FIRST_BARO_SENSOR_USE == GY87 )
#define SENSOR_IS_BMP180
#endif
#if (FIRST_BARO_SENSOR_USE == BMP280 )
#define SENSOR_IS_BMP280
#endif
#endif

#ifdef SECOND_BARO_SENSOR_USE
#if SECOND_BARO_SENSOR_USE == MS5611
#define VARIO2
#endif
#endif

#if ( defined( FIRST_BARO_SENSOR_USE ) && ( (FIRST_BARO_SENSOR_USE == MS5611 ) || (FIRST_BARO_SENSOR_USE == GY86 ) )) || ( defined( SECOND_BARO_SENSOR_USE ) && ( (SECOND_BARO_SENSOR_USE == MS5611 ) || (SECOND_BARO_SENSOR_USE == GY86 ) ))
#define SENSOR_IS_MS5611
#endif

#ifdef AIRSPEED_SENSOR_USE
#if ( AIRSPEED_SENSOR_USE == MS4525 )
#define AIRSPEED
#endif
#endif


#ifdef CALCULATE_RPM
#if ( CALCULATE_RPM == YES )
#define MEASURE_RPM
#endif
#endif


#ifdef A_GPS_IS_CONNECTED
#if ( A_GPS_IS_CONNECTED == YES )
#define GPS_INSTALLED
#endif
#endif


#ifdef A_MPU6050_IS_CONNECTED
#if ( A_MPU6050_IS_CONNECTED == YES )
#define USE_6050
#endif
#endif

#ifdef A_MPU6050_IS_CONNECTED
#if ( A_MPU6050_IS_CONNECTED == YES )
#ifdef CALCULATE_YAW_WITH_HMC5883
#if ( CALCULATE_YAW_WITH_HMC5883 == YES )
#define USE_HMC5883
#endif
#endif
#endif
#endif

#if defined( DISPLAY_ACC_OFFSET ) && defined ( A_MPU6050_IS_CONNECTED ) && ( A_MPU6050_IS_CONNECTED == YES )
#define DEBUG
#endif
#if defined( GENERATE_MAG_CALIBRATION_DATA ) && defined ( A_MPU6050_IS_CONNECTED ) && ( A_MPU6050_IS_CONNECTED == YES ) && defined ( USE_HMC5883 )
#define DEBUG
#endif


#endif// End define OXS_CONFIG_ADVANCED_h




Could you please be a little more specific as how to use the Test feature ? I did not understand it completely, I was thinking it was used only for some precise parameters and not for the ones like here, for individual cell monitoring.


Thanks a lot !
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: A few issues

Post by mstrens »

I notice a mistake in this line
#define PIN_VOLTAGE A2 , A3 , A1 , 8 , 8 , 8

You should have (remove the "A")
#define PIN_VOLTAGE 2 , 3 , 1 , 8 , 8 , 8

Try first this.
Billy60
Posts: 44
Joined: Sun May 26, 2019 8:09 am
Country: -

Re: A few issues

Post by Billy60 »

Better !
On 3 of the sets with MS5611 Cels is the sum of the individual Voltages and VFAS is the 1/3 of it. Fine.
On one set with BMP 280 Cels is OK but there is no mention of VFAS. BMP seems to drift less than MS5611. The same if I reset the Telemetry on the TX, the same if I cancel all sensors and redetect them.

mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: A few issues

Post by mstrens »

VFAS is supposed to be the total voltage.
But therefore you have to say to oXs to transmit VOLT_3 as VFAS
So you should have
#define VFAS_SOURCE VOLT_3

There is no reason that BMP280 has an impact on VFAS.
Perhaps you are using another config for this device.
Billy60
Posts: 44
Joined: Sun May 26, 2019 8:09 am
Country: -

Re: A few issues

Post by Billy60 »

Michel,
Thanks for the info, I now get 'Cels' = 'VFAS' = VCC. Is it the proper value for 'Cels' ?
How do I trim each cell separately ?
How do I use the 'Test' command, it is not in the text that it can be used for Cels values...
Last, I noticed that the GPS stays in Knots per hour, inspite of ticking the proper commnd " Define GPS in km/h": howzat ?

Thanks again !
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: A few issues

Post by mstrens »

oXs transmits the voltage of each cells.

Cells is the name for the sum of all cels
If you want individual cells, just look at this video
https://www.youtube.com/watch?v=lORZGjDpZEg.

I do not understand your question about 'Test'. Can you explain more.

About GPS speed, this #define parameter is not used for Frsky protocol.
For FRsky, the units to display the data are set up on Tx side (in the Telemetry menu)
Billy60
Posts: 44
Joined: Sun May 26, 2019 8:09 am
Country: -

Re: A few issues

Post by Billy60 »

Thanks again Michel
I will have a look at the video
My question for 'test' is because in the Basic conf file only some limited possibilities are offered for the use of Test. I was thinking there would be a way to link this 'test' feature to any of the variables or at least some.
I saw for the GPS unit, indeed it is in the TX menus.
Thanks and have a good day.
Billy60
Posts: 44
Joined: Sun May 26, 2019 8:09 am
Country: -

Re: A few issues

Post by Billy60 »

Good afternoon Michel
Well, four out of five devices work fine as expected.
Only one still gives VFAS= 0V and no cels value. I used for it the same config files. I suspect something wrong in the A/D converter in the hardware (chinese clone).
For a fast glider it is not important to have the VFAS or cels values, so I use as an Alti and Vario meters only.
I ordered some new Prominis and will see then how all this turns out.
Thanks again !
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: A few issues

Post by mstrens »

Arduino have several analog pins (A0...A7).
For VFAS, you only need analog pin.
Perhaps you can change the config file in order to get only VFAS (and no cells).
So if your arduino has a defect analog pin you could still use it.
If it is the ADC internal component that is defect, there is unfortunately no solution.

Post Reply

Return to “OpenXVario - an open source vario supported by the open source firmwares!!”