Measuring DC electrical energy production from micro-renewables

Picture: is of the DC power meter on the right of the Arduino and the load controller on the left.

How it works and how to build it

The electronics and software detailed here measure quantites related to DC electrical energy production from micro-renewables. Including: Voltage, Current and Power.

It is best described in 3 main parts:

Note: Initial rough tests with this method seem good, I need to do some further calibration and more detailed tests to find out the performace and accuracy. As with the whole of the project this part is very much work in progress.

Electronics side

The electronics is divided in to 2 main parts: Voltage sensing and current sensing. Once both quantities are measured the power can then be calculated.

Here's the circuit shematic:

Note: I have made an error with the connection of the 2N3904 transistor which should be connected to the positive input terminal of the opamp not the negative one as I have in the circuit below. I will try to correct these diagrams soon. For more info have a look at the linear DC current sense pdf.

I came across the circuit design and a lot of good circuit examples of DC current sensing and advice on the linear technologies website here. The circuit above is half of the battery current monitor circuit which can be found in their DC pdf. Half is only needed since for measuring current flowing from a micro-generator to a load the current only flows in one direction. The battery monitoring circuit measures current flowing in two directions: current flowing to the battery - charging and current flowing from the battery discharging. I have built the battery monitor circuit so that I can use it for both applications if I need to. When Im measuring the total ouput of the turbine I only use half the circuit.

Here the shematic of the full battery monitor circuit. Click to enlarge.

Note: I have made an error with the connection of the 2N3904 transistors which should be connected to the positive input terminal of the opamp not the negative one as I have in the circuit below. I will try to correct these diagrams soon. 

Voltage measurment

The voltage is measured using a simple voltage divider to bring voltage within 0-5V Arduino input voltage requirments. A 12V wind turbine's voltage will vary depending on wind speed and on the load placed on the output. The output of the voltage divider is connected to analog pin 0 of the Arduino.

Im using resisor values of RVDa = 100kOhm and  RVDb=10kOhm for the voltage divider this scales the voltage down just under 11 times keeping it well withing the Arduino range.

Detailed design considerations

Current measurment

The current is measured by measuring the voltage drop across a low resistance current sensing resistor placed in between the positive terminal of the load and the positive terminal of the micro-generator (also known as high side current sensing).

This voltages is in turn amplified by the LT1495 op amp chip and the 2N3904 transistor. The LT1495 is quite an expensive chip, it would be good to find a cheaper one sacrificing on accuracy a little. The op-amp needs to be able to take above supply input voltages.

The amplified ouput voltage corresponding to the current going to the load is then connected to analog pin 1 of the Arduino.

The range of current that can be measured by the circuit is defined by Rsense, RA and RB. The output voltage needs to be again between 0 and 5V.

The Voltage out from the current sensing circuit is given by:

Taking the example of the 500W Hugh Piggot wind turbine. If the voltage at 500W is 12V then the current will be about 42Amps. I ordered my shunt from farnell and the cheapest one they had available that was rated above 42Amps was this one. Its resistance is 0.0005Ohms which dictates along with the voltage out needed the values of RA and RB. If used RA = 1k and RB = 220k which gives a voltage out of 4.62V at 42Amps.

Detailed design considerations

To build:

List of components required

1x Arduino

1x LT1495

1x 8pin DIL chip holder

1x 0.0005Ohm current sensing resitor (Rsens).

1x 220kOhm resistors for RB. (2x for battery monitor)

2x 1kOhm resistors for RA. (4x for battery monitor)

1x RVDa resistor

1x RVDb resistor

1x 2N3904 transistors. (2x for battery monitor)

1x stripboard

Wire, connectors...

Layout suggestion

Here are some closeups of the my board, if you need any guidance on layout.

Software side

On the Arduino

The Arduino reads in the signals connected to its analog input pins 0,1. It converts the analog signals to digital information which can be manipulated within the program uploaded to the Arduino.

The first step is to convert this raw analog input information into voltage and current values. The power can then be calculated simply by multiplying the voltage value with the current value.

The Voltage, Current and Power values are then sent along the USB to the computer.

This is all detailed in full in the Arduino sketch.

To implement:

  1. Download the Arduino sketch here.
  2. Compile and upload the Arduino sketch to the Arduino. For a 'How to' on compiling and uploading the sketch to the Arduino have a look here.
  3. Check that values are being sent from the Arduino in the Arduino serial monitor.

On the Computer

The ArduinoComm java program reads the values sent from the Arduino. The program outputs the values to the terminal window. Terminal is then used to write the printed data to a file for storage. The data file can be opened simultaneously by KST for real-time graphing.

To do this:

  1. Download the ArduinoComm java program here.
  2. Compile the program. For a 'How to' on compiling and running java programs have a look here.
  3. Run the program with $ java programName >tmp.dat. The addition of >tmp.dat at the end of the run command line writes the data outputed by the java program to a file for storage.
  4. Open KST for graphing.
  5. Configure KST to open the tmp.dat file.

Testing

5x 12V 10W Halogen bulbs powered by computer power supply

Using the wind turbine load/dump controller to switch on and off 5 halogen bulbs. Good way to compare measured result with multimeter readings.

Hugh piggott Wind turbines

The reason I needed a DC energy monitor.

North Wales wind turbine built on a course organised by myself and V3 Power.

Cardiff EWB wind turbine built as a training project with the Cardiff branch of Engineers Without Borders.

Both wind turbine are 12V DC machines. They can produce up to around 500W of power, about 40Amps.

For more information on Hugh Piggott and his wind turbine designs.

Pictures of the wind turbine up at a local festival in late July. It was the first test of the wind turbine energy monitoring:

Here's a video of it all working, sorry about the rushed and blurry video taking...

Monitoring the output of the wind turbine. from Trystan Lea on Vimeo.

Further Development

There are a couple of things with that arent finished with the above, the main one being a full characterisation of its accuracy and precision. But it should be in the range of the maximum number of Amps you want to measure divided by the arduino adc resolution 1024.

Update Feb 20: Myself and Suneil are going to building a second version of the above with USB datalogging a display and ethernet connection for a wind turbine installation so there will be an update soon probably in a couple of weeks. We are going to try these much cheaper shunts (Thanks goes to Matt Little for the suggestion).

Nice project Trystan I plan

Nice project Trystan I plan on encorporating this power monitor into my ECE senior design. I was wondering if it was at all possible to program the arduino and run the computer side software on windows.

Hey Nathan, it should be

Hey Nathan, it should be possible without much work, programming the arduino is the same you just download the windows version of the arduino IDE off the arduino site here: http://arduino.cc. As for the computer side software the way the computer side works is that you first read the data from the arduino with the ArduinoComm program and then access the data with a graphing program like KST. KST for windows can be downloaded here: http://kst.kde.org/. I havent tried to run ArduinoComm in windows yet but I imagine a couple of things would need to be changed to port it over to windows. If you have a look for tutorials on installing and starting with Java Development Kit that would probably be a good point to start, once youve got programs compiling and running then converting arduinoComm to run on windows hopefully wont be too much work.
Good luck with your project
Trystan

Hey Trystan, I was also

Hey Trystan, I was also wondering why your wind generator only outputs 12V as you will need around 13.5 or so to charge your battery bank. Do you have some sort of boost converter at the input of the battery bank or are you're batteries smaller then 12v?

Hey Nathan, a yes these

Hey Nathan, a yes these things are usually called either 12V, 24V, 48V turbines. The actual voltage will vary between 0 and say 14.4V for a "12V" turbine depending on the speed of rotation of the turbine. So as the wind picks up the turbine spins up and the voltage climbs up to about 13.1V  - 13.5V as you say when the batteries can start to be charged. As long as you have enough batteries they should then load the turbine in such a way as to keep the voltage from going above ideally about 13.8V. One then uses a dump load controller and dump loads to stop the voltage from climbing much higher for long lengths of time.

LT1495 alternative

For a lower-cost alternative, you might look at using one or two MAX4392 current-sense amplifiers. Not available as DIP package, though.

-jcw

As I understand the datasheet

As I understand the datasheet the LM358 will take a common mode input up to 28.5 V when running off a 5 V supply. Cheap and available in DIP. I was doodling a similar design myself the other day (for monitoring currents into and out of a battery bank via an Arduino) but I have other priorities than actually making such a thing for the moment.

Thanks Ed for the letting me

Thanks Ed for the letting me know about the amp. I had a good look through the datasheet and I couldent quite find were it said it will take a common mode input up to 28.5 V when running off a 5 V supply. It seemed to suggest it could take a common mode input that was V+ minus i think 1.5V ? I looked on farnell.
It would be really great if it can go to 28.5 its so cheap!  It looks like a great amp even if it doesnt reach 28.5 at Vsupply of 5V :)

Oops, yes, you're right, I

Oops, yes, you're right, I misread the datasheet. The input voltage can go to 32 V as a maximum rating without causing damage but the maximum for normal operation is V+ minus 1.5 V.

Re: LT1495 alternative

Thanks for the suggestion jcw, I ordered some INA139NA current sense amplifiers that were also surface mount and cheaper than the LT1495 but man were they small! I need to get myself some better soldering equipment to work with them, but yea certainly a good way to go if you dont mind soldering surface mount ic's. Once I get myself some better soldering equipment I will have another go and look at the MAX4392 thanks again for the suggestion :)
 

http://www.sparkfun.com/comme

http://www.sparkfun.com/commerce/product_info.php?products_id=494

This breakout board will help with the MAX4173.

I want to replicate what you're doing here for my solar system.
I'm just learning myself so I'm curious as to what power level forces you to use a shunt.

Does anybody know the highest wattage smaller current sensing resistors can tolerate?

Hey Noah G, thanks for the

Hey Noah G, thanks for the link.
Most of the components on the wind turbine are rated for 50Amps or above since the turbine can produce 500W at 12V hence the need for the shunt. Although a friend gave me a link to some much cheaper shunts that if I got the calculation right can take up to 32Amps and so I could put two in parallel to achive a higher rating:
http://uk.rs-online.com/web/search/searchBrowseAction.html?method=getPro...