RobTillaart / INA228

Arduino library for INA228 current and power sensor
MIT License
1 stars 2 forks source link

Update INA228.cpp #5

Closed xkachya closed 3 weeks ago

xkachya commented 3 weeks ago

Updated getTemperature() resolution multiplier to read the correct values.

Capture

I can see the correct Temperature after the update (top left corner)

image

RobTillaart commented 3 weeks ago

Thanks for this PR, will work on it asap.

RobTillaart commented 3 weeks ago

Thanks for catching this error, will merge it into master. As you apparently have hardware (I still do not) I wait with updating the version as you might find some more errors.

Again thanks for your fix, appreciated!

RobTillaart commented 3 weeks ago

The display looks cool. Do you know why the current mA is so high? might point to another error in the code.

xkachya commented 3 weeks ago

I am glad to help you (and myself as a user) I've just started to use this library in my application.

In my opinion, the reason for the Current issue could be:

I will let you know if I find any other issues.

More details regarding the sensor module I'm using can be found at https://vi.aliexpress.com/item/1005006987156355.html

My goal is to measure and estimate the working time of the ESP32 device in the power mode circle "deep sleep - regular" from one 18650 battery.

So, I need to be able to measure the Current 1mA or even 0.1mA

I have another application that uses INA231 image

image

I'm planning to use both to confirm measurements of each other.

RobTillaart commented 3 weeks ago

Nice!

wrong conversion float-to-string in the FloatToString function (on my side)

Have a look at - https://github.com/RobTillaart/printHelpers It includes for scientific notation, engineering (power is multiple of 3) and several other formats.


I'm planning to use both to confirm measurements of each other.

What is good is that you use different devices / code. So the same (code) error does not happen twice. However you should use three, then if there is a disagreement you can choose the value that pops up twice. Doing a new measurement is of course also an option.


I have another application that uses INA231

Do you use a library for that? link? There are at least a few dozen INAxxxx current sensors that look alike

RobTillaart commented 2 weeks ago

@xkachya

Created a develop branch and a PR to release version 0.1.2 including your fix (and some minor documentation), Are there other things that need to be fixed or clarified or are missing or ....?

xkachya commented 2 weeks ago

Hi Rob, yes I have something to update. I was finally able to get the correct measurement of the Current. I've updated getCurrent() and setMaxCurrentShunt() on my local copy. But this fix is not as simple as the previous one. For sure getCurrent() and setMaxCurrentShunt() needs to be updated and _writeRegister() In my project, I've used for debugging "adafruit/Adafruit BusIO@^1.16.1" I'm working on this commit.

RobTillaart commented 2 weeks ago

I hope to find some time coming week / next weekend to put some hands on the INA228. (Other projects + libs keep me quite busy)