Digital Temperature thermometer DS18B20

hi to all!

i wish to know if any have some example of how to know the temperature in centigrades from this sensor:

i'm newbie and i don't have idea! also de wiring diagram :S :smiley:

i found something than can be help.

this will be un void loop

void loop()                     // run over and over again
{
 //getting the voltage reading from the temperature sensor
 int reading = analogRead(sensorPin); 

 // converting that reading to voltage, for 3.3v arduino use 3.3
 float voltage = reading * 5.0 / 1024;
 
 // print out the voltage
 Serial.print(voltage); Serial.println(" volts");
 
 // now print out the temperature
 float temperatureC = (voltage - 0.5) * 100 ;  //converting from 10 mv per degree wit 500 mV offset
                                               //to degrees ((volatge - 500mV) times 100)
 Serial.print(temperatureC); Serial.println(" degress C");
 
 // now convert to Fahrenheight
 float temperatureF = (temperatureC * 9 / 5) + 32;
 Serial.print(temperatureF); Serial.println(" degress F");
 
 delay(1000);                                     //waiting a second
}

  //my code ends here.

  // you can have code that is time sensitive (e.g. using 'delay'), but
  // be aware that it will be affected by a short pause during connecting
  // to and reading from ethernet (approx. 0.5 to 1 sec).
  // e.g. this code should carry on flashing regularly, with brief pauses
  // every few seconds during Pachube update.

  digitalWrite(6, HIGH);
  delay(100);
  digitalWrite(6, LOW);
  delay(100);

}

thanks for your help

I think this is what you want: Using a DS18B20 Temperature sensor with an Arduino- ar3ne1tt - always check the Arduino playground as it may point you to the answer :wink:

Check this lib - MilesBurton.com - it contains several examples for the DS18B20

That sensor only, always returns the temperature in Celsius.

If you want to give Fahrenheit to your user, you make the conversion in software.

Of course GETTING the temperature reading in the first place isn't trivial, but the resources given above tell you how.

Please modify thread title to include 1820 in it for people?

title fixed :stuck_out_tongue:

also i will try this weekend, any advanced i will post for yours. =)

thanks