I am going to need a large length of wire from my microcontroller analogue input to a LDR or similar sensor. The length of wire is likely to be about 100m so will it have any affects on the reading the ADC? Is there anyway I can reduce the effects?
-
1\$\begingroup\$ The standard approach would be to put another microcontroller next to the sensor and make it communicate the data. \$\endgroup\$– starblueCommented Apr 20, 2011 at 6:44
-
\$\begingroup\$ @starblue: you mean a buffer amplifier? \$\endgroup\$– endolithCommented Apr 20, 2011 at 20:48
-
3\$\begingroup\$ @endolith - i think starblue means, do the ADC conversion on-site and link digital data back over the 100m of wire. \$\endgroup\$– JustJeffCommented Apr 21, 2011 at 1:48
5 Answers
Yes, normally you would not put a sensor 100 meters from the ADC.
Why? Because that length of wire will experience voltage drop due to the resistance of the copper wire, doing a quick estimate to demonstrate, using 24 AWG (wire gauge chart) the resistance would be in about 8 ohms.
Using Ohm's Law and say 10mA of current (my guess, small signal level) that would equal about 0.1 volts drop.
V = I * R
voltage drop = 10mA times 8 ohms
V = 0.010 * 8 = 0.08
or approximately 0.1 V.
If it's a 5V signal that's 2%, enough to lose accuracy.
Normally for a signal to be transmitted reliably over a longer distance, and resist interference as well as handle the wire resistance, you can do a few things.
The first is to increase the voltage, say use a 24 Volt signal rather than 5V (or 3.3V) or whatever the limit of your ADC input is. This can be useful, and is what RS-232 (EIA-232) serial protocol does to improve communication reliability over a distance.
The second is to use a current loop, where the information is encoded as current differences, such that LDR value is encoded near the sensor, and the current loop spans the 100 meter distance. This would require a current loop transceiver at either end of the distance, and at least one end of the loop should have a robust power supply to provide the necessary power for the loop.
A third way would be to use a differential signal, where two wires (balanced transmission lines) span between the LDR sensor and the ADC. The difference between the two values is the actual signal. This has very good common mode interference rejection (filtering). Examples include RS-422, and most Ethernet modes. There are line-drivers ICs for RS-422, similar to the popular MAX232 transceiver / driver for RS-232 serial communications.
It will probably pick up interference. Maybe you can use the same circuit design as a microphone, with the two LDR wires inside a shielded cable and equal loads and a diff amp at the other end.
Since you're going to an ADC, I'm guessing your LDR signal changes slowly relative to the time it takes for a signal to travel 100 m (500 ns), so you don't need to worry about transmission line effects.
The resistance of the wire probably won't affect it, either, if the sensor's resistance is in the kiloohms. The wire might be 50 ohm or so by itself.
Actually, if your LDR signal changes slowly relative to the interference, the diff amp could be overkill and you could just filter the interference out with a low-pass filter.
-
\$\begingroup\$ @ a wire's resistance is not the same as its characteristic impedance! \$\endgroup\$– stevenvhCommented Jul 16, 2011 at 12:41
-
1\$\begingroup\$ @stevenh Where did I mention characteristic impedance? \$\endgroup\$– endolithCommented Jul 17, 2011 at 4:20
-
\$\begingroup\$ sorry, my bad. force of habit, I'm afraid. 50 ohm in connection to wire/cable kind of triggers that flag :-/ \$\endgroup\$– stevenvhCommented Jul 17, 2011 at 4:24
Your 100 m of wire will act as 1 big antenna an pick up all kinds of EMI (ElectroMagnetic Interference). You could use a shielded cable, as endolith suggests, or a decent twisted pair (decent = enough twists per meter).
A lower impedance at the end of the wire also reduces EMI, but the lower this impedance, the more the wire's resistor comes into play. You may have to adjust your ADC reading for the loss.
This would be an ideal application for an AT-tiny, which is an 8 pin AVR. Flash the Tiny to just loop doing the ADC conversion, and transmit your information over the 100m of wire by bit-banging the digitized signal. Given that the signal will be changing only very slowly, you could send back single bytes, say once per second, at a low baud rate (e.g., 2400bps). Running the signal back as analog over 100m of wire, you're apt to collect a bunch of unwanted noise, to which a digital signal should be immune.
If you don't want to program an AVR as per JustJef's suggestion you could try a one-wire analog-to-digital converter like DS2450 from Maxim. This is a quad ADC. It should be able to send data up to 500m if you follow their guidelines. (I was easily able to get a DS18B20 temperature sensor work at 30m on basic alarm cable).