user76: I have a project that I'm currently working on. We have built a green wall, wich consists of plants on a wall

Now, we have a pump situated at the bottom that waters all the plants. There is an arduino board that decides when to put the pump on. Powering it is a solar panel and wind turbine. We want to know how much energy we have saved by using the solar panel and turbine.
Question:
How do I measure the amount of energy, in Wh, used from 00h00 that day? Is there a library? Or is this not possible with Arduino?
Thanks a lot.
To clear up some things
No, the pump is not fueled directly by the Arduino pin. We are using a motor shield.
Yes, there is an accumulator in the circuit. The solar and wind power recharge a battery which in turn powers the components.
I would like to know the entire energy consumed, not just the pump.

user467: In order to calculate the amount of energy you have to calculate the power first.
The relation is 
Energy = (Power * Time of usage)
How to calculate the power?
The voltage for each device in the system is constant. What changes is the current withdrawal in each component in the project.
The main thing you have here is the pump and how much does it consume current.
Usually, you will have on the "plate" of the pump the current withdrawal of it.
Say it consumes 2 Amps.
If that is not available there, use a DMM "Digital Multimeter" and connect in series with the pump and measure the amount of current.
If there are any other major/important components in your project just calculate the current withdrawal from them.
Now add up all the currents and say you ended up with 2 Amps.
If all the components are operating at the same voltage, just multiply the total amount of current withdrawal by the voltage.
WHY?
Because:
P(power) = V(voltage)   * I(current)
If not, just find the power of each component.
Add up all the powers of all you components.
Now you will only have to calculate the energy.
E(Energy) = Power * time
Time here refers to how long is your system working?
Is it a full day, couple of hours. IT doesn't matter. Usually to make things easier use time (in terms of hours).
Say your power ended up with 3kW kilo Watt
You've run the system for 2 hours every day
Energy = 3 * 2 = 6 kWh
If you've kept this for a full month.
Energy save in a month = 180kWh.
Just find out how much do the ministry cost for each kWh, and you'll know how much money you've saved!

user643: There are some chip that measure current flow (like ACS714). Just be sure to buy a chip that will not fry under your load, and mount it in serie with the pump. That chip will bring an analog (but there a re "smarter" chip witch use i2c or spi) signal to arduino, using the formula on the datasheet you can find out real (well, as always there are small error) current flow. 
You should already know the voltage of the pump, but you can easily read it with a similar chip or even a voltage divider, just pay attention if you are using PWM as if it will fake your reading)
Now, as already pointed out by Adel Bibi, you can multiply the voltage of the pump with the current value readed (find power), multiply with the time elapsed from the last measure and sum up with precedent measure (integral of the power by time)
you can do the same on the wind/solar panel, just invert the sign of the current (as you are Producing and not Consuming power) and voilà!

76: <p>I have a project that I'm currently working on. We have built a green wall, wich consists of plants on a wall</p>

<p><img src="https://i.stack.imgur.com/iIhSW.jpg" alt="Green wall"></p>

<p>Now, we have a pump situated at the bottom that waters all the plants. There is an arduino board that decides when to put the pump on. Powering it is a solar panel and wind turbine. We want to know how much energy we have saved by using the solar panel and turbine.</p>

<p><strong>Question:</strong></p>

<p>How do I measure the amount of energy, in Wh, used from 00h00 that day? Is there a library? Or is this not possible with Arduino?</p>

<p>Thanks a lot.</p>

<p><strong>To clear up some things</strong></p>

<p>No, the pump is not fueled directly by the Arduino pin. We are using a motor shield.</p>

<p>Yes, there is an accumulator in the circuit. The solar and wind power recharge a battery which in turn powers the components.</p>

<p>I would like to know the entire energy consumed, not just the pump.</p>
 467: <p>In order to calculate the amount of energy you have to calculate the power first.</p>

<p>The relation is </p>

<p>Energy = (Power * Time of usage)</p>

<p>How to calculate the power?</p>

<p>The voltage for each device in the system is constant. What changes is the current withdrawal in each component in the project.
The main thing you have here is the pump and how much does it consume current.
Usually, you will have on the "plate" of the pump the current withdrawal of it.</p>

<p>Say it consumes 2 Amps.
If that is not available there, use a DMM "Digital Multimeter" and connect in series with the pump and measure the amount of current.</p>

<p>If there are any other major/important components in your project just calculate the current withdrawal from them.</p>

<p>Now add up all the currents and say you ended up with 2 Amps.</p>

<p>If all the components are operating at the same voltage, just multiply the total amount of current withdrawal by the voltage.
WHY?
Because:
P(power) = V(voltage)   * I(current)</p>

<p>If not, just find the power of each component.
Add up all the powers of all you components.</p>

<p>Now you will only have to calculate the energy.</p>

<p>E(Energy) = Power * time</p>

<p>Time here refers to how long is your system working?
Is it a full day, couple of hours. IT doesn't matter. Usually to make things easier use time (in terms of hours).</p>

<p>Say your power ended up with 3kW <em>kilo Watt</em>
You've run the system for 2 hours every day
Energy = 3 * 2 = 6 kWh</p>

<p>If you've kept this for a full month.
Energy save in a month = 180kWh.</p>

<p>Just find out how much do the ministry cost for each kWh, and you'll know how much money you've saved!</p>
 643: <p>There are some chip that measure current flow (like ACS714). Just be sure to buy a chip that will not fry under your load, and mount it in serie with the pump. That chip will bring an analog (but there a re "smarter" chip witch use i2c or spi) signal to arduino, using the formula on the datasheet you can find out real (well, as always there are small error) current flow. </p>

<p>You should already know the voltage of the pump, but you can easily read it with a similar chip or even a <a href="http://en.wikipedia.org/wiki/Voltage_divider" rel="nofollow">voltage divider</a>, just pay attention if you are using PWM as if it will fake your reading)</p>

<p>Now, as already pointed out by Adel Bibi, you can multiply the voltage of the pump with the current value readed (find power), multiply with the time elapsed from the last measure and sum up with precedent measure (integral of the power by time)</p>

<p>you can do the same on the wind/solar panel, just invert the sign of the current (as you are Producing and not Consuming power) and voilà!</p>
