Best  temperature sensor LM35 or 1 wire?

Hi guys, I want to sense about 4 temperatures in a vehicle (say inside, outside, engine and beer fridge). It rarely goes below 0 degrees where I live.

Which is the best temperature sensor LM35 or 1 wire? I am trying to decide what is the best way to go.

I have played around with an LM35 and wrote some stuff that sent the temperature back to Road Runner Car PC front end fairly easilly.

To get a full scale reading out of the LM35, you have to add a negative power rail and then add a voltage to make sure the range is positive for the Arduino to sense. I have found some circuits to do this but I am no electonics guru. I have considered making an LM35 sensor shield with all this stuff on board but am uncertain if I have the skills to do this. Software is not really an issue, I understand C quite well.

I know the one wire system has a library on the playground and has the advantage of using less ports which might be a good idea.

So some info on the pros and cons of the two sensor typres would be appreciated before I rush in and get into trouble.

I'd be inclined to go with the 1-wire. They aren't (theoretically) as accurate, but do you really need that kind of resolution for a beer fridge? :)

The 1-wire examples I've seen so far have all been for just a single device, but that shouldn't be too big of a deal.

1-wire sensors are really easy to use cause there is almost no circuits required to operate. Plus in a cramped environment like a car is, the less wires go around, the better :D You need just one two-poles cable and serially attach the sensors to it.

I'd be inclined to go with the 1-wire. They aren't (theoretically) as accurate, but do you really need that kind of resolution for a beer fridge?

The 1-wire examples I've seen so far have all been for just a single device, but that shouldn't be too big of a deal.

I can't understand why somebody would think keeping beer cold was a trivial application :o Maybe I'll have to incorporate a PID to keep the beer temperature perfect... :D

After looking at the One wire library in the Playground, I thought multiple sensors are supported. Have I got something wrong?

I've never used the 1-wire stuff. But I have used the LM34/35 sensors (34 is deg F, 35 is deg C). They give out an analog voltage that is proportional to the temperature (10mV/deg) that can be read on the Arduino analog input pins. Someone recently suggested setting the analog ref voltage to 1.1v which provides a 0-110 deg range directly from the sensor with no extra circuitry (or 2.56v -> 0-256 deg). Since it's an analog signal, you may need to shield the wires from electrical noise if they are more than a few feet long.

You can have a lot of one wire sensors on one cable run. You just need to know there addresses and communicate with them in turn. The big advantage I can see it that the length of the cable run will not effect the temperature readings. Wouldnt the length of the cables from the LM sensors effect there accuracy?

There are several discussions on this forum on how to do it. http://www.google.co.uk/search?q=DS18B20+site%3Aarduino.cc So you should be able to throw something together very quickly.

Gordon

I recently set up a network of DS18B20 sensors throughout my house to measure room temperature. I also put one outside, but its accuracy is compromised because it gets a lot of sun. But the other 5 work very well. There's an application note on the Maxim site that discusses network design; there's a limit to how much wire you can effectively use, but in a car that really shouldn't be a big problem. It's worth giving the article a read, however. I ran into problems in my house due to wire length and ended up with two buses, each with three sensors.

To read from a single DS18B20, you send the command to initiate temperature conversion, wait a period of time (no more than 750ms), and then send the command to read the data from the sensor. You can also tell all devices on the bus to begin conversion at once and then read from them one at a time, so that you don't have to pause 750ms for each device. Once you know the address of each device on the bus(es), you use the select device/send command/read response cycle. It really couldn't be simpler, and you don't have to calibrate the sensor before using it.

I happen to like the LM34/LM35 myself, but I haven't used the one-wire sensor. I fashioned my own cable for the sensor and it's accurate to within 1 degree Fahrenheit at least. Though the internal reference gives you only 0-110F resolution with the LM34, there is the LM336 2.5V reference diode that you can use in place of the internal reference (it is EXTREMELY accurate) to give you that resolution past boiling point. The LM34/LM35 also reacts relatively quickly for a plastic packaged device, its definitely MUCH better than something like a thermistor.

Thanks for your input guys, I have a couple of DS18S20 sensors to collect on the way home tonight that have arrived from interstate. They are quite a bit more expensive then the LM35's. By the sound of it, I'll be able to get more than 3 devices working on one pin in a vehicle with relatively short cable runs. (Lucky RS-Components are near where I live, shame about their prices though).

One question I have pondered is how do you know where each sensor is when you receive the results back? Is it based on the relative position on the wire?

You have to target a specific sensor when you read the temperature. The address is represented as an 8-byte array which you pass into OneWire::select() before issuing the command to read the temperature. For a scenario where the devices on the bus are known ahead of time, just figure out what the address of each device is ahead of time and hard-code that. Then do "bus.select(inside_cabin_sensor); bus.read();" (simplified, of course). You can also search for devices. It's pretty well documented in the OneWire page in the Arduino playground.

Thanks, I have got two sensors up and running and put one in the freezer to see how it went below Zero. Thermometer probe says -10.2, Aduino says -11.5 so that is close enough for me. I have raised a trouble shooting thread as the code I wrote to identify the sensors did not seem to work as expected.

I noticed the manufacturer's tech notes suggested using cat 5 cabling and I have decided to power the bus to get readings above 85 deg C. At the moment I am using a Cat 5 twisted pair for signal and Ground and the power line on its own. Would that be the best way?

That what I did, Rod. I think it was actually Cat3, but the idea's the same. I went to Home Depot to just get 100' of 4-conductor phone line cord and came out with Cat3, which is three twisted pairs. Given the problem I had getting more than three devices on a bus to work, I've thought about trying to use the twisted pairs to my advantage to try to eliminate noise, but that'd require some circuitry on either end and I didn't really want to get into that. Not sure it that would work in a star topology, anyway...

Connect the 4th wire to ground so you have a ground on each twisted pair. This is how they’re used in networking. The ground wire twisted in with each signal or power wire provides a layer of noise protection from the other pairs and from outside noise.

That’s a great idea. I’ll definitely try that next time I’m using twisted pair!

Thanks guys. Sounds like a good idea to earth the extra

Blalor, The maxim tech note says that star topoogy is the least reliable, on my reading, I thought the most reliable is a single cable with optional fly leads no more than 3 metres long running off it to individual sensors.

I am thinking of writing code for a plug and play solution that will store device serial numbers in EEPROM when a device is added so that we don't have to muck around identifying and hardcoding each sensor serial number. There is enough room in the EEPROM to support 63 devices which is probably way more than any of us need to use.