Reference Pages:
Thoughts on processing Arduino analog pin output to read and properly format AttoPilot sensor data
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
Discussion