CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

4-20 mA to RPM calculation

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
vijay s



Joined: 20 Oct 2007
Posts: 17
Location: coimbatore,india

View user's profile Send private message Send e-mail Yahoo Messenger

4-20 mA to RPM calculation
PostPosted: Thu Apr 01, 2010 12:45 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Apr 01, 2010 3:59 am     Reply with quote

freq_in_Hz = 12499.999875 * U_in_volt - 12499.999375
Ttelmah



Joined: 11 Mar 2010
Posts: 19555

View user's profile Send private message

PostPosted: Thu Apr 01, 2010 4:41 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Nov 07, 2013 7:31 am     Reply with quote

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: 19555

View user's profile Send private message

PostPosted: Thu Nov 07, 2013 7:54 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Nov 07, 2013 8:30 am     Reply with quote

Thank you so much.
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Thu Nov 07, 2013 3:24 pm     Reply with quote

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: 19555

View user's profile Send private message

PostPosted: Fri Nov 08, 2013 4:46 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group