Go Down

Topic: DS18B20 temp sensors sometimes returning 0.00 (Read 1 time) previous topic - next topic


Sep 28, 2010, 12:21 pm Last Edit: Sep 29, 2010, 01:44 am by ahidau Reason: 1
I had a problem were I had 2 DS18B20 sometimes both returning 0.00. I finally figured out why but thought I'd share the problem and solution. I did a lot of searching and I couldn't find anyone else who had had the same problem. I think this was because I had done very noobish thing.

Hardware setup
- Duemilanove
- WiShield 2.0
- 2 DS18B20 temp sensors were connected (not parasiticly)

- WiShield library 1.13
- DallasTemperature library 3.4
- OneWire 2.0

The temp sensors worked fine with just the DallasTemperature multiple example. I mashed this example with the WiShield WiServer example (simple web page returning temps) and started getting temps of 0.00 for 1 in 3 reading. I removed the serial printing of the temp readings and but was still getting 0.00 for about 1 in 20 readings.

Turns out that I was stupidly using pin 2 to communicate with the sensors when the WiShield was using it as an interrupt.

Moral of the story, for me atleast, is make a list of all the pins on the board and note what hardware is using what pin.

Hope this helps someone else just starting on the Arduino path.

(edit: spelling)


Thanks for posting it. I had a similar problem with the servo library and timers. Documenting used resources is just so much more important in embedded systems than for normal application programming.



I can highly recommend these sensors btw. I have them both right next to each other on a breadboard. Most of the time they are exactly the same temp and very occasionally they are 0.06 degrees apart. I'm running them in 12 bit mode. Since I fixed my pin assignment mistake, they have behaved flawlessly.


Sep 29, 2010, 09:28 am Last Edit: Sep 29, 2010, 09:30 am by stephen_t Reason: 1
I suspect its your sketch.  I run a total of 8 of these on two arduinos. I read them all once a minute and graph them (for over a year now). I get the odd glitch (one giving an erroneous reading around once a month maybe) but on the whole they they are very reliable. I agree with ahidau, they are also very accurate and repeatable. When I was trialling them I has 5 together on a breadboard, they all read within 1/16 of a degree of each other and comparing them with several trusted thermometers they were accurate to the limit of my existing thermometers.



I have exactly the same hardware but struggle with the programming, I will PM you as I was hoping to get your sketch.



Since I last posted in September I've noticed it occurs more often in winter, since I  have an interrupt driven gas monitor it trips up more when I'm using more gas which fits in with the interrupt theory.  I over read the thermometers and ignore readings if they are more than a degree or two away from the previous reading.  Crude but effective..........


- DallasTemperature library 3.4

FYI : Version 3.6 is allready available - http://download.milesburton.com/Arduino/MaximTemperature/DallasTemperature_360.zip
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Go Up