Using a Panda II, how does one read the amount of current being output by a sensor? E.g., an oxygen sensor i’m looking at says it outputs in the range of 4-20 mA. So, i’m guessing, in my fog of little understanding, that some sort of analog read function is necessary analogous to a analog voltage read.
What you have is an industrial style sensor that uses a current loop. The current loop powers the sensor and the sensor will vary the current draw between 4ma and 20ma. You need a special type of sensor interface/power supply to use this type of sensor. Look at omega.com, they have 4-20 to Voltage converters (but they are pricey.)
Simply said, the idea is to convert the current to voltage so you can use an analog input pin.
You can start looking at this for example : http://www.bapihvac.com/CatalogPDFs/I_App_Notes/Understanding_Current_Loops.pdf
A tricky point when receiving a 4-20mA current can be the grounding. The sensor shall remain “floating” with regards to the receiver, and should not have a grounding point.
You can have a look at some legacy components used such as :
- sensor side : XTR117 (http://www.ti.com/product/xtr117).
- receiver side : RCV420 (http://www.ti.com/product/rcv420).
Can you post a reference to your sensor ? datasheet link ?
That would be usefull to help you further.
Thanks, Jeff and Barbudor, for your help. It’s always great to have the clouds part a little and get a glimpse of the mountains.
Here’s a link to the data sheet for the sensor (haven’t decided to buy it yet):
Note the optional data interface, “LonWorks”, apparently a serial network interface which appears to eliminate the need for a current-voltage convertor. May be worth the $ if i can find out how much.
i’ve seen other sensors, notably CO2, with the same type of current loop output. Will be doing some more reading and get back w/ questions. Thanks again the insights.
OK. After reading the relatively easy, “Understanding current loops’” my main question is that in order to make use of the TR3210 sensor I will need a 4-20mA transmitter as well as the “receiver-resistor” to convert the current to analog voltage, right? Sounds like it may be easy but that’s when i get worried. Could i simply buy those items linked to by Barbudor and wire them up, attaching Panda’s analog voltage in to the convertor, or will i actually need to know what i’m doing? Looks like for any additional sensors i need separate transmitters and current-voltage convertors. I’m limited to 12VDC supply for my prototyping but that looks like it might work. I’m leaning toward the optional network interface…
You don’t need the 4-20mA transmitter : it is built into the TR3210.
You can supply the unit with a minimum 12VDC as per the User’s Manual (https://www.airtest.com/support/manual/TR3210man.pdf)
This is enough if the total resistance of the wire from power supply to the sensor back to the Panda (ie the sum of both wires TO and FROM the sensor in SERIE) is below 5 ohms.
If your wire is very long and likely to be greater than 5 Ohms, you will need higher power supply.
The GND of the +12V Power Supply MUST be connected to the GND of the Panda (same as GND of the 6-9VDC Power supply you will use for the Panda).
Check the 2nd diagram on page 4. I think is what you need.
The +12VDC -> [+] connector on the sensor.
The [-] connector from Sensor -> will be connected to a resistor which other side is connected to GND (same GND as the Panda and the +12V power supply).
Now comes the value of the resistor and the connection to the Panda’s analog input.
- If you use the standard 250 Ohms resistor, then 20mA will create a 5V voltage over the resistor. While the USBizi chip input is 5V tolerant, the ADC works in the 0…3.3V range [see USBizi manual, section 6.10].
So the resistor should be lower in order to get only 3.3V at 20mA, ie 165 Ohms.
Note that the precision of the resistor is directly related to the precision of the conversion and will be added to the error given by the sensor itself (as well as the error of the ADC because of the surrounding digital noise).
So as the sensor is given for +/-5%, no need to search for a 0.1% resistor and 1% should be enough from my point of view.
- Is that enough ?
For testing, being carefull yes.
For live installation : NO
You have a direct connection between the sensor and the USBizi without any protection. What would happen in case of a shortcut on the sensor’s wires : +12V direct on the analog input pin = R.I.P. USBizi
As a minimum protection I would add a fuse in serie with the [-] signal from the sensor + a diod tight to +3V3. A polyswitch fuse would be better.
See diagram below.
Now, this is a bare minimum and for a serious project, a better front-end with op-amp would be better.
Great info, Barbudor–thanks much. Here’s what i understand and don’t understand:
- OK, the transmitter is part of the TR3210 sensor as it says it, “delivers a linear 4-20mA”
- 12VDC is the minimum and as long as i keep the resistance low for the wires i should be ok (use 16AWG)
- Right now the Panda is powered through the USB but can hook up 6VDC and which has the same ground as the 12VDC i will use to power the loop.
-I understand the need for 165ohm vs. the 250ohm in order to scale the output to 0-3.3V and that 1% variance is OK. However, I was under the impression that the resistor is part of the resistor-receiver chip (RCV420) and it seems those are built to deliver 0-5V. But then i don’t see the receiver-resistor in your diagram (or is the U2-Analog In device the receiver or is it the Panda?) or is it replaced with the 165Ohm resistor wired in series to ground. Obviously i’m confused about the receiver-resistor end of things. Another option for me may be to use a different ADC (a Phidget interface board that i have) that works with 5V and integrates that with the Panda via USB.
- And then your diode connected to 3.3V is way beyond my understanding or is that somehow part of the receiver-resistor replacement?
-I understand the need for a fuse to protect the Panda in case of a short.
Thanks again for your comprehensive help here.
Your pointing out my own inconsistencies…
You are correct as in my 1st post I sent you to RCV420 but in my later one, I was suggesting a simple interface and forgot about the RCV420.
My diagram is a simple interface you can use for testing (in which U2 is directly the Panda).
But if you go for serious industrial solution, you can either design your own front-end with op-amps etc… or of course use a receiver chip like the RCV420 (I know only this one).
RCV420 is no more than an op-amp + laser-trimmed precision resistors + stabilized reference voltage.
Note that RCV420 requires a typical +/-15V symetric PSU which may not be available in your system.
It looks like you can adapt RCV420 output voltage to 3V3, by following the section “Theory of operation” on page 5 of the datasheet. This requires adding matched resistors in front of the chip.
In summary: the gain of the device is defined as the ratio between output voltage range in V divided by intensity input range in mA.
- Default output range is 0V…5V so range is 5
- Default input range is 4mA…20mA so the range is 16 (20-4)
Default gain 5/16 = 0.3125
What you want now is 3.3 instead of 5, ie a gain of 3.3/16 = 0.20625
So from formula on the right column, you need to add a pair of matched Rx resistors so that
0.3125 * (Rx / (Rx + Rs)) = 0.20625 with RS being the internal 75R.
Which leads to Rx = 145 ohms if I am correct.
With regards to my initial schematics and the diode : In case of a short-cut on the sensor wire, it would send the +12V directly on the fuse, then directly on the Panda input. As the fuse will not blow instantaneously, the silicon of USBizi chip will blow much faster resulting in a unwanted smoke on the the Panda.
The diode will make a route the 12V through the 3V, protecting the input of the Panda to go over the 3V (+ forward voltage drop of the diode, typicaly 0.7V), and the current through the fuse will be even higher, making it to blow faster.
Hope this helps.
Have you questioned whether you’re looking at the wrong sensor? Perhaps there are alternative output models? Or perhaps someone has built a breakout board that comes back to UART/SPI/I2C connection or similar already?
It might be worth telling us the problem that you want to solve and perhaps others will have other different suggestions.
Barbudor, perhaps i understand about the necessary resistors in conjunction w/ the RCV420 or the like and i somewhat follow re: using the diode to route a short. Interesting stuff, but i see this water is over my head and i’m not up to swimming lessons just yet.
As this sensor unit comes with an optional network interface which seems to be just what Brett is suggesting, I am inclined to pay for that option. Not sure yet how to make that work, but i guess it would be relatively straightforward.
Brett, i’m needing to measure the O2 concentration in gas flow to and from a bioreactor (5-50% range) containing single-cell algae in order to monitor and control the bio-process. I thought I would look into this sensor as I’m likely to purchase a CO2 sensor from the same local supplier (with different interface) and the supplier is able to provide with a flow through (tube) connector. There are plenty of others on the market which i haven’t looked into yet. Suggestions are certainly welcome.
If making some circuits is not a problem for you, here are several schemas that would probably help :
Look at chapter : => Two ICs Convert 4-20mA Signal to 0-5V Output
It will probably cost less than the IP interface, i guess…