wollewald / INA219_WE

An Arduino library for the INA219 current sensor module.

Home Page:https://wolles-elektronikkiste.de/en/ina219-current-and-power-sensor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

in function : getShuntVoltage_mV()

renejeanmercier opened this issue · comments

Correct me if I am wrong. In Function : getShuntVoltage_mV(), I believe that it should read: + shuntVoltageOffset.

float INA219_WE::getShuntVoltage_mV(){
int16_t val;
val = (int16_t) readRegister(INA219_SHUNT_REG) + shuntVoltageOffset;
if((abs(val))== shuntOverflowLimit){
overflow = true;
}
else{
overflow = false;
}
return (val * 0.01);
}

Hi @renejeanmercier,
when I implemented the offset I thought that it was a good idea to still get the original shunt voltage from getShuntVoltage_mV(). But it is simply confusing. I changed it now and released a new version.
The calculation, however, is a bit different since the offset is in millivolts and it needs to be subtracted. I implemeneted in the return statement:
return ((val * 0.01) - shuntVoltageOffset)

Merci!

Hello Mr. Ewald,

Thank you for your reply. And also thank you for your contribution to this VERY useful library.

I don't know if you watch Robert's Smorgasbord on YouTube. A German, very versatile, YouTuber that I really appreciate :-).

My best regards,

Rene-Jean Mercier

Thank you for the YouTube recommendation. I had a short look and it seems very interesting.

I close the issue now.

Best wishes, Wolfgang Ewald