Page 1 of 1
Analogue devices
Posted: Thu Feb 02, 2017 6:56 am
by vishnuvkv
Hi,
I have to connect Ultrasonic level transmitter to raspberry. It is a 3 wire sensor with 4-20mA analog output. How can I connect it to raspberry? Data sheet can be found in the link given below. Please help.
http://www.filprosensors.com/ultrasonic ... itter.html
Thank you
Re: Analogue devices
Posted: Thu Feb 02, 2017 9:23 am
by davidcoton
You need an analogue to digital converter, probably you can find a suitable add-on board ready made from one of the regular Pi suppliers.
Make sure it can be configured for 4-20mA input.
Re: Analogue devices
Posted: Thu Feb 02, 2017 12:09 pm
by texy
It seems a bit unusual for the current to vary, rather than voltage, for a sensor. That in itself is something else to think about......
Texy
Re: Analogue devices
Posted: Thu Feb 02, 2017 10:07 pm
by davidcoton
texy wrote:It seems a bit unusual for the current to vary, rather than voltage, for a sensor. That in itself is something else to think about......
Texy
4-20mA current loop is (was) a standard signalling method. I forget the maximum voltage, but a suitable resistor is all that is needed to provide a voltage input for an A2D. I think the idea was that a current loop was less prone to interference than a voltage signal with an undefined load.
Re: Analogue devices
Posted: Thu Feb 02, 2017 10:28 pm
by Heater
A current loop used to be very normal. It has very good noise immunity when long cables are involved in noisy factory environments. And it avoids ground loop problems.
As noted you only need a resistor at the receiving end to develop a voltage across.
Re: Analogue devices
Posted: Thu Feb 02, 2017 11:51 pm
by scruss
It's been a while since I did this, but I used to build meteo stations that used 4–20 mA sensors.
The simplest way, as folks have said, is to put a resistor in the loop, and put the A to D across the resistor. It needs to be a fairly precise resistor: better than 1% tolerance. Something like a 165 Ω, 0.1% tolerance, ¼ W power rating. This will give you 0.66 to 3.3 volts for your 4 to 20 mA. This will effectively compress the output range of your sensor to 80% of the range of your A2D. I seem to remember a clever way of avoiding it, but it's been so long that the type of resistor I used to use (precision wirewound) are basically museum pieces. And a good thing too that they're mostly obsolete: they acted like little radio antennas sometimes.
The other really neat thing about current loop is that you can immediately tell if your circuit has failed. If you ever get 0 V across your resistor, you know something's broken. It's a hangover from the old 3-15 psi pneumatic control loops. I don't miss pneumatic control logic at all!
Re: Analogue devices
Posted: Fri Feb 03, 2017 6:06 am
by Heater
scruss,
I don't miss pneumatic control logic at all!
That's a blast from the past.
I never used pneumatics in serious work but back in technical college in the early 1980's I built a three bit binary counter out of flip-flops made from one meter long pneumatic actuators and spool valves.
It was the most impressive piece of digital logic I have ever seen.
Re: Analogue devices
Posted: Fri Feb 03, 2017 6:16 am
by Heater
Now, about that current output sensor.
Surely the thing to do is put that current through a high tolerance resistor. 0.1 percent or so. Easily available from many places e.g. digikey.
To measure the voltage developed across that resistor I would build an "instrumentation amplifier". See here:
https://en.wikipedia.org/wiki/Instrumentation_amplifier
Again these can me made from off the shelf opamps or you can get ready made ones
http://www.analog.com/en/products/ampli ... fiers.html
Precision resistors will be needed here as well.
The idea being that the instrumentation amplifier is a differential amplifier. It amplifies the difference in voltage between it's two inputs. In this way one removes noise problems and also it no longer matters if the ground of your computer and the sensor are not quite the same.
After that I would include another opamp stage. Adjust the gain of that to mach the range of your analogue to digital converter.
Re: Analogue devices
Posted: Fri Feb 03, 2017 9:49 am
by davidcoton
Heater wrote:Surely the thing to do is put that current through a high tolerance resistor. 0.1 percent or so.
...
After that I would include another opamp stage. Adjust the gain of that to match the range of your analogue to digital converter.
The precision of the resistor is immaterial for a one-off project (but important in production). If following it with amplification, either the gain must be adjustable (so you calibrate the whole system -- no precision resistors required), or all the gain determining resistors must have the same precision. Calibration can also be done in software.
In any case, what accuracy do you need? Your A2D converter must also have a number of bits of conversion consistent with the rest of the circuit and software.
Re: Analogue devices
Posted: Fri Feb 03, 2017 10:46 am
by Heater
True enough I guess. The precise value of the current sense and gain resistors is not of much concern. If one can calibrate in software.
On the other hand perhaps temperature stability is important. One does not want measurements drifting around with temperature.
I'm no expert on these things but thought precision resistors were more temperature stable.
I suspect though that 0.1% resistors everywhere would be sufficient. They are not expensive.
Re: Analogue devices
Posted: Thu Feb 16, 2017 8:28 am
by vishnuvkv
Hi,
Thank you all for your valuable inputs. I have found an 8 channel module(VP-EC-8AI) for this purpose. Since I have to connect multiple such sensors , I am planning go ahead with this module.
Please check the link given below and give your suggestions.
https://widgetlords.myshopify.com/colle ... -interface
Re: Analogue devices
Posted: Thu Feb 16, 2017 8:38 am
by BMS Doug
vishnuvkv wrote:Hi,
Thank you all for your valuable inputs. I have found an 8 channel module(VP-EC-8AI) for this purpose. Since I have to connect multiple such sensors , I am planning go ahead with this module.
Please check the link given below and give your suggestions.
https://widgetlords.myshopify.com/colle ... -interface
Thats a nice bit of kit that will do what you need.
Are you planning on using the RS485, N81 or Modbus protocols?
If not I think the
Pi-SPi-8AI linked to from the VP-EC-8AI would be a better choice, it still has the 8 4-20mA input channels at the same resolution but has a much smaller footprint (same footprint as a Pi3) and is much cheaper (although missing the dedicated communications channels available on the VP-EC-8AI.
Re: Analogue devices
Posted: Mon Feb 20, 2017 12:46 pm
by vishnuvkv
BMS Doug wrote:vishnuvkv wrote:Hi,
Thank you all for your valuable inputs. I have found an 8 channel module(VP-EC-8AI) for this purpose. Since I have to connect multiple such sensors , I am planning go ahead with this module.
Please check the link given below and give your suggestions.
https://widgetlords.myshopify.com/colle ... -interface
Thats a nice bit of kit that will do what you need.
Are you planning on using the RS485, N81 or Modbus protocols?
If not I think the
Pi-SPi-8AI linked to from the VP-EC-8AI would be a better choice, it still has the 8 4-20mA input channels at the same resolution but has a much smaller footprint (same footprint as a Pi3) and is much cheaper (although missing the dedicated communications channels available on the VP-EC-8AI.
Hi Doug,
Thanks for your reply. I need a direct connection with RPi, so Pi-SPi-8AI will be enough I guess. Also I am new with these types of modules and I have to explore more on these protocols . Actually what I need is to send this data to the AZURE cloud. Please give your suggestions.
Thank you!!
Re: Analogue devices
Posted: Wed Feb 22, 2017 8:27 am
by BMS Doug
vishnuvkv wrote:
Hi Doug,
Thanks for your reply. I need a direct connection with RPi, so Pi-SPi-8AI will be enough I guess. Also I am new with these types of modules and I have to explore more on these protocols . Actually what I need is to send this data to the AZURE cloud. Please give your suggestions.
Thank you!!
Yes, the Pi-SPI-8AI will be suitable as you don't need to connect to other devices using the protocols mentioned.
Here's an article on using
Win10 IoT to build an azure app service. I expect that this program would need to be modified to read the SPI sensors but i don't think that I can help you with that.
It is probably possible to connect to Azure without using win10 IoT, I'm not sure of the details.