SD Shield Problem with DS18S20 or Visa Versa

Hello Fellow Arduinoids,

i encountered a nice problem with my Arduino Uno, and 2 DS18S20 sensors and a SD Shield.

for some reason which i dont understand, the communication between the SD Shield and writing data to a SDcard works flawlessly, but without the DS18S20. I tried them on the Digital pin 7 on a ladyada SD Shield. It creates a file then stops and doesnt show the data being written to a file. if i comment out the DS18S20 part the SD Shield will work flawlessly again. so i started looking on the Forum about the 1 Wire, and 4 Wire protocols. What i noticed is that the are included on different pins, but for some reason they still communicate with each other.

The question is how can i log data from my Temperature sensors, and show them on the Serial Monitor?

elsewise i have to go back to the all consuming pin configuration of the LM35s which will chew up 4 analog pins for a full scale measurement.
and use a not so accurate SRTC(software Real Time Clock).

I really would like to know the answers to the problem and how it can be solved. Because i think the DS18S20 are more reliable and have less heat disturbances compared to the Full scale LM35 schematics/configuration.

Tx for the replies and answers.

sincerly Yours


DS18S20RTCFINAL.ino (10.2 KB)

DS18S20RTCFINAL.ino (10.2 KB)

  //Write here the analog/digital inputs/outputs
  pinMode(SA0, INPUT);             //def Pin TEMP INTERNAL +
  pinMode(SA1, INPUT);             //def Pin TEMP INTERNAL -
  pinMode(SA2, INPUT);             //def Pin TEMP EXTERNAL +
  pinMode(SA3, INPUT);        //def Pin TEMP EXTERNAL -
  pinMode(SA4, INPUT);             //def Pin Current Sensor
  pinMode(SA5, INPUT);             //def Pin Voltage Sensor

Wrong. The pinMode() function does nothing with analog pins. You are screwing with the serial pins.

  pinMode(10,OUTPUT);                         // Needed for SD

But not in loop(). This belongs in setup().

Is it necessary, on every pass through loop(), to locate the temperature sensor again?

  //delay(1000);     // maybe 750ms is enough, maybe not

For sure, 70 nanoseconds is not.

  celsius = (float)raw / 16.0;
  fahrenheit = celsius * 1.8 + 32.0;
// Serial.print("Temperature=");

Why are you computing fahrenheit? You never use it.