DS18b20 one wire problem

Hi,

I have 3 DS18b20 temperature sensors. I have .NET web site that reads values trough serial port.
Also I have 4 thermistors connected on analog ports.

Most of the time it shows normal temperature. The problem is that sometimes it show 0°C or -127°C.

When it shows 0°C or -127°C the sensors also aren't discovered by arduino even on reset.

I still didn't figure out the way to get it working. I think when I shutdown everything and then turn it on after a while it works normaly for some time.

How can I troubleshoot this?

Regards,
Dusan

Some folks (including myself) have had issues using parasitic power - is that how you have your wired?

I had parasitic power yes, but after the troubles started I'm using normal power mode. I have 4,7K resistor on data pin.
Anyway there is no difference with one mode or the other...

Sorry to hear that switching away from parasitic power didn't fix things... but it was still a good thing to do, and will probably save you problems in the long run.

ALWAYS 0 or 127 when it mis-reads? That should tell me something... but I can't think what it is.

You ARE giving it time to do the read, aren't you?

I think some 1-Wire programs... maybe even some of mine... rely on something I'd rather NOT rely on. For "robust" DS18xx reading...

Tell DS18xx you are GOING TO want to know the temperature.
Wait. 1 second is more than enough. You can reduce that if you are clever, but who needs to read temperatures more than 3600 times an hour?
THEN ask DS18xx what the tture was.

The main problem is what I think that it doesn’t detect the sensors at arduino power ON or reset.

This is code in setup phase:

Sensors.begin();
Serial.print(“Found “);
Serial.print(sensors.getDeviceCount(), DEC);
Serial.println(” devices.”);

Serial.print("Parasite power is: ");
if (sensors.isParasitePowerMode()) Serial.println(“ON”);
else Serial.println(“OFF”);

if (!sensors.getAddress(S3, 2)) Serial.println(“Unable to find address for Device 2”);
if (!sensors.getAddress(S2, 1)) Serial.println(“Unable to find address for Device 1”);
if (!sensors.getAddress(S1, 0)) Serial.println(“Unable to find address for Device 0”);

The code shuld print number of devices found and power mode…else write errors.

Do I need some other type of resistor maybe?

Looks like that one of the sensors was faulty somehow. I replaced it and hope that will solve the problem…

but who needs to read temperatures more than 3600 times an hour?

Sometimes you want to measure energy e.g. E = temperature * waterflow . The smaller time interval you can measure the better the integration can be done. But the flow sensor must produce (preferably) more than one “pulse” per time interval otherwise you would get a waterflow of 0 and thus 0 energy for that timeinterval.

In a project I measured twice per second, to be able to react quickly if the water started to heat up.

Another reason to measure temperature fast is to determine the speed of the flow. If water heats up and it passes sensor 1 at t=0, and sometime later sensor 2 at distance=D at t=n, you want to be able to time this as good as possible. A rough timing is that the speed = D/n. By interpolating the temperatures at sensor 2 one can determine the moment even more precise. (read this in some tech magazine, Elektor?)