Calculating kWh from Amps+Volts

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
mitrus
New user
Posts: 3
Joined: 11 Dec 2018, 15:09

Calculating kWh from Amps+Volts

#1 Post by mitrus » 11 Dec 2018, 15:19

Hallo

I have INA219 current measurement device connected to ESP Easy and I'm able to read current.
Circuit works in 12V, currents are between 0A and 1A.
Im able to sent current current value each 60s to my database.
Is it possible that ESP Easy will measure current in each cycle and sum this to power consumption presented in Wh(kWh) and then send to database?
What formula I should use?

thanks
Peter

xury
Normal user
Posts: 44
Joined: 02 Apr 2018, 12:54

Re: Calculating kWh from Amps+Volts

#2 Post by xury » 11 Dec 2018, 15:50

I don't think so.

To compute kWh from recent instantaneous power you have to calculate derivative.
What a database you use?
I had influxdb with grafana and is possible with it. But you have to set a server machine.
grafana.jpg
grafana.jpg (165.26 KiB) Viewed 10882 times

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Calculating kWh from Amps+Volts

#3 Post by grovkillen » 11 Dec 2018, 16:28

But momentary usage in W is better to display, I only plot W. And as @xury is saying, you need to derive W over time for the Wh.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

mitrus
New user
Posts: 3
Joined: 11 Dec 2018, 15:09

Re: Calculating kWh from Amps+Volts

#4 Post by mitrus » 11 Dec 2018, 17:21

The problem is that consumption can take only 30 sec i.e. or sometimes 30min I'm using NETTEMP project. And to have nice plot and calculate this later it would be good to have 1s interval and I'm afraid this frequency will kill my SD card in RPi that's why I want that esp will sum this and then send value to db exactly how it works with counters.

I presented only example because oryginal idea is to measure current used for coil modulation in gas heater and then try to calculate gas usage.

P.s. Ładny domoticz. Też się zastanawiam nad przejściem ale Nettemp już znam do podszewki 😂

moebius
Normal user
Posts: 35
Joined: 22 May 2017, 19:36

Re: Calculating kWh from Amps+Volts

#5 Post by moebius » 11 Dec 2018, 17:54

- you could move the db to a ramdisk
- node-red is also an option

xury
Normal user
Posts: 44
Joined: 02 Apr 2018, 12:54

Re: Calculating kWh from Amps+Volts

#6 Post by xury » 11 Dec 2018, 21:33

So you have to feature request Nettemp developers for derive and difference functions over time.
Tu calculate kWh need stored all momentary values over the time. Espeasy doses not have a storing database, so calculate derivative is not possible without stored data. Data store is not possible without database. Closed circle.

PS. To nie Domoticz to Grafana. Z Domoticza są tylko pobierane dane.
Pozdrawiam krajana :)

kimot
Normal user
Posts: 190
Joined: 12 Oct 2017, 20:46

Re: Calculating kWh from Amps+Volts

#7 Post by kimot » 11 Dec 2018, 22:34

I think only solution with ESPeasy is set TImer to 5 or 10s interval.
If Timer triggers, measure current, calculate Watts and then you have got energy in "W10s".
Sum this 6 times and got Wmin.
Then send to Domoticz.
But you must do lot off calibration, because 10s timer is not exactly 10s and each interval is
a little different.

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Calculating kWh from Amps+Volts

#8 Post by grovkillen » 12 Dec 2018, 06:13

Of course a external EEPROM module might be the way to go, but that is not yet implement and after that a generic way of aggregating data over time is needed. We're still trying to release a first stable release and aim for this year ;)
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

mitrus
New user
Posts: 3
Joined: 11 Dec 2018, 15:09

Re: Calculating kWh from Amps+Volts

#9 Post by mitrus » 12 Dec 2018, 12:17

@grovkillen it's good to know that project is working around this.
Thanks to all for ideas, propably my solution will be this time own application for ESP where I'll read 60 times current value and process this to kwh then sond once minute portion to database. My question wa only that maybe this kind of alghoritm can be implemented already in Esp Easy by some addons. scripts etc.

StefanD
Normal user
Posts: 21
Joined: 28 Jan 2017, 20:07

Re: Calculating kWh from Amps+Volts

#10 Post by StefanD » 17 May 2019, 07:40

Hi,
And sorry for delay in answering...
If you look at the datasheet of INA 219 you will see that in the registers it is available also power calculation not only current and voltage. In order to display power in Espeasy the plugin must be modified and this is quite simple...
Best regards
Stefan D.

rayE
Normal user
Posts: 144
Joined: 12 Oct 2017, 12:53
Location: Philippines

Re: Calculating kWh from Amps+Volts

#11 Post by rayE » 17 May 2019, 13:03

I use SonOff POW so the instantaneous power is already calculated. This is how i calculate kwh...........

1. Take power reading every 5S and store in a dummy var (accumulator)
2. On the next sample add to the dummy var (accumulator).
3. After 6 samples divide the dummy var by the number of samples.
4. Send this to ThingSpeak every 30 seconds.

At the thing speak end i set up the kwh graph to average the present hours readings. With proper calibration im getting around +/- 2.5% accuracy compared to the sites main electric meter.

See here for my real time power monitoring.

https://thingspeak.com/channels/763964


Ray

Post Reply

Who is online

Users browsing this forum: No registered users and 19 guests