3

I'm trying to create a remote sensing system for a factory. There would be a single central Raspberry Pi, and I would connect up to 16 5 V analog sensors of different functions. e.g.: vacuum sensor: Vout=1.54 V for high vacuum, Vout=1.77 V for low vacuum.

The problem is that the sensors can be up to 100 m away from the Pi. How do I reliably read a sensor that far away?

So far I have looked at 2 tacks:

  1. Transmit using analog signals. I have two 8-port ADC HATs on the PI using SPI interface. I'm assuming that reliably reading a 0.01 V difference across 100 m of CAT5 cable is a no-go. There will be too much noise, and some amount of voltage loss due to the distance. I thought about using a cheap $3 Class-D amplifier board right next to the sensor. instead of amplifying sound, it would only amplify the difference between 1.45 V and 1.77 V before going into the ADC. Ideally with enough tweaking I could see between 1 V and 5 V at the ADC 100 m away, and hopefully be able to reliably perceive a 0.1 V difference in signal.

  2. Transmit using digital signals. Assuming I still use the SPI-based ADCs for connections to close sensors, I can use the I2C bus and put up to 8 ADCs right next to the sensor, 100 m away. I have looked at several RS485 chips and 1-Wire solutions. I have read about splitting the I2C into 4 unidirectional lines (NXP P82B96), and using I2C signal buffers, repeaters, but I'm starting to get in way over my head. I even looked into slowing the clock frequency, and trying to reduce the capacitance to reduce the RC time to go from 0 to 1, but just can't seem to find a cheap, easy, simple and reliable way to stretch the I2C bus 300+ feet away.

Given the ubiquity of the Pi sensing things, someone has had to have had this problem [Analog sensor 300+ feet away from the Pi]. The one other caveat is I'd like to keep the communication between a $12 analog sensor and $40 PI less than $20 per sensor, and have 16 sensors per Pi... and not involve soldering surface-mount IC's.

Any ideas?

  • Have you considered pairing the sensors (either individually or group by location) with a Pi Zero W and then using Ethernet to communicate back to the central Pi? – Steve Robillard Jun 10 '17 at 0:31
  • I'd have to add an ADC to the Pi Zero because I don't believe it has analog inputs. I could probably figure out PoE to power it.... – H Wornall Jun 12 '17 at 18:22
  • Actually, what I just thought of was Electronics 101. 741 Op Amp. I could go the analog route and then just raise the sensor output voltage from 1.77V to 15V before sending back to the ADC. Then maybe some kind of low pass filter could clean up the signal and then just a resistor to drop it back down to 5V before connecting it into the ADC. One problem being I'm still measuring milivolt differences at the ADC. – H Wornall Jun 12 '17 at 18:26
  • RS232?! It exists for cases like this – Caterpillaraoz Nov 7 '17 at 9:28
3

As mentioned by Steve using a higher-level communication whould be suitable in your situation, I think. But the problem is that you won't be able to buy more than one RPi Zero (limited by developer). Usually I2C only works for distances under a few meters, but in my company we once managed to communicate over a bit more than 200 meters. But we used differential pairs instead of the conventional SDA/SCL lines, as (as you mentioned) the noise is absolutely disturbing at those distances.

Edit: I would use a level shifter instead of an amplifier to "amplify" the bussignal (sending an analog signal over hundreds of meters is not a good solution for the reasons you mentioned)

  • I grabbed your level shifting idea for the analog route. However couldn't make it work. – H Wornall Jun 26 '17 at 15:30
  • I grabbed your level shifting idea for the analog route. However couldn't make it work. For my plan-A I hooked up the sensor to a circuit I cobbled together out of a 358 dual Op-amp. The first op amp establishes 1v from the 5v source. The second op amp acts as a differential amplifier that amplifies the difference between the 1v and the 1.45-1.77v signal and outputs 1v-5v. (Plan B 1-25v). I'm using STP shielded twisted pair for the wiring and grounding it. Plan C is the one below -- extend i2c with the range extender. I'm on the plane to go install this into the factory now... – H Wornall Jun 26 '17 at 15:36
2

Messing with SPI/I2C extenders for those distances is going to be an unreliable monster. Instead Consider the Following alternatives.

Kelvin Sensing

Using basic 4-wire (Kelvin) sensing you should be able to reliably measure a 0.01V in a 5V FullScale (1 Part per 500 aka ~9 Bits) with a remote differential ADC. This is likely sufficient for your application.

The principle is that there is no current flowing on the wires going to the ADC's, no current = no voltage drop in the cable = no effect from the cable impedance. This is a reasonable assumption for cable impedances <1K and slow signals (~1KHz) with software averaging.


Current Loop

Analog Industrial Controls using current loop control, is reliable for many Kilometers. And is the professional way of solving this control problem in the analog regime.

Instead of using voltage you use current sources and sinks, which will compensate for any cabling resistance. The 4ma-20ma range is an industry standard and you will find many thousands of devices that support this signaling mode.


PLC

Otherwise instead of messing with SPI/I2C extenders, which are absolutely not designed for long distance and will be extremely unreliable in a factory setting. I would use a Programmable Logic Controller (PLC) located near the sensors, which is a device ("Ruggedized Computer") that is used to interface a number of analog or digital input/outputs to a factory wide automation system (SCADA). You can build a PLC from a Raspberry PI and interface them to a control system (PC or other PI) using Ethernet (for example).

The PLC will be placed local to the sensors (Mounted on the Tool/Instrument).

1

You can do something like this use i2c ADC and to increase the i2c cable length you can use I2C range extender. these range extender can be used to increase cable length. You can use P82B715TD. I use this range extender with I2C temp/ humidity sensors in our building. to make it more noise immune and increase the cable distance please use twisted wire pair.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.