# 4-20ma signal generator

Discussion in 'The Projects Forum' started by nucleargungus, Sep 3, 2011.

1. ### nucleargungus Thread Starter Member

Apr 6, 2009
23
1
I am a maintenance technician at a coal fired power plant. I would like to be able to test control valves after I rebuild them. It would be great if I could build a circuit that would generate 0-20ma or at least 4-20ma into varying loads no greater than 1000ohms.
I am aware that this would require a (relatively) high voltage and am therefore going to be utilizing three 9volt batteries for a total of 27volts. I am aware buck/boost converters exsist and may utilize one of the ready made ones on ebay if I get the basics working first.
I have tried the following circuit from the LM317LZ datasheet (page 5) however I have been unable to achieve currents lower than 13ma without dropping input voltage which is undesirable because I would like to utilize one pot to adjust the position of the valve which corresponds to the 4-20ma signal and it is desirable to utilize the entire range of the pot no matter the load resistance.

This group on this forum and especially the moderators have what seems an infinite knowledge of electronics. Is there some sort of ohms law or current divider concept I have totally missed? I would like to have the simplest circuit possible and no chance of sending greater than 20ma to the I/P in the valve. I have 10 lm317l and many other components at my disposal.

Robert

2. ### SgtWookie Expert

Jul 17, 2007
22,183
1,728
Here you go:

The upper one is 4-20 used as a source; the lower is 4-20 sink.

The current won't go quite to 20mA due to the 68 Ohm resistor; more like 19mA is the limit. If you want it to go to 20mA, you will need to reduce the 68 Ohm resistor, but you will have to adjust it on a case-by-case basis. The factory tolerance for LM317 regulators is the reason for that. VR1 and VR2 are 250 Ohm potentiometers.

The low limit will be somewhat over 4mA; but it'll be very close. Note that regulation won't be guaranteed over temp if the LM317 output current is less than 10mA.

If you need more accuracy than that, you will need a more complex circuit.

File size:
28.9 KB
Views:
1,562
3. ### #12 Expert

Nov 30, 2010
16,703
7,341
In order to obey the requirement of the 10 ma. minimum chip current, you can add a dummy load in parallel with the real load so the adjustment is really something like 10ma to 50 ma. If the real load is 1K ohms, the dummy calculates to 666 ohms. It would still work with 9V batteries but they would only last about 8 hours.

Another way is to use a jfet as a constant current dummy load. That would lower the maximum wasted current and make the batteries last longer. A 2N5486 comes to mind.

4. ### nucleargungus Thread Starter Member

Apr 6, 2009
23
1
Accuracy or stability are not issues. I do primarily mechanical work in my new job. We have a fluke dmm that produce a 4-20ma signal. This device I am attempting to build will just provide a quick and dirty signal to stroke the valve over its travel and then we can tighten it down. However different valves have different input impedences. At other employers we have utilized air regulators to do this but the type of valves we have here use air on top and on bottom of the piston simultaneously to position the valve and so electronic means to achieve this are preferred. \$800 for a fluke meter w/ 4-20ma output is not an option. I will breadboard your circuit later today or tomorrow SGT Wookie and I will let you know if it appears to be working. The full range of <4 to 20ma would be preferrable however.

Robert

5. ### iONic AAC Fanatic!

Nov 16, 2007
1,422
68
For the theoretical precise resistances you would need as little as 62.5 ohms and as much as 312.5 ohms. The variable resistance at it's max will bring you nearer to 0mA, actually you would need a 125K pot to get you there if at all. But switching the 250K pot with a standard 500K pot will get you down towards 2.25mA, which you said was not a problem. The resolution/precision of adjustment will be more course with 500K than with 250K.

SgtWookie chose a 68 ohm resistor as it was the nearest standard resistor size for your needs, but don't fret his opinion, especially if he come back and corrects me. In other words, trust the Wook! He is top of the line here...

So as far as not going past 20mA the smallest resistance would be a specialized resistor of 62.5 ohms and 1% tolerance. Theoretically that will give you exactly 20mA. It case the actually current is high it can be made less by adding one or more 1 Ohm resistors in series with the existing string. Personally I would start with a resistance of 62 Ohm that would produce 20.15mA and see what you actually get out. If it's still 20.15mA or higher you can add a 1 Ohm resistor for 19.8mA of slightly higher. Another 1 ohm resistor will bring you down to 19.52mA or slightly higher.

Some Parts from Mouser:
60.4 Ohm Resistor

61.9 Ohm Resistor

62.0 Ohm Resistor

63.4 Ohm Resistor

64.9 Ohm Resistor

66.5 Ohm Resistor

68.0 Ohm Resistor

1.00 Ohm Resistor

Last edited: Sep 4, 2011
6. ### SgtWookie Expert

Jul 17, 2007
22,183
1,728
iONic meant 250 Ohms and 500 Ohms, not 250k Ohms and 500k Ohms. The latter two would have practically no range of adjustment; more like as little current as possible would flow for practically all of the pot range, and then the last bit would be practically on and off.

The LM317 has a Vref (the voltage measured from OUT to ADJ) of ~1.25v, but it can vary from regulator to regulator to be anywhere from 1.2v to 1.3v and still be within manufacturer's specifications.

I simply chose resistors to keep your current numbers in the ballpark of 4mA and <= 20mA - along with requiring as few parts as possible.
Your actual high current can range from ~17.65mA to ~19.12mA, depending on the individual regulator and the accuracy of the 68 Ohm resistor.
Your actual low current can range from 3.77mA to ~4.1mA depending on the regulator and tolerances in the pot and resistor; but it may be a bit more because the minimum 10mA current for guaranteed regulation is not being drawn.

As I mentioned before, if you really need better precision, you need a different circuit.

Last edited: Sep 4, 2011
7. ### nucleargungus Thread Starter Member

Apr 6, 2009
23
1
You are absolutely correct "the wook" gives answers that are not only technically correct but also concise and presented in a way that is easy to understand I have answered a few questions on here. My knowledge being limited pro and car audio installations, vibration analysis and simple PLC questions. I hope they have been a fraction as helpful as his... but anyways... your explanation was perfect you answered my questions and I didn't even know how to ask what more could you ask for. Is there any reason I couldn't use trimpots instead of precision resistors are they thermally unstable or something? I could then tweak each circuit I build to match each regulator right?

Robert

8. ### #12 Expert

Nov 30, 2010
16,703
7,341
Trimpots work well enough in 1% circuits, especially multi-turn cermet, but they can be annoying with those tiny little screwdriver slots. That's the only reason not to use them. If you design it so you will rarely touch the trim-pots, that problem is small. I say, "go for it", right after you do the math to make sure you won't be overheating the little trimpots.

9. ### nucleargungus Thread Starter Member

Apr 6, 2009
23
1
I built the circuit you described.... didnt work.... I need to be able to vary the load and still have regulation. As I built the circuit described in my first post I was able to maintain 10-20ma into varying loads as small as 100ohms (possibly lower didnt try) and as high as 1000ohms (the high spec for the 800 dollar fluke meter mentioned above). This circuit is called "precision current regulator" on the lm317 datasheet. I saw a circuit using lm317 and two ranges of regulation (supplied with only 9v though so 20ma thru 1kohm impossible) in another thread on this board I will try that circuit and let you know how that works for me. I should have been more specific I need to be able to supply varying loads up to 1000ohms.

Robert

10. ### SgtWookie Expert

Jul 17, 2007
22,183
1,728
Note that I show using a 24v DC supply in the schematics that I provided.

When used as a current regulator, the LM317 will drop ~3v across itself:
1) 1.7v from the IN to OUT terminal.
2) 1.2v to 1.3v from OUT to ADJ; nominally 1.25v
3) 1.7v + 1.3v = 3v. The 1.7v can vary considerably at higher currents, and over temperature.

20mA * 1000 Ohms = 20V. 20v + ~3v dropout ~=23v. I threw in an extra volt to make it an even 24v. It should regulate OK for loads anywhere between 0 Ohms and 1k Ohms.

Three 9v batteries in series will put out around 25.2v when fresh, but will drop to around 21v (~7v ea) when nearly exhausted. You might be able to get up to around 10 hours' use out of a set of 9v batteries.

You did not describe what was wrong with the output of the circuit; "didn't work" is not helpful.

Perhaps you did not identify the regulator terminals correctly. With the LM317's face towards you so that you can read the part number, pins towards you, the pins are (from the left) ADJ, OUT, IN, and the tab is also OUT. Forgetting that the tab is connected to OUT will give you some really odd results if you connect it to something.

Using multi-turn trim pots is generally not a good idea as they are not very reliable, particularly not if the circuit will be subject to physical abuse. They are OK for determining the initial resistance required.

[eta]
It just occurred to me that I showed the pot used as a pot, not a rheostat as it should have been shown, as in the attached.

• ###### 4-20mA source.png
File size:
26.1 KB
Views:
307
Last edited: Sep 4, 2011
11. ### #12 Expert

Nov 30, 2010
16,703
7,341
I see the wook disagrees with me. 40 years ago, I worked as QC for Uniloc Incorporated, Irvine California. They used 10 turn cermet trim pots in 1% meter circuits. They worked just fine in the laboratory environment I was in. I think it is safe to assume they worked well in field conditions, but I can not assume nothing has changed in 40 years.

Take it with a grain of salt.

12. ### nefarious New Member

Apr 3, 2012
3
0
Sorry for digging up and older thread but I've tried to build the circuit given in post#10 and for the life of me can't get an output even with only my DVM connected. What could I be doing wrong?

13. ### wayneh Expert

Sep 9, 2010
12,388
3,245
Which variation of the circuit? And are you actually using 24V? And maybe a picture would help. It's sooo easy to get the pins wrong.

14. ### nefarious New Member

Apr 3, 2012
3
0
I'm using the source version that was posted in post #10. I've got the middle pin(Vout) of LM317 connected to a 63.4OHM resistor which is then connected to the rheostat. The wiper of the rheostat is then connected to the left pin (Adj) of LM317 and the positive lead of my DVM. +24VDC is connected to the .33uF cap and the right pin (Vin) of LM317. The other lead of the cap is connected to 24VDC return and the negative lead of my DVM. All reference positions to LM317 are looking at the front(side with writing) and leads pointed down.

edit:
I've tripple checked my connections and unless I'm mistaken on what pin is what on the LM317 then everything checks out. One other thing to note is I attempted to read the voltage between the adj pin & Vout to find out what Vref was and it read 0V. Would that indicate that the LM317 that I'm using is bad?

Also, I'm using a adjustable 24VDC power supply set to exactly 24VDC.

Last edited: Apr 10, 2012
15. ### wayneh Expert

Sep 9, 2010
12,388
3,245
So you're measuring voltage at the adjust pin? The LM317 varies its output to hold that at 1.25±0.05V below the output. The current thru the 4-20mA device would be changing with the VR position, but that wiper voltage won't change.

16. ### wayneh Expert

Sep 9, 2010
12,388
3,245
Agreed,
That's bad, yes. You might try using the LM317 in the standard configuration, just in case, before you pass judgement on it.

17. ### nefarious New Member

Apr 3, 2012
3
0

Well, I figured it out.... Somehow, my brand new DVM was delivered to me with a blown fuse which prevented it from measuring current. Replaced the fuse and all is good!!! I'm getting 3.99mA-19.54mA. Exactly what I wanted. Sorry for wasting your time.

18. ### wayneh Expert

Sep 9, 2010
12,388
3,245
Ha ha, if only they were all that easy.

Feb 5, 2010
3,852
967