Electronic – Best practice in transmitting sensor analog signal over longer distances (approx. 100′) — in cost sensitive products for microcontrollers

4-20mamicrocontrollersensortransmitterwiring

I'm looking for best practices for transmitting an analog sensor signal over long distances to a microcontroller such as the Arduino running at 3.3v or 5v. Keeping costs low is imperative.

SPI and I2C is very common in Arduino land, but it seems there just isn't much of a solution when sensors need to be more than several feet away from the microcontroller. But perhaps I2C or SPI will work with the right components and wiring. Any ideas?

4-20 mA current loops seems like a solid solution since current doesn't drop along distances as long as the supplied power stays consistently above the demand. But 4-20 mA systems of sensors, transmitters and receivers seem to be mainstays in the industrial world and virtually absent in low cost embedded systems.

A classic need is detecting temperature through a resistive based thermistor. Are their inexpensive transmitters that can be coupled with a thermistor to transmit a 4-20 mA current loop signal? And then an inexpensive receiver on the microcontroller side? I would think something like a MOSFET on the transmitter side would work, coupled with a resister on the embedded side.

Alas, being a software engineer, electronics is still a bit fuzzy to me.

UPDATE:
Should have specified more. 30' – 150' distances through potentially electrically noisy environments. I can go VERY low on bit rate: 10Khz. Even 1Khz if such a thing is viable. Putting in a low pass filter and/or software filters is not a big deal. I would like to be less than $10 per sensor (not including housing). But I would also like to stay away from a custom PCB board at the sensor if possible.

Best Answer

The other solution can be I2C — there are extenders, allowing to create buses up to 100m (300ft). One of them is NXP P82B96. It is very useful in amateur constructions, because it is not expensive and exists in an easy-to-mount DIP-8 case too. Additionally it allows to translate logic levels to higher voltages (for example 12V). You can find some application notes on NXP pages, for example: https://www.nxp.com/docs/en/application-note/AN10658.pdf

There is also a possibility to build an opto-isolated bus using P82B96: https://www.nxp.com/docs/en/application-note/AN10364.pdf

Another possibility is P82B715, but it is probably less useful because the maximum bus length is about 50m (150ft) and there are some other limitations. There is this appnote: https://www.nxp.com/docs/en/data-sheet/P82B715.pdf

Using I2C is a very effective solution, because there are many cheap interface chips on the market (ADC, DAC, IO, temperature sensors etc.) so, from the sensor side of view, there is no need to use an MCU (and to create dedicated software for this MCU).

Personally, I built my home automation system using this solution (P82B96 with opto-isolation) and I can confirm that it works very well and is stable and reliable.