View previous topic :: View next topic |
Author |
Message |
vijay s
Joined: 20 Oct 2007 Posts: 17 Location: coimbatore,india
|
4-20 mA to RPM calculation |
Posted: Thu Apr 01, 2010 12:45 am |
|
|
Hi Folks
I need a little clarity. I am using a 4-20 mA current loop transmitter for RPM measurement. The transmitter has a frequency range of 0.0005Hz to 50KHZ. I have a 250 ohm resistor connected to a current loop, which intend to produce voltage of 1-5v. I got confusion with calculating this to frequency.
Please I need help on this. _________________ with regards
vijay s |
|
|
draghi
Joined: 01 Apr 2010 Posts: 2
|
|
Posted: Thu Apr 01, 2010 3:59 am |
|
|
freq_in_Hz = 12499.999875 * U_in_volt - 12499.999375 |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19569
|
|
Posted: Thu Apr 01, 2010 4:41 am |
|
|
Some comments though:
First, the resolution is going to be very low 50000/819. over 61RPM.
Second, the accuracy will be poor, because of using 5v as the refernce. To get the 'best' accuracy, consider using a bandgap reference, and adding a little signal processing, to subtract the 4mA offset.
Then, to avoid float maths, and correct for some of the errors in the resistors etc., look at something more generic like:
count_from_adc = value read from ADC
ADC_4mA = ADC counts for 4mA in
ADC_20mA = ADC counts for 20mA
Code: |
int16 revs;
int16 span;
span=ADC_20mA-ADC_4mA;
revs=((int32)(count_from_ADC-ADC_4mA)*50000)/span;
|
Now, if you actually take the readings for ADC_4mA, and ADC_20mA (rather than just putting numbers in for them), you will largely correct for errors in the sense resistor etc..
In the 'example' case, of using 20mA=1023 counts, 4mA=204 counts, for the 'midpoint' at 12mA (ideally 25000RPM), this gives:
count_from_ADC = 613 (20/12*ADC max value)
(613-204)*50000 = 20450000
20450000/819=24969
Which as close as you can really expect, and without using FP maths.
Best Wishes |
|
|
mr.njt
Joined: 30 Oct 2013 Posts: 4
|
|
Posted: Thu Nov 07, 2013 7:31 am |
|
|
Sorry but i could not understand the value "819" . how could you get that number? and what is that for ? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19569
|
|
Posted: Thu Nov 07, 2013 7:54 am |
|
|
The 4-20mA signal, without any scaling, would use 0.8 of the range of the ADC. 0.8*1024=819.2. So this is the range of ADC values being used for the measurement. So without external processing (as I said to subtract the 4mA offset), you get at best 819 useable counts out of the ADC.
Best Wishes |
|
|
mr.njt
Joined: 30 Oct 2013 Posts: 4
|
|
Posted: Thu Nov 07, 2013 8:30 am |
|
|
Thank you so much. |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Thu Nov 07, 2013 3:24 pm |
|
|
Using a PIC with a 12bit a/d would help you too, if your current to voltage translation is low noise.
This would give you 4 times better resolution. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19569
|
|
Posted: Fri Nov 08, 2013 4:46 am |
|
|
Yes.
However the inaccuracy of any resistor converting I->V limits this unless you spend a lot.
Personally, I have to ask 'why' this approach Far easier to use a really basic PIC being fed from a simple shaft encoder, and count the time between pulses. Use a crystal, and in a tiny fraction of a second, you have RPM to several orders of magnitude better accuracy than the 4-20 can manage. If the data need to be sent a long way, then use opto-couplers, or 4-20mA transceivers, and an accurate RPM reading can safely be sent far further than 4-20 can do...
Just seems an expensive/inaccurate way to read the RPM....
Best Wishes |
|
|
|