Playing with temperature sensors on breadboard is cool, but usually, if one has more than one sensor, one likes to get some distance between them.
These are no scientific tests, but in my real world application, LM35 likes shorter cables. The shorter the better, or it will get large fluctuations in measurements.
A cable about 3 meters is as long as I would go. Cable length of 5 meters got me into trouble. Consecutive readings did vary in more than 5 degrees. Not good.
Cables as long as 1 or 2 meters are good enough, but to get a constant reading from a sensor, I discard the first reading, as it seems to be the most inaccurate one, then read several times and get an average.
As far as I tested, there was no difference if I used a better cable. So a standard 4 wire 0.22mm signalization cable is what I had and used. Do 3 wire cables exist?
DS18B20 works with longer cables. As it is one wire device, only two wires are needed 🙂
A test with a 100 meters of cable was unsuccessful, but about 20 meters works well enough. Sometimes I get a false reading of -127.0 degrees Celsius, but it seems that I can get this on 3 meter cable as frequently as on 20+ meter cable.
At least DS18B20 also works in star configuration, so multiple wires can start from one point.
I used 2-wire telephone cable here.
So right now I have an Arduino board with 6 temperature sensors –
3 x LM35 with 1, 1.5 and 2 meter cables and 3 x DS18B20 with 2, 10+ and 20+ meter cables.