Analog sensors on long leads lm335 vs lm134

Sometimes you discover a problem where the obvious solutions just cant be applied. This is one of those times.

I have a project. I use Lm335 temperature sensors. These sensors are cheap and they worked fine in testing. Trouble is they are on the end of 15m of utp cable.

As the project progressed and they were installed I started picking up huge spikes in the temperature readings or drift in the readings. this didnt happen in the uk but happened when the project was shipped to australia.

the arduino is powered by a dc dc buck convertor so the voltage fed to vin is nice and clean 5v

I am tempted to put the spikes and drift down to other electromagnetic interference in part. the drift in the readings of 1.5 degrees seems to happen through the day and drop back at night. i think whats happening is the resistance of the cable is changing through the day as the brisbane daytime temperatures increases.

Ok, so the obvious solution is go digital with ds18b20's. i'd like to but I can't. Theres simply not enough code space remaining on the arduino to fit the libraries in. Yes I could use a seperate usb driver module and attach it the the Yun and read the temps with curl but this adds more cost.

Presently I read the lm335's like so

clean 5v --> 2.2k resistor --> | --> LM335 -- > Other leg to ground
Analog pin

Heres where the problem occurs.

I can change the 2.2k resistor to something else
I can't change the wiring to be anything other than 2 wires as they plug into bnc on the sensor shield
This would mean changing the design of the waterproof housing to fit new plugs

So I've read a bit about the lm134 and 234 sensors. A few people have suggested these are better on long lines. Something to do with them being constant current source. Presently the lm335's give -40 to +100 range. the lm234 seems to do -25 to +125 which would be perfect.

Can anyone suggest if the lm234 can be used in place of the lm335 with minimal changes. i.e still 2 wires utp still bnc and perhaps just changing the 2.2k resistor for some other component?


I'd try a capacitor across the Arduino's analog input (to ground). Maybe try 0.1 or 1F.


thats an interesting idea. How does that work? Would it go

clean 5v --> 2.2k resistor --> | --> LM335 -- > Other leg to ground
| ^
V |
Analog pin --------------------|

It sounds to me like poor cabling. 15 m of UTP should give you less than 1.5 ohm resistance in the ground lead so the 400 uA drawn by the sensor will drop 0.6 mV and give a constant offset in the temperature reading of 0.06 C. Hardly likely to be significant.

Check that you have got good quality copper cable. There is some poor aluminium stuff around. Also check that your connectors are fitted correctly and not making intermittent contact.

Are you in a noisy (electrical interference) environment? If so the capacitor may help but you could also consider using shielded UTP cable with the shield grounded at the Arduino end.


That you. i will also swap out the utp for stp and ensure its copper not aluminium

Can I ask as I can't find this information anywhere else.

As I am using utp to bnc connectors. For proper shielding termination do I simple strip back the outer plastic sheaf. twist the foil into a wire and connect that to the screw terminal ground on the bnc connector (The same wire the lm335 ground is on)

Also I've seen some people recommend connecting the shielding to ground at both ends. I dont understand the reasoning for this and it would be hard as I cant solder aluminium shielding to the lm335 legs

finally. I note some people suggest putting the 0.1uf at both the supply end and a second one across the legs of the lm335? any thoughts.

As an additional thought. I only ever need two wires. Could I get away with using sheilded coax.

same thing. foil and braid twisted and wired to ground. core carries 5v.

would that eliminate the noise. It seems a cheaper solution than having all those spare wires and I believe shielded coax is quite good for noise reduction

Yes, tou could connect the shield to the BNC outer.

If you are using shielded multi-core it is not a good idea to connect the shield at both ends.

Err . . . If you are only needing two conductors how are you connecting it. Surely you need three, gnd, signal, and 5 V.

A further thought. Are you using a good branded sensor? There are some bad ones being sold cheap on Ebay. I had an LM35 that came from an unknown source that just would not give a stable reading.



For the LM335 its only two pins. I think the LM35 is 3 pin. the adj pin on the lm335 is optional so gets snipped off.

From the arduino side it goes

regulated 5v vcc --> 2.2k resistor -->Analog0 --> Lm335

Thanks for the advice on grounding the shield

Just a final one. whats your thoughts on the 0.1uF cap across the two terminals also at the sensor end?

Some people seem to recommend it?

You never connect the shield to ground at both ends. Only connect it to ground at the Arduino end.

The analog side of all this is hard going.

Im powering my arduino through vin with a dc dc buck module (nice and cheap).

I have read somewhere that because these module go dc > ac > dc via a coil it in some way "interupts" the flow to ground.

Aware Im being a total newbie. but in this case is my ground really ground. i.e gnd on the 5v/0v side of the dc regulator. Is it proper?

Do I need to go driving stakes into bare earth lol

:frowning: I realise I know so little

Sorry, I misread your initial post. Yes, of course the LM335 is two wire. A coaxial cable will be fine. A standard rf cable such as RG58 should be fine and will have lower resistance than the UTP cable so it will give a lower temperature offset. You will, of course have to connect the braid at both ends but that shouldn't be a problem.

Yes, a capacitor at the Arduino input may help. You don't need one at both ends.

I still think your most likely problem is poor connections on the cabling and connectors. Using the BNC connector and coax should fix it.

Good luck.


the arduino is powered by a dc dc buck convertor so the voltage fed to vin is nice and clean 5v

What? Have you ever looked at the output of a DC-DC converter? Its wallowing in noise!
Hopefully about 50mV peak to peak, but still its noise.

A linear regulator can pruduce something far far cleaner.

For logic chips 50 to 100mV of noise is neither here nor there, but for RF or audio its
typically a show-stopper. Linear regulators throughout for sensitive analog circuitry...

The best performance I've got from the ATmega ADC is under battery supply where
a gradually changing input will cause the ADC output to step from one value to the
next, only fluctuating between neighbouring count values for a small time. You never
get that with USB power !

Thats interesting. I feed the dc dc buck with 12v and tune the pot on it to give a 5v output however when I watch it with the multimeter the best I can get is a slow but constantly drift like so

etc etc

So basically 40mv range. Would you kindly be able to suggest a suitable linear regulator to power the circuit. I intend to power it with 12vdc but may need to plug in 9vdc

This is the module Im currently using

are regulator modules available which take a variable voltage and output a clean 5v. Im looking for a whole module. i.e 12v input 5v output with a pot for adjustment.

Recommendations from ebay would be very gratefully received

I found this module based on an lm317. Am I on the right lines for something which will givea clean output?

Why are you using a 12 / 5 V converter?

You haven't said which version of Arduino you are using but most of them have an on-board 5 V linear regulator so that you can feed them directly from 12 V?

You said that it worked fine in the UK but didn't work properly in Australia. Are you using the same 12 / 5 V converter? What else has changed? What else is connected to the Arduino?

I think we need more information to be able to help.


Reason for the 12v to 5v is I use the 12v to switch onto isolated relays. Oh and it's a yun so 5v is never 5v hence I use vcc

And yes same regulator for oz. I ship the board there

Isn't the dc/dc buck converter output ripple at about 50 kHz or more? If so, is your multimeter really showing you the magnitude of the ripple (noise)? Wouldn't you need an oscilloscope?

Interesting point. I think the long integration time on my digital multimeter isnt giving a true picture. I dont have a scope (out of my price range).

I was expecting a cleaner voltage. there a couple oif videos of youtube users showing these cheap dc dc buck convertors connected to a 3 wire led voltage meter. when they ajust the pot the volt meter stays stable.

To eliminate my digital multimeter i bought one of these cheap led voltmeters to try and recreate the demo on youtube. ive not had time to properly test it. But I looks like the voltmeter is showing

5.51 to 5.6 volts.

I.e the voltage rapidly goes


That quite a swing. Especially since the youtube vid shows the module as being stable when connected to the voltmeter.

I bought 5 of these units. one is in my test unit at home one in aus and the other ones in my electronics box.

Sounds like its not regulating very well. I wonder if ive bought a dodgy batch?

Digital meters suck at showing a varying signal. You cannot trust them in that case.