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

input of 4 to 20 ma from a sensor to pic microcontroller

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



Joined: 13 Oct 2015
Posts: 9

View user's profile Send private message

input of 4 to 20 ma from a sensor to pic microcontroller
PostPosted: Tue Oct 27, 2015 2:06 am     Reply with quote

hai guys
i need to interface level sensor which give 4 to 20 ma to pic 16f877a
please help me guys
Ttelmah



Joined: 11 Mar 2010
Posts: 19477

View user's profile Send private message

PostPosted: Tue Oct 27, 2015 3:02 am     Reply with quote

_Hundreds_ of ways.

A huge amount depends on the nature of your 4-20mA source?.

It's accuracy?.
Is it isolated?.
What is it's rating regarding minimum and maximum load?. All will have a maximum resistance into which they can deliver the current, and some will have a minimum as well (a lot tend to oscillate, if the resistance is not in the expected range).

If it is an isolated source (so can be directly connected to any rail you want), then the simplest circuit is just a resistor, with the PIC ground connected to one end of the resistor, and you just read the voltage on the resistor. Can't get much simpler than that!.
If you want to get the full use of the range (as opposed to wasting the ADC readings below the 4mA point), then use an offset Vref on the PIC.
If it is not isolated, then you need to either add a commercial isolator, or build your circuit to provide isolation. You can isolate the analog input directly using something like the IL300 (Vishay have an application note on this - AN54 - the second part is for the receiver). Or you can use an isolated ADC (I've used an MCP3004, connected via opto-isolated SPI).

Obviously if using isolated circuits, you need isolated power for this, and little DC-DC isolated converters do this compactly and easily.
Remember to include a fuse in the line, and a MOV across your sensing circuit. It may be quoted as '40-20mA', but at some point, somebody _will_ do something silly (or there will be a failure), resulting in mains being injected into the line, or another similar high voltage/current.
temtronic



Joined: 01 Jul 2010
Posts: 9215
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Oct 27, 2015 5:14 am     Reply with quote

Like Mr. T says 'hundreds of ways'.
The simplest is of course a 250r 1% resistor. Cheap,easy to use,reasonably accurate,great for the 'one off or school-type project'.
After that, it's up to 'specs and coins' to decide which is best.
Jay
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