Reference Pages:
Thoughts on how to format AttoPilot sensor data for reporting to the Nagios Renewable Energy Monitor.
Figuring out how to understand and calibrate the AttoPilot's output so that I could program the Arduino to format it prior to feeding it to the Nagios Renewable Energy Monitor cost me a lot of confused time with the AttoPilot specifications.
My brother-in-law set me right by abandoning the specifications.
Instead, he asked: would I would be able to measure the AttoPilot's outputs at two different currents and two different voltages?
I would.
Then process it like a linear equation, he said. Here's his code:
// Set up voltage conversion // First measurement (set V1In and V1Out to 0 during calibration) double refV1In = 60.00; // actual attopilot input voltage double refV1Out = 1023; // arduino output from analogRead // Second measurement (set V2In and V2Out to 1 during calibration) double refV2In = -0.30; // actual attopilot input voltage double refV2Out = 0; // arduino output from analogRead // Set up current conversion // First measurement (set A1In and A1Out to 0 during calibration) double refA1In = 89.44; // actual attopilot input current double refA1Out = 1023; // arduino output from analogRead // Second measurement (set A2In and A2Out to 0 during calibration) double refA2In = 0.00; // actual attopilot input current double refA2Out = 0; // actual output from analogRead
The maths in that should be familiar to anyone who graphed a linear equation in O-level or GCSE maths.
I love the way his approach just walked around the AttoPilot Current and Voltage Sensor calibration problem.
The specs are shown at the bottom of the page, followed by some traces of my thoughts on how to process the data in the light of the consequences seemingly illuminated by the specs.
Now for the pics and some observations about working with AttoPilot Current and Voltage Sensors:
Above: Basic AttoPilot current and voltage sensor pictured with connector cable suitable for its three-ping data output header. The connector cable is not supplied - it is surplus from a BEC.
Above: AttoPilot after soldering in the current and voltage sense wire. You have to take some care over this - it's quite a problematic process because wire thick enough to handle the 89.4A currents the AttoPilot can measure are physically large enough to require quite some soldering heat. That heat can destroy the tiny SMD INA169 op-amp mounted on the underside of the PCB. I've done this, leaving an AttoPilot that is still able to measure voltage but not current.
Above: AttoPilot mounted in an enclosure able to support 20 Amp terminals. The enclosure is larger than I would like but the thick high-current sense cable is hard to bend into smaller enclosures. I'm wary of soldering terminals to shorter wires because the soldering heat so easily cooks the INA169. This was before I read that the AttoPilot Current and Voltage Sensor is designed to be connected with Deans XT connectors and that the common wire can be 'thin'.
I used this enclosure/terminal set-up to begin calibrating the AttoPilot's output against current and voltage readings taken with a multimeter.
The terminals are 20 Amp gold-plated speaker terminals, though - in the long-run, you probably need to use brass bolts. However, the 12AWG sensing wires grew warm at even 18 Amps - somewhat less than the 89.4 Amps the AttoPilot is theoretically able to measure.
Warm sensing wires are not going to work in my proposed application so I turned to using 10 AWG current sense wire, with the resulting ugly soldering shown below.
Above: This top view is the first of three shots showing how difficult it is to solder 10 AWG current sense wire into the 12 AWG sized slots and holes presented by the AttoPilot. I've yet to test if the amount of soldering required to do this overheated the INA169 op-amp that is key to the AttoPilot's current-sensing ability.
Above: View of the under-side. Why the rough soldering? To reduce the time the INA169 is exposed to heat.
Above: View from the side. Just to make it clear, that is not my usual standard of soldering!
These 'warm-wire, burned out INA169 op-amps and ugly soldering' issues are a consequence of the AttoPilot current and voltage sensor being designed as a physically low-space and light-weight interface for remote controlled/autonomous aircraft applications. Click here to see a discussion about its design considerations and what they enable it to do.
That lightness is not at all necessary in my applications. Reworking the AttoPilot circuitry to accept larger cables is probably the way to go, which is a shame because the AttoPilot is a very elegant solution at a usable price.
It was the above problems that encouraged me to experiment with the Ametes Current Sensor.
But while reading Dean Goedde's comments on the AttoPilot Current and Voltage Sensor, I had a 'Doh' moment…
It turns out the odd indented U-shape of the AttoPilot's non-ground connectors is for direct soldering of Deans Ultra connectors see dmgoedde's comments in the Comments section of http://www.sparkfun.com/products/9028. Like so:
Being able to plug the AttoPilot in and out overcomes the difficulties of manipulating the tiny AttoPilot board against thick cables.
And we also don't need direct soldering of big earth cables, per SOISentineland dmgoedde's discussion in the above SparkFun comments. That will radically ease connection and enclosure options and brings the AttoPilot Current and Voltage Sensor back into play.
AttoPilot's Specifications
63.69mV/Volt
36.60mV/Amp
My Calculations Assuming Arduino’s 5V ADC in use:
5V (max Arduino input) = 1023
3.3V (max AttoPilot output) = 675.18
AttoPilot 0V when measuring current = 0A
AttoPilot 0V when measuring voltage = -0.3V
3.3V = 675.18 = 90.15 Amps = 60 Volts
Measuring Current
Adjustment factor for Amps = 90.15/675.18 = 0.13351995 = 0.13 (for Arduino two decimal place float)
Measuring Voltage
An issue with measuring voltage with the AttoPilot is that the AttoPilot measures voltage from -0.3V to 60V.
Adjustment factor for Volts = (60 + 0.3) (to account for 0 = -0.3 and determine the AttoPilot's measured voltage range) = 60.3/675.18 = 0.089309517 = 0.09 (for Arduino two decimal place float)
Determine 0V point in AttoPilot's Output
0.3V / 0.089309517 = 3.359104495 = 0V
Worked Cases - Psuedo-code
if measured val > 3.36 voltage is positive
60V = (675.18 – 3.36) = 671.82
Find the factor:
60V / 671.82 = 0.089309637
Taking the half-way case:
(671.82 / 2 ) = 335.91
335.91 * 0.089309637 = 30V
elsif measured val < 3.36) voltage is negative
Taking the half way case:
0 = -0.3V
1.68 = -0.16V theoretically
1.68 * 0.089309637 = (0.15004019 * -0.1)
elseif (measured val = 3.36) voltage is zero
Having gone gone through this, I suspect there is a more accurate method using unsigned longs rather than floats. Perhaps along the lines of:
http://www.openobject.org/opensourceurbanism/Counting_Revolutions#Calculating_Distance_and_Speed
However, my brother-in-law's code above shows how he went for doubles instead.
Note also this YouTube video on using AttoPilot Current and Voltage Sensors
Discussion
Please I need more guidance on how to convert analog input from Arduino to actual voltage and current using the Attopilot chip. Please kindly help. I am finding it a little difficult to understand above explanation. God bless