View previous topic :: View next topic |
Author |
Message |
Sid2286
Joined: 12 Aug 2010 Posts: 119
|
how to get a constant Voltage |
Posted: Mon Aug 08, 2011 8:12 am |
|
|
I have an 4-20ma input, i put a 10ohms resistor wrt grd and get 40mV and 20mV respectively and give that to ADC and display value. everything is fine till here, now i have the same current which is going ahead to some unknown load, how do i display the values in this case?
Please give some feedback.
thanks!
sid |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
Re: how to get a constant Voltage |
Posted: Mon Aug 08, 2011 8:46 am |
|
|
Sid2286 wrote: | I have an 4-20ma input, i put a 10ohms resistor wrt grd and get 40mV and 20mV respectively and give that to ADC and display value. everything is fine till here, now i have the same current which is going ahead to some unknown load, how do i display the values in this case?
Please give some feedback.
thanks!
sid |
A bit of clarification first.
WRT gnd is not relevant as 4 to 20mA sensors are typically isolated (floating).
I suspect in this case you have grounded one leg of the sensor.
[list=]
It is a matter of semantics. Strictly speaking, in a 4 to 20mA system, the "load" is the sensor. I suspect you mean the sensor is being excited by an unknown source, typically a series resistor, let's call it RL, to an excitation voltage source.
Think of this as three series resistors across the excitation voltage source and let's call the negative terminal of the source ground. Your existing 10ohm resistor (Rsense) connects between ground and the negative terminal of the sensor. The + terminal of the sensor goes the the series excitation resistor with the other end of the excitation resistor to the voltage source.
You measure the voltage across Rsense, just as you are doing now. The value of RL is selected based on the sensor datasheet and the nominal excitation voltage.
In practive you would probably want to add another resistor between Rsense and ground. This is to move the sensing threshold further away from ground to ensure you are running in the linear range for the amplifier stage or ADC input. [/list] _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
Sid2286
Joined: 12 Aug 2010 Posts: 119
|
|
Posted: Mon Aug 08, 2011 9:11 am |
|
|
Well somewhat close.. But not exactly what i meant!
I wasn't getting the name.. I want to build a loop indication.. That means I get 4-20mA, display the PV on certain range and that loop is further connected to plc or HMI. |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
|
Posted: Mon Aug 08, 2011 9:32 am |
|
|
Sid2286 wrote: | Well somewhat close.. But not exactly what i meant!
I wasn't getting the name.. I want to build a loop indication.. That means I get 4-20mA, display the PV on certain range and that loop is further connected to plc or HMI. |
That's trickier. Your Rsense now has to go in series with RL so that current flowing though Rsense does not produce a voltage measured by the PLC. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
Sid2286
Joined: 12 Aug 2010 Posts: 119
|
|
Posted: Mon Aug 08, 2011 10:05 am |
|
|
Yes, its quite confusing. Is there a way of programming PIC wherein I get voltage across Rsense as input and then Rsense is further connected in series to whatever external load ? |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
|
Posted: Mon Aug 08, 2011 10:24 am |
|
|
Sid2286 wrote: | Yes, its quite confusing. Is there a way of programming PIC wherein I get voltage across Rsense as input and then Rsense is further connected in series to whatever external load ? |
Yes. The PLC does not see it, because the PLC sits directly across the sensor however this assumes the RL is external to the PLC. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9226 Location: Greensville,Ontario
|
|
Posted: Mon Aug 08, 2011 10:42 am |
|
|
You could put a 250r resistor in the 4-20ma loop and have a differential amplifier measure the voltage across it. With proper resistor selection for the diffamp, it'll output say 1 volt for 4ma, 5 v for 20 ma. This output can easily be read by the PICs ADC.
There are commercial chips/modules that do this but for a one-off project and as a learning tool, it's best to do it yourself. |
|
|
Sid2286
Joined: 12 Aug 2010 Posts: 119
|
|
Posted: Mon Aug 08, 2011 11:10 pm |
|
|
Accepted that the maximum load will be 250r at the plc. But it won't be necessarily 250r it may be less...in that case the readings will be different! |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Tue Aug 09, 2011 1:59 am |
|
|
The whole point about 4-20mA drivers, is that they produce a precisely defined _current_. If the loop is producing 12mA (say), then a 100R resistor in the loop, will always measure 1.2v _whatever else is in the loop_ (within the limits of the driver's ability to generate voltage). There should be a figure from the manufacturer of the device driving the loop, giving the maximum resistance it is able to drive. Typically something like 500R. Provided the total resistance in the loop does not exceed this, the current will remain the same whether you insert a 100R resistor, or a 200R resistor, and whatever other devices are in the loop.
You choose either the resistor itself, or the gain of the op-amp between the sense resistor, and the PIC's ADC, to give the voltage you require. Remember that the PIC's 5v supply is generally not accurate as a Vref, so if you use (say) a 2.5v Vref, and a 100R resistor, you can read from 0 to 25mA - a lot of 4-20mA devices use a higher current like 24mA, as an 'error' indicator, and if you can read to 0mA, you can detect that nothing is driving the loop. You'd then have 655counts for the 4-20mA range, and limited error detection as well.
Best Wishes |
|
|
Sid2286
Joined: 12 Aug 2010 Posts: 119
|
|
Posted: Tue Aug 09, 2011 8:41 pm |
|
|
Thanks temtronics and Ttelmah. I got what is required but i would like to know if the way I'm programming is right!
Now lets say I've 4mA input, I use a diff amplifier and get say 1.5V, I use a read_adc() function and find out its value as 255. Now again I read the value for 20mA and find the voltage as 3.5v and adc value as say 800. So I use these, 255 as my min and 800 as max, I calibrate on a scale of range 0-100. Is this the right way to do? |
|
|
Sid2286
Joined: 12 Aug 2010 Posts: 119
|
No reply |
Posted: Fri Aug 12, 2011 3:44 am |
|
|
Please any replies or suggestions :( |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
|
Posted: Fri Aug 12, 2011 9:50 am |
|
|
Sid2286 wrote: | Thanks temtronics and Ttelmah. I got what is required but i would like to know if the way I'm programming is right!
Now lets say I've 4mA input, I use a diff amplifier and get say 1.5V, I use a read_adc() function and find out its value as 255. Now again I read the value for 20mA and find the voltage as 3.5v and adc value as say 800. So I use these, 255 as my min and 800 as max, I calibrate on a scale of range 0-100. Is this the right way to do? |
It depends. Does your sensing logic give a linear output proportion to the current?
You are should be measuring the voltage across a known resistor. Ideally, if you measure 1.5V with a 4mA current, implying a 375 sense resistor, then at 20mA, the voltage should be 7.5 volts.
Seeing as that is not what you have it would imply there is an offset. Using the numbers you have given, a delta I of 16mA results in a delta V of 2 volts implying the effective sense resistance is 125 ohm. At 4mA the voltage across this should be 0.5 volts and at 20mA it should be 2.5 volts. Your results potentially implies constant offset of 1 volt.
Does your schematic apply a constant offset of 1 volt? If so then the conversion is straight forward.
output value = (reading - 255)/(800-255)*100 _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Sat Aug 13, 2011 9:08 am |
|
|
Industry standard 4-20 mA loop indicators like E+H RIA141 https://portal.endress.com/wa001/dla/50002285073/000/05/TI106Ren_1108.pdf
are loop powered and are designed with a low resistance shunt (only limited voltage drop) and a Z-diode like voltage limiting circuit to supply the processor and display, both connected in series. In my opinion, the design requirements are quite obvious, when you think about it. |
|
|
Sid2286
Joined: 12 Aug 2010 Posts: 119
|
|
Posted: Wed Aug 24, 2011 6:37 am |
|
|
I tried using a differential amplifier but it seems to be not working! It works for a certain condition(without any load..when load is connected to ground), however when the load resistance changes...the voltages at TP1 and TP2 changes with respect to ground. and thus, my differential output changes giving no constant adc input for 4mA and 20mA.
My circuit diagram is as follows:
http://www.freeimagehosting.net/71122 |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Wed Aug 24, 2011 9:08 am |
|
|
Hopefully R6 is not as shown in the picture?. 10K!.... Won't work.
U1B, is not needed, or doing anything really.
There is a potential problem, if the 4-20mA driver is not fully floating, depending how the ground in the PIC circuit relates to the 4-20mA driver circuit voltages, and the common mode range of the op-amps.
Best Wishes |
|
|
|