binyameen panali
Posts: 4
Joined: Mon Jun 05, 2017 5:34 am

analog input interfacing

Mon Jun 05, 2017 5:43 am

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

User avatar
mikronauts
Posts: 2722
Joined: Sat Jan 05, 2013 7:28 pm
Contact: Website

Re: analog input interfacing

Mon Jun 05, 2017 2:42 pm

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
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

binyameen panali
Posts: 4
Joined: Mon Jun 05, 2017 5:34 am

Re: analog input interfacing

Tue Jun 06, 2017 6:58 am

thank you sir. in my application the analog signal range is 4 to 20 mA. how can i connect these devices to raspberry pi.

User avatar
B.Goode
Posts: 8514
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: analog input interfacing

Tue Jun 06, 2017 7:04 am

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.

scotty101
Posts: 3718
Joined: Fri Jun 08, 2012 6:03 pm

Re: analog input interfacing

Tue Jun 06, 2017 7:20 am

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.
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

binyameen panali
Posts: 4
Joined: Mon Jun 05, 2017 5:34 am

Re: analog input interfacing

Tue Jun 06, 2017 11:22 am

sir, can i use multiplexer for reading 20 analog input

User avatar
mikronauts
Posts: 2722
Joined: Sat Jan 05, 2013 7:28 pm
Contact: Website

Re: analog input interfacing

Tue Jun 06, 2017 11:35 pm

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.
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

binyameen panali
Posts: 4
Joined: Mon Jun 05, 2017 5:34 am

Re: analog input interfacing

Wed Jun 07, 2017 4:50 am

sir, we already using PLC for these type of applications. But it is very costly. Now we are looking for a cost effective system.

scotty101
Posts: 3718
Joined: Fri Jun 08, 2012 6:03 pm

Re: analog input interfacing

Wed Jun 07, 2017 6:54 am

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.
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

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

Re: analog input interfacing

Wed Jun 07, 2017 7:28 am

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

User avatar
mikronauts
Posts: 2722
Joined: Sat Jan 05, 2013 7:28 pm
Contact: Website

Re: analog input interfacing

Wed Jun 07, 2017 4:50 pm

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.
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

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

Re: analog input interfacing

Thu Jun 08, 2017 7:39 am

Here is a snippet from the wiring schematic for the HAT.
4-20mA.gif
4-20mA.gif (28.09 KiB) Viewed 4071 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).
Doug.
Building Management Systems Engineer.

User avatar
mikronauts
Posts: 2722
Joined: Sat Jan 05, 2013 7:28 pm
Contact: Website

Re: analog input interfacing

Thu Jun 08, 2017 6:07 pm

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.
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

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

Re: analog input interfacing

Fri Jun 09, 2017 7:18 am

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

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

Re: analog input interfacing

Fri Jun 09, 2017 7:26 am

I wish I was getting paid for selling that product :lol:
Doug.
Building Management Systems Engineer.

User avatar
mikronauts
Posts: 2722
Joined: Sat Jan 05, 2013 7:28 pm
Contact: Website

Re: analog input interfacing

Fri Jun 09, 2017 4:44 pm

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:
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

Return to “Automation, sensing and robotics”