This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
OpenPlotter I2C 3.x.x - INA219 settings
#9
This is what the python adafruit script does at startup:

Code:
     
       self._cal_value = 0
       self._current_lsb = 0
       self._power_lsb = 0
       self.set_calibration_32V_2A()

It sets to 0 the calibration values but immediately sets the default mode set_calibration_32V_2A with these values assuming there is a 0.1 shunt resistor:

Code:
self._cal_value = 4096
self._current_lsb = 0.1
self._power_lsb = 0.002

self.bus_voltage_range = BusVoltageRange.RANGE_32V
self.gain = Gain.DIV_8_320MV
self.bus_adc_resolution = ADCResolution.ADCRES_12BIT_1S
self.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_1S
self.mode = Mode.SANDBVOLT_CONTINUOUS

I will check the signal k plugins to see how they manage calibration and the possibility of checking from openplotter if they are competing for the device.

Currently openplotter users can only use the sensor for set_calibration_32V_2A with the built 0.1 shunt resistor, so I do not think anyone is using it. If you agree I could add these settings as "sensor settings" to openplotter:

_current_lsb:
   float values allowed
_cal_value:
   float values allowed
_power_lsb:
   float values allowed

bus_voltage_range:
    RANGE_16V
    RANGE_32V
gain:
    DIV_1_40MV
    DIV_2_80MV
    DIV_4_160MV
    DIV_8_320MV
bus_adc_resolution:
    ADCRES_9BIT_1S
    ADCRES_10BIT_1S
    ADCRES_11BIT_1S
    ADCRES_12BIT_1S
    ADCRES_12BIT_2S
    ADCRES_12BIT_4S
    ADCRES_12BIT_8S 
    ADCRES_12BIT_16S
    ADCRES_12BIT_32S
    ADCRES_12BIT_64S
    ADCRES_12BIT_128S
shunt_adc_resolution:
    same as bus_adc_resolution
mode:
    POWERDOWN
    SVOLT_TRIGGERED
    BVOLT_TRIGGERED
    SANDBVOLT_TRIGGERED
    ADCOFF
    SVOLT_CONTINUOUS
    BVOLT_CONTINUOUS
    SANDBVOLT_CONTINUOUS

The default value of these exposed variables will be set_calibration_16V_5A instead of set_calibration_32V_2A and you will be able to play with it using the html tool to calculate different modes.
Reply


Messages In This Thread
RE: I2C INA 3.1.0 Settings - by tobias.e - 2022-11-12, 08:03 PM
RE: I2C INA 3.1.0 Settings - by Sailoog - 2022-11-12, 08:23 PM
RE: I2C INA 3.1.0 Settings - by tobias.e - 2022-11-12, 09:55 PM
RE: I2C INA 3.1.0 Settings - by RichFind - 2022-11-14, 03:31 AM
RE: OpenPlotter I2C 3.x.x - INA219 settings - by Sailoog - 2022-11-15, 12:23 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)