PDA

View Full Version : current sensor interfacing



hell_pk
- 1st August 2008, 06:28
Hi!
I want to interface a current sensor ADS712 with 16F877A.It outputs 2.61V with 0A and rises as 66mV/A.I am using AtoD with 10 bit res & using 2.61 as -Vref and 5 as +Vref. Now how do I scale the voltage to current conversion.I used different formulas but result is far from accurate.Using 0V as -Vref makes it even more difficult to scale the voltage to current conversion.
any ideas.

dhouston
- 1st August 2008, 11:58
When the output is less than 2.61V it merely means the current is flowing in the opposite direction.

If using a 10 bit ADC and 0-5V, each bit represents 1/1024 of the total so 2.61V should give you 534 bits (0.004883V per bit). For readings > 534, subtract 534 and multiply by 0.004883 to get the voltage then divide by the chips sensitivity (mV per Amp). For readings < 534, subtract the reading from 534 and and multiply by 0.004883 to get the voltage then divide by the chips sensitivity (mV per Amp).

Darrel Taylor
- 1st August 2008, 19:52
With Vref- of 2.61 the total A/D range is 2.39V. (5-2.61)
Divide that by 1024 = 0.0023362 volts per step.

Drop the leading 0's and decimal point, to make it 2336

Then ...

Amps = 2336 * ADvalue
Amps = DIV32 660 ; sensitivity * 10

LCDOUT "A=",DEC AMPS/100,".",DEC2 AMPS //100


Final resolution is .035 A per A/D step.
And you can only read positive currents.

hth,

hell_pk
- 5th August 2008, 10:19
darrels' method is working well.I tried with 5V as Vref+ & Vss as vref- as suggested by dhouston but reading are all over the place.

hell_pk
- 28th January 2009, 06:52
Hi!
The circuit with ADS712 works well. The only problem is while measuring current their is lot of variation between readings.e.g while measuring 1A current the PIC will display 0.88 to 1.12A on LCD.How do I stabalize the reading so that it displays constant reading.Is this due to noise or something else.
thanks

mackrackit
- 28th January 2009, 07:06
Try a capacitor between the ADC pin and ground(zero).

mister_e
- 28th January 2009, 16:53
and maybe play with the acquisition time + perform some kind of result averaging of few ADC reading.

Charles Linquis
- 28th January 2009, 17:35
I generally average 6-10 samples when the input is noisy. If the noise is predominately 60 Hz, then you should average the samples across 16.6 ms (one cycle), Something like -




ADCSUM = 0
For X = 1 to 10
ADCIN 1,ADCVAR
ADCSUM = ADCSUM + ADCVAR
PAUSEUS 960 ; Depending on device one Convert + add takes about 700uSec
Next X
ADRESULT = ADSUM/10

hell_pk
- 29th January 2009, 04:08
Capacitor has no effect,i already tried that.

I am generating Vref- = 2.5V from LM 723 and Vref+ =5 from 7805. LM723 is giving stable output but when 16F877A(@16MHz) is introduced in the circuit the 2.5 line gets noisy. what are possible solutions for this.

mister_e
- 29th January 2009, 04:55
Well, without your schematic I would guess you forgot to install some decoupling capacitor here and there?

Usually 0.1uF(ceramic) + 10uF (Tantalum) do some good results.

Messy breadboard connection, layout and contacts are also good noise sources..