Page 1 of 1

analog input interfacing

Posted: Mon Jun 05, 2017 5:43 am
by binyameen panali
i am new to raspberry pi. i have a requirement that need to connect 20 analog input to raspberry pi3. how can approach to it. sir please give me a solution

Re: analog input interfacing

Posted: Mon Jun 05, 2017 2:42 pm
by mikronauts
You may find my article helpful:

http://www.mikronauts.com/raspberry-pi/ ... and-howto/
binyameen panali wrote:i am new to raspberry pi. i have a requirement that need to connect 20 analog input to raspberry pi3. how can approach to it. sir please give me a solution

Re: analog input interfacing

Posted: Tue Jun 06, 2017 6:58 am
by binyameen panali
thank you sir. in my application the analog signal range is 4 to 20 mA. how can i connect these devices to raspberry pi.

Re: analog input interfacing

Posted: Tue Jun 06, 2017 7:04 am
by B.Goode
binyameen panali wrote:thank you sir. in my application the analog signal range is 4 to 20 mA. how can i connect these devices to raspberry pi.
From the first paragraph of the tutorial you have been referred to:
The Raspberry Pi is a great little educational computer, but all models of the Raspberry Pi miss a critical ingredient for electronics experiments – an Analog to Digital converter.
It is not possible to connect analogue devices directly to an RPi. Some form of external analogue-to-digital conversion is always required.

Re: analog input interfacing

Posted: Tue Jun 06, 2017 7:20 am
by scotty101
4-20mA is a fairly specialized industrial signal protocol and requires additional hardware to connect to the Pi in addition to an ADC. There are very few complete solutions out there, none that seem to support 20 inputs.

Here are two that a quick google search found
https://www.cooking-hacks.com/documenta ... l-galileo/
https://www.abelectronics.co.uk/kb/arti ... us-or-zero

Given the specialized nature of this type of interfacing, you will likely have to produce your own board to read in that number of sensors.

Re: analog input interfacing

Posted: Tue Jun 06, 2017 11:22 am
by binyameen panali
sir, can i use multiplexer for reading 20 analog input

Re: analog input interfacing

Posted: Tue Jun 06, 2017 11:35 pm
by mikronauts
Depends of how the 4-20mA sensors are powered.

Theoretically, you can just use a 250 ohm resistor, and measure the voltage drop across it, assuming no common mode voltage issues.

The problem is that most power supplies these days do not use a transformer, and unless the power supplies to the sensors and the Pi's are all isolated, you could run into some real problems due to common mode voltage issues that could easily fry the Pi and ADC's.

4-20mA sensors are industrial sensors, so unless you are very knowledgable, your best bet is to:

a) forget about using a Pi, and use PLC's with 4-20mA analog input modules fitted
b) hire someone familiar with interfacing to 4-20mA signals, common mode voltage issues, isolation etc

This is NOT a project for someone new to interfacing.

Re: analog input interfacing

Posted: Wed Jun 07, 2017 4:50 am
by binyameen panali
sir, we already using PLC for these type of applications. But it is very costly. Now we are looking for a cost effective system.

Re: analog input interfacing

Posted: Wed Jun 07, 2017 6:54 am
by scotty101
binyameen panali wrote:sir, we already using PLC for these type of applications. But it is very costly. Now we are looking for a cost effective system.
I guess you are now realising why they are costly.

If you decide to use a mux, any signal conditioning circuitry should be on each input channel not after the mux. 4-20mA relies on a continuous current loop from the sensor to the receiving device. Breaking this loop with a mux won't work unless it is after the signal conditioning.

By signal conditioning, I mean something like this https://www.maximintegrated.com/en/imag ... 2Fig04.gif

Multiplex the ADC-In signal.

Re: analog input interfacing

Posted: Wed Jun 07, 2017 7:28 am
by BMS Doug
There are some Analogue input HATs available, I haven't tried them so I can't verify their functionality.

This module is connected by SPI and suggests that more modules can be daisy chained together (although you would need to find a way to change the chip select pin for each HAT if connecting them to a single Pi).

I would probably use multiple Pi's with 1 HAT each.

Re: analog input interfacing

Posted: Wed Jun 07, 2017 4:50 pm
by mikronauts
That is a nice looking hat.

Their use of 150R resistors suggests they are running the ADC at 3v3, and common mode voltage differences are likely an issue.

I agree, using three Pi's and three hats (if common mode issues are not an issue) would be a good solution.

to the OP:

Unless you can avoid differences in ground level between the Pi's power supply and all the sensor power supplies you may run into severe common mode voltage differences.

This is one of the reasons that PLC analog I/O is expensive.

Re: analog input interfacing

Posted: Thu Jun 08, 2017 7:39 am
by BMS Doug
Here is a snippet from the wiring schematic for the HAT.
4-20mA.gif
4-20mA.gif (28.09 KiB) Viewed 4098 times
It seems that they expect you to use an external power supply (9-24V) for the the 4-20mA sensors? (Ouch, look at pin 8 on TB1, its labelled COM but connected to +V! fortunately the silkscreen on the board correctly identifies it as +V).

Re: analog input interfacing

Posted: Thu Jun 08, 2017 6:07 pm
by mikronauts
Thanks - I like that board even more now!

If and only if the 24V (pretty standard in industrial I/O) power supplies ground and the Pi's ground have no common mode issues (ie on the same circuit, grounds tied togeather, or transformer isolated with grounds tied togeather) it should work.

Otherwise there will likely be issues.

Re: analog input interfacing

Posted: Fri Jun 09, 2017 7:18 am
by BMS Doug
mikronauts wrote:Thanks - I like that board even more now!

If and only if the 24V (pretty standard in industrial I/O) power supplies ground and the Pi's ground have no common mode issues (ie on the same circuit, grounds tied togeather, or transformer isolated with grounds tied togeather) it should work.

Otherwise there will likely be issues.
That seems to be the case, the board has the 9-24V DC input for the field sensor power supply, then ties the grounds together before giving a set of V+, Gnd, In connection for the sensor.
As long as the components are connected correctly there shouldn't be any common mode issues.

This is reliant on the sensor having a separate output pin, which would be an issue with a 4-20mA sensor with a 2 wire connection or with a sensor with its own local power supply.

Re: analog input interfacing

Posted: Fri Jun 09, 2017 7:26 am
by BMS Doug
I wish I was getting paid for selling that product :lol:

Re: analog input interfacing

Posted: Fri Jun 09, 2017 4:44 pm
by mikronauts
You should get a commission!

Btw, the reason (as I am sure you have guessed) that I keep harping on ground differential issues is that I've seen people in the past ignore them (run many sensors of different circuits feeding an ADC on yet another)... and then wonder why they are having problems.
BMS Doug wrote:I wish I was getting paid for selling that product :lol: