HELP!!!! Using Shunt Resistor to measure Current

Hello guys,

I need some help. I can't understand why it is not printing out any value beside 0. So I use a Shunt resistor that has the resolution of 50mV for 300A and an AD0623AN op-amps. The signal is amplified with the gain of 100. One wire connected to the load side of the Shunt resistor is hooked into pin 3 of the AD0623, the other end of the Shunt resistor goes to pin 2.

The pin 6 (output) on chip goes to A5 analog pin of the Mega 2560.

I run the regular command int sensor_value = analogRead(A5). This gives me the reading values varies from 12-60. So it is reading something...

But the real problem is, when I convert this number to Amps, I always get 0

amps = sensor_value *(5/1024) * (300/0.05) * (1/100)

by doing hand calculations, this formula gets me a value that make sense. Can somebody explain to me why I always get 0 at Serial.println(amps).

Thanks so much.

Is the opamp powered from Arduino's 5volt supply.

Are the shunt voltages within the common mode range of the opamp.

Is the ref input connected to ground or to mid-voltage.

What is the datatype of "amps".

Leo..

Hello Leo,

  1. Yes
  2. Yes
  3. Yes
  4. I declare it as long type

If the first three were not hooked up correctly, I would not be able to get any readings from analogRead(). Am I right?

Thanks,

Question three was to check if you use the sensor uni-directional or not.

Run this test sketch.

void setup() {
  Serial.begin(9600);

  long amps1 = 50 * (5 / 1024) * (1 / 100);
  float amps2 = 50 * (5.0 / 1024) * (1.0 / 100);

  Serial.print("long result is: ");
  Serial.println(amps1, 4);
  Serial.print("float result is: ");
  Serial.println(amps2, 4); // four decimal places
}

void loop() {
}

It seems the maths line can be changed to:

amps = analogRead(A5) * 300.0 / 1024; // 300A shunt

With amps declared as float.

Assuming opamp gain is 100x, and Vref (Arduino supply) is 5.0volt

No need to use the intermediate step "sensor_value", unless you want to use it elsewhere in your code.
Leo..