Answer the question
In order to leave comments, you need to log in
How to calculate consumption (amps or watts per hour)?
I assembled a device on arduino and INA219, where you can measure current and voltage many times per second.
How to calculate how much energy the device consumed?
For example, I measure 100 times per second.
It gives the current value of consumption in amperes.
How to calculate how much energy the device consumed during these 100 measurements?
Then we write these values into a variable.
Then all the measurements for an hour must somehow be added together and the value entered into a new variable.
Answer the question
In order to leave comments, you need to log in
What you are going to do is called integration. Direct numerical integration is done by calculating the value of the function, multiplying it by the time interval and adding it to the total sum (integral).
In this case, you need to know exactly the number of value samples per second (you have 100, the time interval is 10 milliseconds). This means that in each cycle you calculate the energy you are interested in (multiply the voltage by the current and by 10 ms), you get a quantum of consumed energy and this quantum is added to the previous measurements 100 times per second. This sum will be the required energy. If you arrange a display of its value on the indicator, you will see how it grows in real time.
Please note - you need to multiply by 10 ms, not divide. These are your amps or watts per hour- it's not energy. However, I have already commented on this.
multiply the average value by the number of seconds. in an hour
(add FSE and divide by the number of terms)
:=)
Grade 4-8 of mathematics, school curriculum
If the current is alternating, then it is necessary to consider the integral under the curve U * I * (cos phi), i.e. after multiplying the instantaneous values, taking into account the phase shift (this will be the instantaneous active power), you also multiply by the time interval (1/100 sec) and sum everything up - this will be the energy consumed.
First, decide what exactly you want to measure.
Because there is simply no "consumption", there is "consumed energy", for example.
Secondly, in "amperes" the magnitude of the current is measured. Instantaneous, average (if you average many values by adding all measurement values and dividing by the number of measurements).
Thirdly, it is possible to calculate something that is measured in "Watt/hour", you probably mean " kWh ". Well, or another unit, for example - W * s \u003d Joule, which, in fact, measures the energy consumed.
And then - read the article about power .
All you have to do is sum up your measurements.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question