DS18B20 temperature sensor reading negative values

Other than control. (Navigation, Sonar, Ect.)
Post Reply
rjamaro
Posts: 10
Joined: Oct 17th, 2015, 1:10 pm
Location: Portugal

DS18B20 temperature sensor reading negative values

Post 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
Jaman42
Posts: 94
Joined: Nov 3rd, 2014, 4:19 am

Re: DS18B20 temperature sensor reading negative values

Post 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.
rossrov
Posts: 383
Joined: Feb 28th, 2013, 5:01 pm
Location: Australia

Re: DS18B20 temperature sensor reading negative values

Post 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.
rjamaro
Posts: 10
Joined: Oct 17th, 2015, 1:10 pm
Location: Portugal

Re: DS18B20 temperature sensor reading negative values

Post by rjamaro »

Thanks,

I'll check the timers clue and I'll keep you posted.
rjamaro
Posts: 10
Joined: Oct 17th, 2015, 1:10 pm
Location: Portugal

Re: DS18B20 temperature sensor reading negative values

Post by rjamaro »

Problem solved. It was a problem caused by RS485 connection.

Thank you all
Post Reply