Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how can i convert 4-20mA input to digital output by using 10

Status
Not open for further replies.
4-20ma converter

Typically, this is done with a precision resistor (usually 250ohm) to GND. The 4-20mA current flowing through the resistor produces a 1-5V voltage, which you then measure with the ADC. Then it's a simple matter of doing some basic math to get the digital output you need.

Ensure the resistor is a stable one. Traditionally, RN-55 or RN-60 resistors have been used for this job.
 

4-20ma to digital converter

Basically any SAR will work.
Personally I use the ADS7844 (8-ch 12-bit) and ADS8344 (8-ch 16-bit) from Texas Instruments. But you should be able to find many other parts. Try National, Maxim, Linear Tech, etc.

For only 10 bits you can use the internal A/D of a micor, such as a PIC. It works great.
 

4-20ma pic

okay,thx you guy,your information useful 1.

Added after 5 hours 35 minutes:

now i try use pic to do this adc,can i write the program with c language?
 

convert 4-20ma to 1-5v

Yes, you can.

I would like to add one more thing:
If you are going to use the 250 ohm resistors, the voltage you need to convert is going to be 1-5V in theory. In practice, you may get sometimes slightly more than 5V, because of resistor tolerances (even with 0.1% resistors) and also because the 4-20mA transmitter at the other end has its own tolerance, which means sometimes it can output slightly more than 20mA at full scale.

What this all means is that you may get more than 5V at the input. If the PIC is powered at slightly less than 5V (because the 5V regulator also has a tolerance and it happens to produce less than 5V), then you may get erroneous readings on all the channels at the same time. When that happens you will know, because all the channels will produce bad, very large and unstable readings.

The cures for such a problem are:
1. ensure the PIC is powered at slightly more than 5V, such as 5.1~5.25V. Thus, even with all the tolerances, the analog inputs never exceed the reference.
I strongly recommend an external reference, always when you do precision measurements (5V).
This means that either you need a separate regulator just for the PIC, adjusted to 5.1~5.25V, or adjust the voltage of the entire circuit to 5.1~5.25V, if possible.

2. If a separate power supply for the PIC is not possible, or if the regulator on the board cannot be adjusted (because you must use a fixed 5V, for instance), then you may consider using lower resistors, such as 200 ohm, together with a lower reference, such as 4.096V. In this case, the analog inputs will always be lower than the PIC's supply voltage. 20mA*200 ohm=4.0V. Even with the worst-case tolerances that is lower than 5V and lower than the reference, which is 4.096V.
You may need to adjust your calculations in this case.
 

    desertkids

    Points: 2
    Helpful Answer Positive Rating
convert 4 20ma to voltage

sorry,i really bighead now,coz my project advisor not allow me use opamp(he dun want negative voltage input) and adc to do this convertion so i must use pic to do this. but the problem is i have to do it in 3 days time,but i never learn pic before,so what advise or help u can give me??help...
 

convert 4-20ma to voltage

OK, tell me what the requirements are:
how many channels?
minimum refresh rate?
what do you do with the results? display them, send them serially, etc.
do you have a preferred/ selected PIC already?
Anything else?
 
18f4550 analog input

ya,
1 channel input only,
refresh rate can be any value,
result is direct display to a display board,serial or parallel also can,
i use pic 18f4550,
and most important cant use -ve voltage input...
thank you very muz.....
 

4-20ma to digital

Well, then it's very simple: follow the examples in the datasheet for the A/D. make sure you set correctly all the bits in ADCONx, TRISx.
Then you just select the channel and set the GO/DONE bit in ADCON0. When the bid goes back low, the conversion result is ready. Read it from ADRESH, ADRESL and send it over the serial port.

You do not need a -Ve voltage, because the signal is always unipolar and always above zero: 4mA*250ohm=+1V
 

pic 4 20 ma

VVV said:
Well, then it's very simple: follow the examples in the datasheet for the A/D. make sure you set correctly all the bits in ADCONx, TRISx.
Then you just select the channel and set the GO/DONE bit in ADCON0. When the bid goes back low, the conversion result is ready. Read it from ADRESH, ADRESL and send it over the serial port.

You do not need a -Ve voltage, because the signal is always unipolar and always above zero: 4mA*250ohm=+1V


can you give me a sample of coding to refer?and any hardware connection need to pay attention? thx...
 

converting 4-20ma to voltage

OK, here is an example schematic. I used the PIC16F876, because I don't have a symbol for the 18F4550. But the connections are the same: RA3 is the reference input, RC6 is the TxD output.
I arbitrarily selected RA0 as the analog input. I also connected the RxD pin to RC7, in case you need it.

Note that not all parts are on the schematic; you need to add decoupling caps and power to the MAX232, etc.

Note that the PIC must be powered at 5.1~5.2V for reasons explained in a previous post. The reference I used is a 5V one. It can be another type, not just REF02. Make sure you add the recommended decoupling to it and to the PIC.

The important things to consider are that C1 and C2 must be really close to the pins of the PIC, to reduce noise. R1 must be a precison RN-55 or RN-60 type resistor for stability. R2 can have pretty much any value up to about 2.5k, the Microchip recommended maximum. A larger value provides better noise rejection, but introduces more errors.
Larger C1 will provide better noise immunity, but you need to be more careful with the conversion rate.

As I said in a previous post, if you use a 4.096V reference, such as REF3040 from TI, then change R1 to 200 ohms and you no longer need the PIC supply voltage to be greater than 5V, you can just use the regular 5V already present on your board. Moreover, the reference can work off the same 5V supply. However, I strongly recommend an RC filter (1k/1uF) at the input of the reference, especially if you use the 5V supply to power the reference, as with the REF3040.

Some sample code in assembler will follow.
 
digital to 4-20ma

OK, here is some code. You may need to do some debugging, but hopefully I did not leave out anything important.
 
to convert 1-5v to 4-20ma

VVV said:
OK, here is some code. You may need to do some debugging, but hopefully I did not leave out anything important.

okay thank you guy!you really help me...
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top