You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wasn't getting linear discharge graphs on a 12v battery discharge. I am a novice but I found the solution to the problem on the Adafruit forum. I don't how to go about modifying the software but here is the fix that worked for me:
To overcome the issue of 8 bit voltage and read bus voltage down to millivolts resolution apply the following changes to the file "Subfact_ina219.py"
FIND LINES
def getBusVoltage_raw(self):
result = self.i2c.readU16(self.__INA219_REG_BUSVOLTAGE)
"# Shift to the right 3 to drop CNVR and OVF and multiply by LSB
return (result >> 3) * 4"
I did not see the above change in the latest Subfact_ina219.py
I use a different I2C class that has a default endian (not the included Adafruit_I2C.py).
The above change has the endian specified in the readList manipulation of bytes.
It is a superior solution as readList is always the same, while readU16 can be different.
I manually added the above change, as I needed it.
I wasn't getting linear discharge graphs on a 12v battery discharge. I am a novice but I found the solution to the problem on the Adafruit forum. I don't how to go about modifying the software but here is the fix that worked for me:
To overcome the issue of 8 bit voltage and read bus voltage down to millivolts resolution apply the following changes to the file "Subfact_ina219.py"
FIND LINES
def getBusVoltage_raw(self):
result = self.i2c.readU16(self.__INA219_REG_BUSVOLTAGE)
"# Shift to the right 3 to drop CNVR and OVF and multiply by LSB
return (result >> 3) * 4"
REPLACE WITH
def getBusVoltage_raw(self):
result = self.i2c.readList(self.__INA219_REG_BUSVOLTAGE,2)
if (result[0] >> 7 == 1):
testint = (result[0]*256 + result[1])
othernew = self.twosToInt(testint, 16)
return othernew
else:
return (result[0] << 8) | (result[1])
FIND LNES
def getBusVoltage_V(self):
value = self.getBusVoltage_raw()
return value * 0.001
CHANGE MAGNITUDE MULTIPLIER TO 0.0005 AS BELOW
def getBusVoltage_V(self):
value = self.getBusVoltage_raw()
return value * 0.0005
The text was updated successfully, but these errors were encountered: