basic adc question

I just purchased the attopilot sensor AttoPilot Voltage and Current Sense Breakout - 90A - SEN-09028 - SparkFun Electronics 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

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;

  //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.

Haha thanks for the sketch, though I still don't get how you arrive to those figures.

Ok. Try this process

Max voltage 13.6 V in produces a signal of 3.3V

3.3V would produce an ADC reading of 675 (3.3/5 * 1024)

To convert ADC to input voltage

675/13.6 produces about 49.5 steps per volt.

So to convert an adc reading to original input volts (for the 13.6V scale) you would divide the ADC reading by 49.5

excellent , thanks a lot

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

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

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

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.