I am using a TO-92 package DS18B20 temperature sensor for an analog clock I built. It worked fine for about a week, then when I unplugged it from the bedroom and connected it again in the computer room, everything worked except the temperature. It only displays the value of 262.28 degrees (as shown in the Serial Monitor). The 8x32 matrix I'm using to display temperature shows the same value.
I tried switching the OneWire bus pin on the Mega to a different one. No change. I tried several pullup resistor values (from 4.7k to 3.2k, 1.8k, 1.5k, and even 10k) with no change. I tried 4 other sensors, three TO-92s and one waterproof variety). One of the TO-92s gave me the same 262.28 degrees. Others gave me obviously inaccurate readings (in the 50's Fahrenheit in my computer room!). I haven't used any of these other sensors before except to get their addresses. They might have been goofy all along.
My question, though, is does anybody know what the 262.28 degree (F) reading means? I've looked on the Arduino website's forum and have done Google searches, but can't find anything definitive.
if you convert -262.28 degrees F to Celsius the result is -127. That is familiar! It means 'no connection'. Presumably you have an interrupted wiring. Check the wires!
That's a really good catch, photoncatcher! However, the wiring was good, then I re-did all the connections just to be sure. They're definitely solid now, and the same 262.28 comes up. By the way, my output is positive. Also, I've always read that -196.6 is a not-connected situation (which I've seen lots of times over the years). I read that in DallasTemperature.h. I do wish it were as simple as wiring!
Thanks
I've been thinking HARD about this problem. I've re-wired everything, meaning not just connections, but the wires, themselves. I've changed pullup resistor values. I've changed output pins on the Mega used for the OneWire bus. I tried other DS18B20s, and still, no accurate values.
One thing I hadn't tried, though, was to take the "faulty" DS18B20 from the Mega and connect it to another microcontroller. I made a teensy sketch on an Uno, and connected the "faulty" sensor to it. It worked perfectly, displaying accurate temperature output to the Serial Monitor.
So what's the only other thing it could be? I noticed earlier today, that the output from the voltage regulator I'm using for all components of the Analog Clock except for the Mega (the Mega has its own regulator) was a bit higher than it was when I set it up. Could the regulator be bad? I connected the DS18B20 directly to one of the Mega's +5 pins instead of to the voltage regulator's output (and yes, the regulator's output and the Mega are grounded together). The temperature is now being displayed accurately! I don't have an O-scope (and likely couldn't remember how to use one anyway), but I suspect this voltage regulator is noisy somehow. Guess who is going to pitch that voltage regulator and replace it with a better one! So far (knock on wood), after observing the output for 45 minutes or so, this problem seems to be solved.