Measuring DC current with an LT1495
Important: In the end I found the dc shunt solution below to be more expensive and less reliable than using some nice pre built modules from cool components:
Voltage and current monitoring:
Updated 24June 2010: Corrections and detailed calibration procedure
Picture: is of the DC current meter on the right of the Arduino and the load controller on the left.
This page details how to build a DC current sensing circuit using a current sensing resistor and an LT1495 opamp. It can be used for high current applications such as measuring energy production from microrenewables or low power applications by selecting suitable component values.
Current sensing resistors
There are many current sensing resistors out there, here are two suggestions. I'm using the first one at the moment but would like to try the second when I get a chance.
1x 0.0005Ohm current sensing resistor rated at max 100A. farnell
or 1x 0.005Ohm current sensing resistor rated at max 31A farnell
The LT1495 has two opamps, if you need two current sensors, the second opamp on the LT1495 can be used. You will just need 2x the other components in the circuit.
1x 470kOhm resistors for RB
2x 10kOhm resistors for RA
1x 2N3904 transistors
1x 22nf capacitor for C
The current is measured by measuring the voltage drop across a low resistance current sensing resistor. This voltage is amplified by the LT1495 op amp chip and the 2N3904 transistor. The amplified ouput voltage is then connected to an Arduino analog input.
The range of current that can be measured by the circuit is defined by Rsens, RA, RB and the Arduino analog reference voltage.
The Voltage out from the current sensing circuit is given by:
Note: I will add a worked example here soon.
The Arduino Sketch
The Arduino along with the arduino sketch reads in the ADC value that corresponds to the voltage at the analog input pin. It then converts the ADC value into a current value. The current sensor dc library is intended to make all this a little more straight forward. The main commands to get the sensor up and running are:
Include the library:
Create a DC sensor: nameOfSensor( the analog input pin, calibration value m, calibration value c):
CurrentSensorDC sensorA( 0 , 1.0 , 0.0 );
Returns the current value as a floating point number:
Download the CurrentSensorDC library here: CurrentSensorDC.tar.gz
Download the Arduino Sketch here: CurrentSensorDCExample.tar.gz
Copy the library to your Arduino/Libraries folder and compile+upload the Sketch to the Arduino.
If you now go to the Arduino Serial monitor you should see a stream of floating point values.
At this point the program is not calibrated, the output corresponds to the ADC value. So to see current values the next step is:
2 point calibration procedure.
1) Take a reading from arduino monitor and reference meter (digital multimeter dmm) at 0 current.
For example: Emon: 1.70 dmm: 0.00A
2) Take a reading from arduino monitor and reference meter (dmm) at a current value close to the maximum current you intend to measure.
For example: Emon: 182.5 dmm: 8.08A
3) Use the equation of a straight line (y=mx +c) to find the calibration.
y1 = dmm 0 current. y2 = dmm max current.
x1 = emon value at 0 current x2 = emon value at max current
y1 = m x1 + c : y2 = m x2 + c
Rearranging to find m and c:
m = (y2 – y1) / (x2 – x1) and c = y1 – m x1
With the example values from set one and two the calibration values are:
m = 0.044690265 : c = −0.075973451
4) Insert the calibration values into the Arduino sketch at the following lines:
CurrentSensorDC sensorA(0, m , c );
If all is well, you should now read current!
I obtained the following accuracy below with circuit configured for 0 to 46Amps, but test range 0 - 10A due to max 10A range of DMM.
I tested 8 points along the 0 to 10A range so by no means a comprehensive test, but useful indication of accuracy none the less.
Standard deviation of the error: 0.01A
Maximum error: 0.02A
It would be good to explore use of cheaper shunts linked above.
The LT1495 circuit above is adapted from the linear technologies application notes on DC current sensing that can be found here (There's also a lot of other interesting info there too):
Good article on high versus low side current sensing:
Low-side vs. high-side current sensing by Arpit Mehta
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 in late July 2009. 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...