Page 1 of 1

DS18B20 temperature sensor reading negative values

Posted: Nov 17th, 2015, 4:25 am
by rjamaro
Hi,

I'm trying to use the DS18B20 as a temperature sensor for my project. As a small trial project, I connected the data wire to pin 2 of my Arduino Uno and it reads the temperature wonderfully, yet when I send a command to turn on LED's connected to the remaining pwm ports the temperature sensor starts reading -175... when I send a command to turn off the LED's, the sensor starts reading temperature again.

The odd behavior happens even if I turn only one LED ON. I also experienced that when the sensor is reading the temperature ok if I touch it the value that I get while reading temperature is always 85...

Did any of you had the same issues with this sensor? If so how did you solve the problem?

Kind regards,
Ricardo

Re: DS18B20 temperature sensor reading negative values

Posted: Nov 17th, 2015, 6:26 am
by Jaman42
I think there is a greater chance that someone can help you out if you also post your code and perhaps a drawing showing how you have connected everything.

Re: DS18B20 temperature sensor reading negative values

Posted: Nov 17th, 2015, 3:04 pm
by rossrov
Hi Ricardo. I have not used the "one wire" devices or library/function before but am guessing it uses one of the timers. If so I suggest that you find out which Arduino timer (there are 3 in the Uno) is being used by the 18b20 or "one wire" library, and make sure that any other functions you have in your program do not use the same timer. For example, analogWrite uses one of the timers, and if "one wire" uses the same timer then problems are likely. If that is the case, all is not lost. You can use a spare timer to do your own analogWrite to control the lights.

Re: DS18B20 temperature sensor reading negative values

Posted: Nov 23rd, 2015, 8:19 am
by rjamaro
Thanks,

I'll check the timers clue and I'll keep you posted.

Re: DS18B20 temperature sensor reading negative values

Posted: Dec 2nd, 2015, 12:13 pm
by rjamaro
Problem solved. It was a problem caused by RS485 connection.

Thank you all