vishnuvkv
Posts: 33
Joined: Mon Jun 06, 2016 4:13 am

Analogue devices

Thu Feb 02, 2017 6:56 am

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

User avatar
davidcoton
Posts: 5027
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK
Contact: Website

Re: Analogue devices

Thu Feb 02, 2017 9:23 am

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.
Signature retired

texy
Forum Moderator
Forum Moderator
Posts: 5161
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: Analogue devices

Thu Feb 02, 2017 12:09 pm

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
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

User avatar
davidcoton
Posts: 5027
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK
Contact: Website

Re: Analogue devices

Thu Feb 02, 2017 10:07 pm

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.
Signature retired

Heater
Posts: 15949
Joined: Tue Jul 17, 2012 3:02 pm

Re: Analogue devices

Thu Feb 02, 2017 10:28 pm

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.
Memory in C++ is a leaky abstraction .

User avatar
scruss
Posts: 3212
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Analogue devices

Thu Feb 02, 2017 11:51 pm

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!
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

Heater
Posts: 15949
Joined: Tue Jul 17, 2012 3:02 pm

Re: Analogue devices

Fri Feb 03, 2017 6:06 am

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.
Memory in C++ is a leaky abstraction .

Heater
Posts: 15949
Joined: Tue Jul 17, 2012 3:02 pm

Re: Analogue devices

Fri Feb 03, 2017 6:16 am

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.
Memory in C++ is a leaky abstraction .

User avatar
davidcoton
Posts: 5027
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK
Contact: Website

Re: Analogue devices

Fri Feb 03, 2017 9:49 am

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.
Signature retired

Heater
Posts: 15949
Joined: Tue Jul 17, 2012 3:02 pm

Re: Analogue devices

Fri Feb 03, 2017 10:46 am

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.
Memory in C++ is a leaky abstraction .

vishnuvkv
Posts: 33
Joined: Mon Jun 06, 2016 4:13 am

Re: Analogue devices

Thu Feb 16, 2017 8:28 am

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

BMS Doug
Posts: 3824
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: Analogue devices

Thu Feb 16, 2017 8:38 am

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.
Doug.
Building Management Systems Engineer.

vishnuvkv
Posts: 33
Joined: Mon Jun 06, 2016 4:13 am

Re: Analogue devices

Mon Feb 20, 2017 12:46 pm

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!!

BMS Doug
Posts: 3824
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: Analogue devices

Wed Feb 22, 2017 8:27 am

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.
Doug.
Building Management Systems Engineer.

Return to “General discussion”