# Arduino Forum

## Using Arduino => General Electronics => Topic started by: Joolz on Aug 02, 2012, 09:50 pm

Post by: Joolz on Aug 02, 2012, 09:50 pm
I just purchased the attopilot sensor https://www.sparkfun.com/products/9028 (https://www.sparkfun.com/products/9028) to measure current. Now the specs say this thing achieves a 37mA / bit resolution with a 12 bit ADC, referenced to 5 V. However my duemilanove works with a 10 bit adc. What's the math here?

Thanks
Post by: wanderson on Aug 02, 2012, 10:01 pm
The math will be complicated by what value you use for AREF with that device.  The device outputs a range of 0 - 3.3V, so if you use a standard 5V reference each bit of the A2D represents ~ 4.9mV

and from the data sheet;

Analog Voltage Outputs for Sensed Parameters:
o 50V/180A = 63.69mV / Volt 18.30mV / Amp
o 50V/90A = 63.69mV / Volt 36.60mV / Amp
o 13.6V/45A = 242.3mV / Volt 73.20mV / Amp

So for the first range, 63.69/4.9 so about each volt will equate to thirteen possible values ...

But the math your looking for is probably best summarized from this bit of code from the Sparkfun provided example sketch;

Code: [Select]
`  //Measurement  VRaw = analogRead(A0);  IRaw = analogRead(A1);    //Conversion  VFinal = VRaw/49.44; //45 Amp board  //VFinal = VRaw/12.99; //90 Amp board  //VFinal = VRaw/12.99; //180 Amp board      IFinal = IRaw/14.9; //45 Amp board  //IFinal = IRaw/7.4; //90 Amp board  //IFinal = IRaw/3.7; //180 Amp board`

Of course all of the above changes if you change the default AREF value, which you probably should to obtain maximum resolution from the device.
Post by: Joolz on Aug 02, 2012, 10:31 pm
Haha thanks for the sketch, though I still don't get how you arrive to those figures.
Post by: wanderson on Aug 02, 2012, 10:43 pm
Ok.  Try this process

Max voltage 13.6 V in produces a signal of 3.3V

To convert ADC to input voltage

675/13.6 produces about 49.5 steps per volt.

Post by: Joolz on Aug 08, 2012, 02:40 am
excellent , thanks a lot
Title: Did you solve it?
Post by: sergiozambrano on Sep 17, 2012, 06:20 am
I only "heard" about arduino but this time I finally found a use for it. This would be my first project :)

I also need a 50% positive offset square wave generator from 15-600Khz preferably not less than 5 volts. Have you been able to build it?

Thanks
Title: Re: Did you solve it?
Post by: MarkT on Sep 18, 2012, 03:04 pm

I only "heard" about arduino but this time I finally found a use for it. This would be my first project :)

I also need a 50% positive offset square wave generator from 15-600Khz preferably not less than 5 volts. Have you been able to build it?

Thanks

I'd ask that in a separate post if you want people to notice, and choose a relevant subject line.