OneWire Data Connections

Hey all -

I'm hoping to get a little help on the tutorial from Arduino 1-Wire Tutorial.

I am trying to use a single DS18b20 temperature sensor to get a read on ambient air.

My issue is, I am able to get my thermometer's serial number/device address (in my case it is 0x28, 0xFF, 0x46, 0x93, 0x85, 0x16, 0x05, 0x7), but when I replace the address included in the sample code with mine, I get the " Error getting temperature" message. Looking at the sample code, I know this is saying that my reading is -127C (which I've confirmed thru a direct read on pin 3), but I'm not sure why this is happening since the wiring is correct and I am able to get a read of the address.

I guess my questions are:

  1. When there is a call to read the data from the thermometer, why would I be able to retrieve the address but not a correct temperature?

  2. Has anyone else ran into this issue, and what was done to correct it?

A few more points that hopefully help:

  • I'm running into the same issue even when I replace the sensor and its address in the code.
  • The same thing occurs when I try running on a different board (Uno or Mega does not make a difference).

Any help would be appreciated!

Do you have the required resistor between VCC and the DATA pin?

Paul

Hi Paul - Thanks for the quick reply. Yes, I have a 4.7k Ohm pull-up resistor in place. I haven't tried to remove it as I don't want to damage anything, but I assume if it was not there I would not be able to get a read of the device's address.

Try the Dallas Temperature simple temp program. Mine worked right off.

Paul

I removed and replaced the OneWire and DallasTemperature libraries and again retrieved the device serial. However, instead of placing the serial in the code from the link above, I put it in the Simple example in the DallasTemperature folder and how about that... it worked perfectly.

I am able to get my temperature now. It seems there is some sort of error with the original sample code I downloaded so for others who may have this issue that folder is the way to go to get up and running straight away. The only change I did from the sample code I started with to the Simple sketch you pointed me to was changing the input from pin 3 to 2.

Thanks Paul, really appreciate the help.

Good for you! Who know why things like that happen? Now on to the next problem, eh?

Paul