Go Down

Topic: How does wire length affect commponents (Read 5723 times) previous topic - next topic


i'm experimenting with simple LM35 and TMP36 temperature sensors. my question is how would one work out what is the maximum length of wire (and or thickness) one could use with these sensors. (using voltage of 5 volts from arduino).



Good question and I don't know the answer. Only posting here so I'm in the loop when answers appear... I have an LM35 also, but it's just on the 200-300mm wire the breakout board came with.

I guess one could easily measure the voltage at the end of a long wire and see if it's still 5V as supplied. Then measure the signal voltage for a stable temperature and see if it's the same with a short and long wire?
Johannesburg hams call me: ZS6JMB on Highveld rep 145.7875 (-600 & 88.5 tone)
Dr Perry Cox: "Help me to help you, help me to help you...."
Your answer may already be here: https://forum.arduino.cc/index.php?topic=384198.0


It's an analog sensor, so the wires can be very long.
With longer wires, more electrical noise is picked up by the wires. So you might need to read about 5 to 1000 analog samples and use the average value. Or perhaps something sophisticated, like 50Hz/60Hz mains suppression.

The sensor uses very little current, thin wires should not be a problem.

Let me make a guess:
Using simple phone wires (flat with 4 wires in it), I think that 20 to 50 meters should be possible.
Using shielded cable, hundreds of meters should be possible.

The Arduino is not shielded against EMI spikes.
With very long wires, you have to protect the inputs of the Arduino board.
Perhaps you might have also to protect the LM35 sensor against EMI spikes.


LM35 works from 4-20V, TMP36 from 2.7-5.5V. Considering that, you could use quite some long wires, but your precision would drop. The other consideration would be interferance from other sources.
Since currents are really small, wire thicknes isn't the problem.
If you had really ling wires, you could measure the voltage on source (breakout board), then voltage on sensor. That would give you an idea of voltage drop on wire. Then you could add that value to what you measure and thus try to compensate for wire length.
All that should be measured under load, because voltage drop depends on current.
Precision of all that would be questionable, so you'd probably be better off with either digital sensor or shorter wires.
(Decent compensation could be achived by measuring voltage on board and sensor output at whole temperature range and then compensated from that data i guess).


Many thanks.
I think I shall avoid the complication of a 50Hz/60Hz mains suppression. (since I don't even know what that is, and will have to do some more reading up on it, which I will do).
I think I'll try to use the Arduino running Avg code to smooth out the signal?
would adding a capacitor also help smooth out the signal -
1. near the sensor across the GND/VCC  or across GND/analogue putput or across Vcc/analogue output?
2. near the Arduino uno across the GND/VCC  or across GND/analogue putput or across Vcc/analogue output?
3. both the above
4. none of the above

I read somewhere that it generally doesn't hurt to add capacitors, but not sure if i would just be wasting components?



How long do you expect your wire to be?
I'd suggest using twisted pair for this, and maybe adding ferrite beads (http://en.wikipedia.org/wiki/Ferrite_bead) and make a few turns on those on each side. Of capacitors, maybe one from ground to power of sensor side, not on signal.



You should add a capacitor on the arduino side between ground and the analog input(signal). That's what's called a low pass filter and it will short AC components in the signal to ground, leaving the pure dc signal. The larger capacitor value, the heavier filtering. Depending on wire length, I would suggest something in the range 1uF - 100uF.
I have done this with thermistors on long wires, and the input becomes stable eneough that you don't need to sample and average.

If your thermo sensor contains internal circuitry it might also be a good idea to add a small capacitor between Vcc and GND on the sensor end, to ensure stable operation. Something like 1uF. But the filter on the Arduino side is much more critical for your readings. You could take a look in the data sheet and see if they recommend a decoupling capacitor when used with long wires.

Good luck!


Thanks all.
I'm going to set up two arduino's one with the running avg software code for smoothing out the signal, and one with various capacitor sizes, and then see what the comparison reveals.


For slow moving signals just add capacitor(s) between the Arduino's analog pin and ground.

Maybe a 0.1uF ceramic for cosmic noise and also a bigger electrolytic for the mains frequencies.

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)


Jan 16, 2014, 04:50 pm Last Edit: Jan 16, 2014, 05:27 pm by xzarth Reason: 1
I really wouldn't add capacitor to sensor line, first of once you give voltage to that sensor capacitor will practicaly be short circuit to ground for that sensor, and wiht curretn rating of 50uA i don't think that would be good. Second, assuming sensor survives that, eventually that capacitor will charge, then when your temperature drops you'll have current through sensor discharging that capacitor (or less likely through arduino), which i can't immagine being good for sensor.
Even if all components survive this, your measurments won't be anywhere near real values. I'll put picture to illustrate shortly.

Starting condition:
Capacitor acts as short toward ground, and Isense shouldnt go above 50uA (if i read datasheet correctly).

Falling temperature condition:
Vc > Vsense but there is almost no current into arduino, and i have no idea how much towards sensor. It could:
- damage sensor
- be no current

If there is no current capacitor voltage will drop VERY slowly, so you will be reading capacitor voltage, not sensor voltage, thus wrong temperature.


The rated maximum current in the data sheet is 10 mA output current. You could add a resistor before the filter capacitor if you are going to use a larger value cap. Resistor size to never draw more than 10mA: 5 V / 0.01 A = 500 Ohms. The resistor does mean that you will get a small delay on the input you see, but it also increases the filtering. If you use a 10 uF cap (probably overkill for 2m wires) you will get a rc time constant of 500 Ohm x 0.00001 F = 0.005 seconds or 5 ms. This means your analog input will see 63% of the sensor voltage after 5 ms or 99% after 25 ms. Probably not something you will notice. A smaller cap will give you even shorter times.


You are right, my data is for TMP36. But still, will LM35 sink reverse current at 10mA?


Well, it sounds like it will certainly need a current limiting resisitor, preferably close to the ic. From the data sheet:
CAPACITIVE LOADS Like most micropower circuits, the LM35 has a limited ability to drive heavy capacitive loads. The LM35 alone is able to drive 50 pf without special precautions. If heavier loads are anticipated, isolating or decoupling the load with a resistor is easy (see Figure 14 ). Or you can improve the tolerance of capacitance with a series R-C damper from output to ground (see Figure 15 ).

As for sinking the 10mA, it would only ever have to when power is cut to the device. I don't know what happens to the impedance of it's output then. But I doubt that it will take damage. The atmega chip might also drain the capacitor as it has diodes to Vcc on the i/o pins. When the power rails voltage falls because power is cut, the diode will eventually discharge the cap - I guess.

Go Up