Espeasy mega right formula for INA219 current

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
planedo79
Normal user
Posts: 23
Joined: 10 Apr 2020, 12:22

Espeasy mega right formula for INA219 current

#1 Post by planedo79 » 10 Apr 2020, 18:10

Hi,

I have an Ina219 and a wemos d1 mini. I got done the correct wiring and and the sensor gets the current value. I measure the battery current. However, the value is incorrect. The multimeter gives a higher value than ina219. Is there any syntax espeasy formula line with which I could get calibrated to the correct value and what variables are needed for syntax? % value% + 0.130 Is this correct or can it be written in a more professional way?

Newbie question I guess..
Attachments
15865349102191203812756145803432.jpg
15865349102191203812756145803432.jpg (3.49 MiB) Viewed 14277 times
15865346562483992012884159467476.jpg
15865346562483992012884159467476.jpg (2.06 MiB) Viewed 14277 times
Screenshot_20200410_151129_com.android.gallery3d.jpg
Screenshot_20200410_151129_com.android.gallery3d.jpg (151.69 KiB) Viewed 14277 times

TD-er
Core team member
Posts: 8747
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Espeasy mega right formula for INA219 current

#2 Post by TD-er » 10 Apr 2020, 19:33

You can apply the calibration in the formula field and indeed it is probably something like this:

Code: Select all

%value% + 0.130
As advice.
Try to measure a few currents with both the multimeter and the INA219 in series and see if it is a constant offset.
I would expect the offset to be linear, and not a simple offset.
So more something like this:

Code: Select all

%value% * 1.05
(5% as a random example)
The used shunt does have a tolerance so I would expect you should only correct for that tolerance. A constant offset is not something I would expect.

User avatar
ThomasB
Normal user
Posts: 1065
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Espeasy mega right formula for INA219 current

#3 Post by ThomasB » 10 Apr 2020, 20:21

A 130mA offset seems excessive for the circuit shown in the photo. As a sanity check, please provide the measurement's variation when you compare the DMM's reading to the INA219A.
Meter = ? mA (in series with battery lead, input of Vreg)
INA219 = ? mA

Be sure to record the INA219A current while the DMM is still wired in series with the battery.

- Thomas

TD-er
Core team member
Posts: 8747
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Espeasy mega right formula for INA219 current

#4 Post by TD-er » 10 Apr 2020, 20:49

Well, if the leads in the photo are used to draw a (significant) current, then I guess the voltage has dropped significantly when it arrives at the consumer.
If that consumer is a resistive load, then the measured current can be quite a bit lower.

So make sure (as also said by Thomas) to measure the current with both the multimeter and the INA219 in series.
Otherwise it is impossible to find a proper calibration offset.

Wiki
Normal user
Posts: 413
Joined: 23 Apr 2018, 17:55
Location: Germany

Re: Espeasy mega right formula for INA219 current

#5 Post by Wiki » 11 Apr 2020, 05:20

...and never ever try to calibrate a voltage/current sensor using a breadboard and think your results would be reliable - it will be an endless story. Take the readings at the momen as they are. Calibration of voltage/current readings only makes sense in a ready soldered circuit, believe it.

But nevertheless, playing around with a breadboard following the suggestions of ThomasB and TD-er is a pretty good practice for a lateron following reliable calibration.

Code: Select all

pi@raspberrypi:~ $ man woman
No manual entry for woman
pi@raspberrypi:~ $

User avatar
dynamicdave
Normal user
Posts: 257
Joined: 30 Jan 2017, 20:25
Location: Hampshire, UK

Re: Espeasy mega right formula for INA219 current

#6 Post by dynamicdave » 11 Apr 2020, 09:49

I've just lashed up a INA219 with a Wemos D1 Mini (FW=mega-20191003) and get correct readings

I've got a 330 ohm resistor across the 3v3 rail (so the current should be 10mA).

As you can see from the screen-shots the current is 10mA.

The only differennce I can see is I'm using a "Measure range" of 16V, 0.4A

PS:
I've just flashed the Wemos with mega-20200410 and the INA219 gives correct readings on all settings,
so it might be worth trying that.
ScreenShot027.png
ScreenShot027.png (32.02 KiB) Viewed 14229 times
ScreenShot026.png
ScreenShot026.png (19.1 KiB) Viewed 14229 times

planedo79
Normal user
Posts: 23
Joined: 10 Apr 2020, 12:22

Re: Espeasy mega right formula for INA219 current

#7 Post by planedo79 » 11 Apr 2020, 17:47

Wiki wrote: 11 Apr 2020, 05:20 ...and never ever try to calibrate a voltage/current sensor using a breadboard and think your results would be reliable - it will be an endless story. Take the readings at the momen as they are. Calibration of voltage/current readings only makes sense in a ready soldered circuit, believe it.

But nevertheless, playing around with a breadboard following the suggestions of ThomasB and TD-er is a pretty good practice for a lateron following reliable calibration.

Yes, I think it was the case here. No after I soldered all parts /wiring it seems the values are right. Thank you for support.

planedo79
Normal user
Posts: 23
Joined: 10 Apr 2020, 12:22

Re: Espeasy mega right formula for INA219 current

#8 Post by planedo79 » 11 Apr 2020, 17:51

dynamicdave wrote: 11 Apr 2020, 09:49 I've just lashed up a INA219 with a Wemos D1 Mini (FW=mega-20191003) and get correct readings

I've got a 330 ohm resistor across the 3v3 rail (so the current should be 10mA).

As you can see from the screen-shots the current is 10mA.

The only differennce I can see is I'm using a "Measure range" of 16V, 0.4A

PS:
I've just flashed the Wemos with mega-20200410 and the INA219 gives correct readings on all settings,
so it might be worth trying that.

ScreenShot027.png
ScreenShot026.png
Thank you for information, I will give it a try.

planedo79
Normal user
Posts: 23
Joined: 10 Apr 2020, 12:22

Re: Espeasy mega right formula for INA219 current

#9 Post by planedo79 » 11 Apr 2020, 17:53

ThomasB wrote: 10 Apr 2020, 20:21 A 130mA offset seems excessive for the circuit shown in the photo. As a sanity check, please provide the measurement's variation when you compare the DMM's reading to the INA219A.
Meter = ? mA (in series with battery lead, input of Vreg)
INA219 = ? mA

Be sure to record the INA219A current while the DMM is still wired in series with the battery.

- Thomas
I think it was too this wires and loose connections. After soldering values changed close to the DMM readings. Thanks.

planedo79
Normal user
Posts: 23
Joined: 10 Apr 2020, 12:22

Re: Espeasy mega right formula for INA219 current

#10 Post by planedo79 » 11 Apr 2020, 18:11

I made few changes (battery voltage I measured from wemos A0 pin, and INA219 sensor is for solarpanel current reading), and I got it running now. Thanks all!
(Added some pictures if someone is interested doing similar project)
Attachments
domoticz.jpg
domoticz.jpg (148.76 KiB) Viewed 14209 times
INA219 under the pcb between CN3791 and Wemos
INA219 under the pcb between CN3791 and Wemos
mounted pcb.jpg (190.91 KiB) Viewed 14209 times
Finished result
Finished result
enclosure+sensor+solarpanel.jpg (48.44 KiB) Viewed 14209 times
Schematics
Schematics
lake_water_temperature_solarpowered.jpg (133.01 KiB) Viewed 14209 times

Post Reply

Who is online

Users browsing this forum: No registered users and 35 guests