Hi everyone,I have an acs712 working with arduino and everything is ok, its sends a 2.5 - 2.7v reading on the analog pin and so on, but i can´t find out how to caculate power (KW or KW//h) can someone help with this problem? I would realy apreciate it if anyone could post the equation if they´d allready done one of these. I´m in Europe so its sensing +/- 230VAC 15A.

Hello,I am using ACS 712 with arduino to measure the current. I tried to do it as per the Sparkfun instructions. (Except I have connected 1 microfarad caps instead of 0.1 microfarad). I am getting readings from 0 to 1024 on the serial monitor of Arduino IDE. Can anyone tell me how to calibrate the sensor(ACS 712) to get exact current values on serial monitor?

I mean if ACS 712 outputs the analog voltage, then why am I getting digital readings on the serial monitor?

I mean if ACS 712 outputs the analog voltage, then why am I getting digital readings on the serial monitor?

Just guessing here, but I'd say it's got something to do with the fact that you're reading the analogue values via an ADC (Analogue to Digital Converter) and sending the digital value to the serial monitor.

Or was that a trick question?

PS, why don't they have a sarcasm smiley?

Sorry amitkc, as for calibrating, assuming the 712 is linear measure the current with a known accurate meter, compare that value against what you are reading from the 712, then multiply by a fudge factor and/or apply an offset to bring the ADC value into line. See Jeremy's post above.

well, let's say even if you have a DMM, It measures RMS values and not the average. So, if the values are changing instantaneously. So, it really makes it difficult to measure average value of current.And basically, the question is how to develope a formula which can convert those voltage readings into current ?

Hey thanks Greynomad. I will try the map function. I am assuming that I will have to call that map function in MS excel and not in Arduino IDE.

Also, I tried Jeremy's formula, but it gave me negative readings for those digital numbers. So, I thought I should calibrate for my sensor. (My previous experience with Sharp Long Range IR sensor tells me to do so.)

The digital readings on the serial monitor vary from around 480 to 1023 for motor speed of 50 rpm. I am using Mabuchi FA 130 motor.If I increase the speed to 100 or 200 still the readings go as high as 1023. This tells me that the readings are varying or overshooting instantaneously because of the PWM technique, since they did not overshoot or fluctauate as much for a speed of 255; which is maximum.

So, in order to define that how much is average current for speed of 50, for speed of 100 and so on, first I will have to convert those digital numbers in voltage with the help of ADC resolution formula i.e. ADC= vref*Digital number/ 2n.

Once I know that, I will also have to see that for what voltage, what current do I have for what rpm. I think the current might vary according to load condition and rpm , so u can not really say that there is a particular amount of current for corresponding digital number or voltage.

But all this process will not yield an equation between voltage and current which is applicable for all rpm (i.e. duty cycles) from 0 to 255.The statement I made above has the challenge and question hidden in itself. Let me know if you can help me with that.

I am assuming that I will have to call that map function in MS excel and not in Arduino IDE.

AFAIK there is no map function in Excel, you'll have to do it in the Arduino.

The approach I suggested above is just for getting the instantaneous current with no thoughts about voltage or power factor etc. I was not aware of the other requirements until your last post. This however has no bearing on calibrating the 712, that can be done with a static setup.

I really don't know anything about power factors, I do know that the voltage being applied to the motor is easy to read, as is the RPM. How you combine that lot to get what you want I'm not sure.

One thing I find a little strange though is

Quote

The digital readings on the serial monitor vary from around 480 to 1023 for motor speed of 50 rpm.

Are you saying that you get this huge variation (in current?) with nothing changing?

Rob,Thanks again for the reply. sorry for the "map" thing. I was not familiar with the function, so I just guessed since u did not mention the environment. Thank you for that .Now, let me tell you what exactly I am trying to acheive.

I am trying to measure the current withdrawal from my battery. Its (9.6v, NiCd,700mAh).

At very first, I connected ACS 712 in series with just one motor .(since this is the major load in my rover. Motors are connected to Adafruit motorshield.) I was getting fluctuation in the DMM and ACS readings as well.

So, further I connected ACS 712 in series with battery and that in series with DMM,with that, the DMM readings are not fluctuating, but ACS readings are still fluctuating. I am sure this is because of the PWM technique Arduino uses. Now, one more thing here is, if I increase the Vref to 5v by rotating the Vref pot on ACS 712 at its max position and making the gain maximum, I constantly get the value 1023. No fluctuation. (which really does not make sense.) If I set this pot to minthe values are again constantly zeroes.(catches my nerves..!!!)

Further, I just tried to play with the sensor and kinda tuned the both pots just to get some sensible values on serial monitor. I got the values mentioned here for the constant current of 0.48A (current measured on DMM)

For 50 rpm,0

0

121

219

189

204

220

0

0

141

198

216

191

193

0

0

Now, If I am correct, these values are representing the voltage and not the current since, the output of the ACS712 is analog voltage. I also know the current (bcoz of the DMM), but I do not know the voltage values, as I have tuned the pot (Vref and Gain) at some random position and now, I am not able to understand what is Gain value and what is Vref value!!! having said that , how do I calculate the voltage values from the digital numbers I am getting ?

If you think there is something wrong my set up or strategy to measure the current or if some of my concept is wrong let me know.

Hey, by the way, where did u get the power factor thing into this ..I am running a DC system.

if I increase the Vref to 5v by rotating the Vref pot on ACS 712 at its max position and making the gain maximum, I constantly get the value 1023. No fluctuation. (which really does not make sense.) If I set this pot to minthe values are again constantly zeroes.(catches my nerves..!!!)

Don't know without seeing the circuit, but it looks like it's being over driven and maxing out.

But let me get this right, you have

motor---712---DMM---PWM

Is that correct?

If so I think there's no way you'll get a good reading because of the PWM. The PWM will produce X amps or 0 amps, there are no values in between, it's the ratio between the two that counts. If you're reading the current as above you'll get X for some readings and 0 for others. Exactly how that pans out will depend on the sampling frequency but I imagine it would look very much like you are describing as the two frequencies (PWM and your sampling) beat.

It's possible that the DMM gets a different and stable reading because it samples in a different manner, maybe true RMS or something.

You say the DMM shows .48A, is this what the motor is spec'd at, my guess is that the specs say quite a lot more.

Anyway as I said I think there's no way to get a good reading if the setup is as I have drawn above, and if it is it's not immediately clear to me how one would get a proper reading.

Quote

Now, If I am correct, these values are representing the voltage and not the current since, the output of the ACS712 is analog voltage.

The readings are voltage, but proportional to the current, so affectively they are current values.

When you say those readings are proportional to current and affectively represent current, do u mean following?

For a digital number of 1023 if Vref=5vthen,

Current or ADC or Voltage= 1023*Vref/2n

so for Vref=5v, Current=1023*5/1024=5A

or R u saying that current will increase as this Digital number increases and I will have to find the relation between them.If I have to find the relation and evetually measure the values from DMM for the current, I wonder why they call it as a current sensor.

R u saying that current will increase as this Digital number increases and I will have to find the relation between them.

yes but the other way around

The digital number increases as the current increases

And you do have to find the relationship between the two. The data sheet details what this relationship should be, but you may have to callibrate as well.

Quote

If I have to find the relation and evetually measure the values from DMM for the current, I wonder why they call it as a current sensor.

Well AFAIK you can't measure current directly, you measure the voltage it causes across a resistor, or in the case of the 712 the internal hall effect device does the same thing.

All sensors are the same, a light sensor varies in resistance according to the light and you read this as a varying voltage, a temp sensor produces a variable voltage, it doesn't produce a temperature.

Technically I suppose the 712 should be called a "current to voltage converter" or something.

As for your problem, I really can't see why you would be getting such varying results now that I see what you have connected. If the motor speed and load are stable the current should be pretty stable as well. How you can get values from 0 to 220 I don't know.

Thinking...forget that last paragraph, what I said before about trying to measure the current on a PWM line still holds true I think. You're measuring the shield's external power supply that's used for the motor, the current being drawn from your battery will be in pulses as I described in the last post.

I'm certain that's what you problem is, and equaly certain I don't know how to measure it without things getting a lot more complicated.

I have looked at this sensor a bit because they are used in products built by my employer. Zero current will be 2.5V nominal. The volt (signal) output will go up with current but the sensitivity is relatively low. You need to look for the mV/A scale.

You may need to build a filter circuit and possibly an amplifier stage using an op-amp. Look for circuits such as inverting amplifier or non-inverting amplifer using an opamp. Look for RC circuits using a resistor and capacitor.