4-20mA output from Propeller...
FORD
Posts: 221
Hi All,
Sorry if this is more hardware related, but I am looking at using a Propeller to control some valves which have a 4-20mA signal to set their position.
Can anyone point me to some links which would show the hardware required to produce a 4-20mA output.
Does having a 3.3v supply complicate things ?
Cheers,
Chris,
West Oz.
Sorry if this is more hardware related, but I am looking at using a Propeller to control some valves which have a 4-20mA signal to set their position.
Can anyone point me to some links which would show the hardware required to produce a 4-20mA output.
Does having a 3.3v supply complicate things ?
Cheers,
Chris,
West Oz.
Comments
There is a chip called an AD421·· this does the trick.
Not sure if anybody carries this in stock in OZ but try Farnell RS and possibly Arrow Electronics.
PDF file attached
Ronald Nollet··
Australia
Will look into that...
The input is a single Propeller pin, driven by one of the counters' DUTY outputs. This is filtered to a voltage that ranges from 0 to 3.3V. The op amp drives the optoisolator LEDs in series, so each receives the same amount of current. The op amp's output voltage will have to be at least three LED diode drops above ground at max drive current. This will probably mean a 5V or greater supply voltage for the op amp. For 4-20mA output, the op amp's input common mode range will need to include 0.66V and 3.3V. For 0 to 20mA, the input common mode range will have to include ground. Depending on the op amp, it may also be necessary to add a transistor follower to boost its drive current to at least 10mA. This will also raise the op amp's Vdd requirements by another 0.6V to account for the transistor's VBE.
The feedback for the op amp comes from one of the phototransistors. It will range from 0 to 10mA which, across the 3.3K resistor, results in a feedback voltage of 0 to 3.3V. The other two phototransistors are paralleled, which yields double the feedback current, or 0 to 20mA. These may be wired to the receiver in any fashion, consistent with the device limitations of the optical isolators.
This circuit relies on the fact that three isolators in the same package will be farily well matched and will be subjected to identical temperatures. So the feedback current should accurately track the output current.
I've never tried this circuit. But if I were going to produce a 4-20mA output device, this is where I'd start.
-Phil
Update: Added a link to the opto datasheet and additional requirements for the op amp.
Post Edited (Phil Pilgrim (PhiPi)) : 2/13/2007 4:39:13 PM GMT
Is the Sharp PC817 the op-amp of you drawing or is your drawing a breakdown of the Sharp PC817.
I too could benifit from a homegrown 4-20ma sensor conditioner. If I could beef it up to 11V output I could use it.
Graham
I added a link to the datasheet.
-Phil
Thanks, That definitly gave me something to chew on.
The sensor conditioner sold with my accelorometers goes for $150 a hit.
In the end we have always said we where going to build our own, And this gives me yet another way to do it. My other circuit relied heavily on precision resistors, transitors not readily available.
I wanted to give the circuit suggested by Phil above a try. I'm hoping to use parts I have on hand.
For the optoisolators I was planning to use this chip.
I have some LM3358N dual opamps purchased from Parallax. I'm hoping these will work well enough to test out the circuit. Here's a link to the datasheet.
It looks like the voltage drop from the three opto isolator LEDs is 1.2V each giving a total drop of 3.6V. I figure the max current through the LEDs should be 20mA which leaves me with a 70 ohm resistor to limit the current through the LEDs from the opamp's output.
I'm not sure what resistor to use between the Prop's I/O pin and the opamp's non-inverting input. I figured I'd try an 100 ohm resistor to start with and watch for smoke.
I plan to use a 0.1uF cap on the non-inverting input of the opamp.
I'll likely be back with more questions but in the meantime if anyone sees something wrong with my plan I hope you let me know. I'll check back before powering up the circuit.
When using the quad part, if you need high-voltage isolation, clip the four pins off of one of the middle isolators, and use the singleton on the end for your feedback. The reason for this is that all the isolators face the same direction, and you don't want pins from the two sides of the isolation barrier next to each other.
There is a possible downside to this, though, in that the feedback isolator won't be in close thermal proximity to the others, and the CTRs may not track as well if there's a thermal gradient. If that's a problem, and you don't need high-voltage isolation, put the feedback isolator between the other two.
-Phil
That is simple, but the tracking will be modest - I'd guess not better than 5%.
You have different voltage drop across the elements and that gives a different operating point, as well as different local heating. Lots of variables = poor precision.
There is a Dual-Photodiode coupler, that is better suited to isolated-linear-feedback.
(this needs an opamp on the secondary side)
Search for
dual photodiode linear optocoupler
finds
TIL300, IL300, LOC110, LOC210, HCNR200/201
Data on those show .01% linearity, but they do need a calibrate pass to get better than 5% matching on the diodes. (std optocouplers will be much worse)
LOC110 looks cheapest, with higher initial offset variance of roughly -30% + 20%
K3 0.668 < 1 < 1.179
Addit: Devices like Si8920 look to give isolation with much better out of the box precision, but they just manage 4mA Icc ceiling, and getting a current from the output structure looks difficult.
Or, there are Digital Isolaters, that would allow a small MCU to operate the current sense side.
We want pretty good precision. I'm not sure what the exact value is but I think less than a 1% error is desired in the current output. I think we would be willing to calibrate the device if it would improve the accuracy.
I'm not so sure how this is going to work with these optoisolators. Even with 25mA running through the LEDs on the devices I don't get a full 5V output. There appears to about a 0.1V drop across the photo transistor.
I see in the datasheet a "Collector-Emmitter Saturation Voltage" which is listed as 0.1V to 0.2V. Am I assuming correctly this is the voltage drop I'm seeing?
I'm guessing the only way around this would be to increase the voltage to the collector?
Again, pardon my ignorance but is the reference to "counters' DUTY output" suggest I setup a counter in a similar fashion as I would to produce a PWM signal?
I used the code from the PEK to produce the output.
Am I on the right track with the code to drive the non-inverted input on the opamp?
As always, I sure appreciate the help you guys provide. Thank you very much.
-Phil
This is designed for Current Out, so you want to avoid the saturation region of the Isolators.
If you want to turn 4-20mA into 1-5V with a 250 ohm load, you will need headroom of 7-9v.
Avoid too much headroom, or the optocouplers will drift more, as they warm up.
Better is the Dual photodiode design which does not push thermal or V-I curves or Hfe changes...
I should have known this. Thanks.
Looking some more at this issue, to allow the conventional 24V region supply on 4-20mA,
maybe a 1 part addition is a Depletion mode MOSFET
http://www.infineon.com/cms/en/product/power/power-mosfet/small-signal-mosfet/60v-600v-n-channel-depletion-mode-mosfet/channel.html?channel=ff80808112ab681d0112ab6a586204b8
that gives a low and somewhat stable voltage across the opto-trx, but would allow 9-24V plus in the system design.
20V & 20mA is 400mW, which is best not in the opto device.
Seems you get bands of Vgs, per reel (or tape), on the BSP149H6906
For BSP149, best is -1.4V @ 10mA, but you might get -0.7V @ 10mA
Vgs varies about 180mV with a 5:1 current ratio,, so is quite consistent on a load line.
Also varies ~ -2.5mV/°C
Using two BSP149, one on each side, would further improve the balance & drift more as the Opto devices then have very similar Vce trackings, that also batch-track.
Of course, that does cost a little more.
A cheap quad Isolator, with > 100% CTR is TLP293-4(V4-GB,E - but has no matching specs on elements. Quad would allow 6.66mA peak current per opto node as 1+3.
Vishay ILQ615 commits only to
Channel/channel CTR match IF = 10 mA, VCE = 5 V CTRX/CTRY better than 2 to 1
The Toshiba parts look to be well ahead of others on Temperature flatness, so a calibrate step on those, with 2 x BSP149, looks the best PhotoTransistor-coupler based design.
I mentioned the 5V regulator aspect of the XTR111 in this post (includes a link to datasheet).
My boss would like to have both the RS-485 and the 4-20mA isolated. I originally thought we could just use a digital isolation on the DAC used to control the XTR111 but this same DAC is used to generate a 0-5V output. If the DAC were moved to the isolated section of the circuit I don't think we couldn't use it to set the 0-5V output any longer. My initial thought was to just use a second DAC. One on each side of the isolation.
In case it's not obvious, this stuff is outside my comfort zone. I'm just trying to familiarize myself with these various options so I can hopefully sound a bit more educated when I talk to my boss (who will also likely read this post).
The XTR111 circuit worked well (after a bit of trouble shooting on my part). I was thrilled to figure out what was going on enough to find the problem with the earlier circuit and once the glitch was fixed it worked great. Part of me wants to stick with the XTR111 since I kind of understand how it works (magic). But if there's a better way to produce the 4-20mA output I'd like to learn what these options are.
We'll have a 24V supply to the sensor with a 5V switching regulator with a portion of the 5V dropped to 3.3V with a linear regulator. From what I understand, we want to isolate the RS-485 line which I believe includes using a separate ground for RS-485 output (thanks to the other thread, I think I've kind of got this figured out). The 4-20mA driver will have an option of being powered externally. A jumper will be used to set the power source of the 4-20mA circuit. I believe when the 4-20mA circuit is powered externally, the supply will also be 24VDC but not necessarily referenced to the same ground as the main power supply. I think a lot of this sort of stuff is common knowledge to those working with industrial sensors but it's not common knowledge to me. (I was hired to program the firmware.)
As I mentioned, I have a slight bias to the XTR111 circuit since I have some experience with it but I'd really like to understand the various options available. I think I'm repeating myself now so I'll stop.
Again, thanks for all your help guys. I think this stuff is a lot of fun and it's thanks to this forum I know as much as I do.
They also have DAC161P997/DAC161S997/DAC8760 series with serial in, which could be isolated, with better precision than multiple optocouplers. (but also a higher price...)
-Phil
And true enough again. Conventional PWM from the prop at a more relaxed speed would be far easier to handle. Even a though a high speed optocoupler like the Toshiba TLP117 lays claim to equal output rise and fall times of 3 ns, the skew in propagation delay can be as much as 16ns.
Another approach, I've used the Silicon Labs SI8600 i2c buss isolator for interface to a high resolution ADC for input from resistance bridge circuits used in hydrology (subject to ground conduction). That could just as well tie into a 4-20mA output scheme. However, with isolated supplies etc. etc., these things do end up with quite a few parts on a circuit board.
Yes, seems there are two levels of choice :
Full digital with 4-20mA side 16b DAC & ref, can get well under 1% error, but with a PCB area and BOM impact (isolated PSU often also needed).
The Photocoupler design above has a simplicity appeal, (no PSU or steps) and I think with careful choices and a design-pass boost to remove the main error sources, could be useful for modest 4-20mA apps.
ie Opto: TLP293-4{GB} + 2 x dmMOSFET BSP149H6906 => Sub $1.50 BOM
and needs a Calibrate pass once assembled. Drift may get < 1% here ?
Should be easy to mockup and test, just 3 parts and resistors and a variable power supply to check common mode tolerance.
Certainly anything in a control loop is not so absolute tolerance critical.
-Phil
The EFM8BB1 has a ~ 2% reference error, and 50 ppm/°C & 400 ppm/V, so a non-calibrated starting point of an ADC tracked PWM+MOSFET would be around 2%, but the EFM8 could store calibration value easily, to push down toward 0.1% error region, and it can linearize for free....
It could manage multiple 4-20mA channels easily 3 x 11b PWM is a natural limit.
The Opto+dmMOSFET would be much faster, should be < 10us response times (not that I've had any 4-20mA designs that needed sub-ms responses )
Yes, that is the Dual-Photodiode coupler mentioned above.
Those come with 5% (or 15%) matching, but good linearity, so the 5% can be calibrated out.