analog curent sensor

BTCAD said:
okay, but is there an other sensor I should use to read amp from a cable?
 
You are not being specific enough.
What you have would work great for measuring DC current
What you have will work great with AC current if you had a way to perfectly synchronise the reading with the mains cycle
What you have will work fine with a peak-detect-and-hold
 
What you have now will NOT work as it stands to measure AC current.
 
okay, thank you rossw, so I will search over the web for a peak-an-hold circuit to only mesure the average peak hold of the wave. Maybe someone on ebay sell this item.
 
Seems like it should be easier to write code to do the peak hold... 
 
What accuracy do you want?  If accuracy isn't a big issue you could build one with just a diode, resistor, and capacitor. 
 
If the current is AC, you could add rectifier at its output, because V0 is 2.5V, that is beyond the rectifier barrier voltage, after adding rectifier, V0 will be 2.5V - 0.7V = 1.8V or so.
 
JimS said:
Seems like it should be easier to write code to do the peak hold... 
 
What accuracy do you want?  If accuracy isn't a big issue you could build one with just a diode, resistor, and capacitor. 
 
Like you suggest befor, I made a simple test with a diode resistor and a capacitor. now I can read the peak of the wave sine directly from the board. No more bouncing!!!!
 
 
Thank you again
 
I'm trying to do some math with the board. Something strange apeear when I divide 552 by 504. The answer is 48. Maybe it's normal but i don't know why. Is there a way to get the good value?
 
BTCAD said:
I'm trying to do some math with the board. Something strange apeear when I divide 552 by 504. The answer is 48. Maybe it's normal but i don't know why. Is there a way to get the good value?
 
Dividing 552 by 504 is going to be meaningless on an integer-only system.
 
552 modulo 504 = 48, so I suspect you're not actually doing a divide. At the risk of repeating myself, giving us the WHOLE story will give you better answers.
 
rossw said:
Dividing 552 by 504 is going to be meaningless on an integer-only system.
 
552 modulo 504 = 48, so I suspect you're not actually doing a divide. At the risk of repeating myself, giving us the WHOLE story will give you better answers.
 
 
I'm curious what type of ARM 32 bit based boards will evolve, offering us floating point functions and better structuring and documenting while offering a standard interpreter....
 
Efried,
 
What kind of floating point function are you looking for and what precision?  Please be precise on your need. We want to see some real use need, so that we can see what to implement  can help our customers. 
 
Currently, WC8/32 PLC logic support SIN, COS, TANG functions, as well as divide and mod.  In the original question, 552 divide by 504 is 1, 552 mod by 504 is 48.  We believe most needs can be resolved through those functions.
 
The CPU we use and most controller board CPUs do not have floating point core. Any floating point calculation can only be done in software and very slow, in addition, it requires a lot of RAM.  If the precision is one digit, that is similar to times 10; if the precision is two digit, that is similar to times 100,  then use math function. That is the case for analog and temperature reading inside WebControl PLC already.
 
rossw said:
Dividing 552 by 504 is going to be meaningless on an integer-only system.
 
552 modulo 504 = 48, so I suspect you're not actually doing a divide. At the risk of repeating myself, giving us the WHOLE story will give you better answers.
 
Ohh so sorry, it was my bad,
 
 
I used modulo :/
 
 
I never saw the difference between them:
 

DIV a[] b[] d[] Divides a by b and puts the result into d. Zero bit updated
with result.
MOD a[] b[] d[] Divides a by b and puts the residue into d. Zero bit updated
with result.

 
 
 
So if i used DIV 552 504 var1
var1 == 1 
 
 
Efried said:
I'm curious what type of ARM 32 bit based boards will evolve, offering us floating point functions and better structuring and documenting while offering a standard interpreter....
This is a good point
 
 
So thank you very much all of you who helped me in this situation!
 
 
I'm now able to read the overall amp in a cable. This is not accurate as i wish but it's not bad.
 
START  
 
sub aip1 504 var1
div var1 4 var2
 
END
 
504 is the reading at 0 amp (V0)
4 is the value of CF
 

In my case AIP1 552 ( the reading of aip1 when 11.6A applying) SUB V0 504 DIV 12A (11,6A)  == 4
 
I used 1 cap and 1 diode to make a basic peak and hold detector as suggest.
 
1 x 1n4004 diodes  
1 x Capacitor 100uf@50v 
 
 
 
it looks like this :
 
[sharedmedia=gallery:images:727]
 
How come the zero amp reading is 504, instead of 250?  I think from your sensor spec posted, zero amp is 2.5V.
The important thing in calculation is not losing accuracy.  sub will not lose accuracy. If you want higher accuracy,
you can take the reading times 10, then divide by 4, just remember your digit move up one also.
 
Because he is leaving it in the ADC value. 
 
 
SUB AIP1 504 VAR1
MUL VAR1 1000 VAR1
DIV VAR1 413 VAR1
 
Then VAR1 = 116 which represents 11.6
 
I would add a resistor across the capacitor and maybe make the cap smaller.   That capacitor will hold a charge for a LONG time unless something provides some load.  Take a reading and then turn off the power and see how long it takes for the reading to drop.
 
Back
Top