== Current sensor support in openXvario ==
There are plenty of real cheap current sensor modules available on eBay from far east sellers. Prices start at something between 2 and 3€ for a bidirectional current sensor in the +/- 5A,20A or 30A range.
Now you can directly connect these cheap current sensor modules to your openXvario.
this is a +-5A sensor repackaged for use in one of my DLG Gliders:
In open9x/openTx/Frsky Taranis this should enable the following telemetry fields:
CNSP => the consumed capactiy in mAh (calculated from current+time)
Curr => the current being measured
Watt => the current power... ( a measured voltage measured via A1/A2 as well)
== Connecting the current sensor modules to your openXvario ==
Code: Select all
Arduino GND --------------------- Current Sensor Module GND
Arduino VCC --------------------- Current Sensor Module VCC
Arduino A2 --------------------- Current Sensor Module OUT
the oXv expects a uni or bi-directional current sensor with a linear voltage output representing the measured current.
most current sensor should be OK for this.
the sensors i tested can be powered directly from the arduino boards GND+VCC pin for this they have to accept an input voltage of 5V
A current sensor with a linear voltage relative to the measured output can be connected to the openXvario.
This has been tested using 3 different types of ACS712 Current sensor modules that can be purchased for 2-3€ from various far east ebay sellers.
these modules are bidirectional sensors
== Configuring the openXvario code for the current Sensor ==
the following section of the source code can be modified to configure the parameters needed for the current sensor functionality
Code: Select all
/***************************************************************************************/
/* Optional Feature Current Mesaurement */
/* Uncomment the #define sendCurrent toenable this feature. */
/***************************************************************************************/
#define SendCurrent // Uncomment to enable a connected Current Sensor
#define MinCurrentMilliamps -37879 // the lowest measured current (=0v input voltage)
#define MaxCurrentMilliamps 37879 // the hioghest measured current (= input voltage= vRef)
#define ForceAbsolutCurrent // If defined, all measured current values will be forced to be positive (e.g.:-4.5A => +4.5A)
//Here are some example values for standard ACS712 types of sensors
// Sensor Type Min Max
// -5A .. +5A -13510 13510
// -20A .. +20A -25000 25000
// -30A .. +30A -37879 37879
The pin to connect the signal line from the sensor module can be configured by changing this line in the config section:
Code: Select all
#define PIN_CurrentSensor 2 // the Analog pin the optional current Sensor is connected to
== calculating the min/max values for other sensor types ==
i prepared a little spreadsheet you can use to calculate the min/max values for other sensor types.
you can download the spreadsheet here: https://openxvario.googlecode.com/svn/w ... nsors.xlsx
If you tested/calculated other ready available modules drop me a line and i add them to the spreadsheet
== Capacity Measuring ==
as the current implementation of the current metering & mAh calculation in openTx only works with a resolution of 100mAh, i have implemented a openXvario internal capacity calculation with a higher precision. This can be used to calculate capacities down to a mAh scale. The count of capacity will be started with 0mAh each time the oXv gets powered up. The calculated value can be transmitted in the DIST field to openTX by uncommenting the following define:
Code: Select all
#define SEND_mAhAsDist
Have fun,
Rainer