I'm running the circuit and sketch from this tutorial, which uses the DS18B20 thermistor:
My circuit is the 'normal' option, reproduced below.
But I'm wondering about the accuracy of the result. My commercial unit that I believe accurate says 19.4 versus 24.1 from the Arduino citcuit. Both probes are suspended and are a mere inch apart.
I assume a Vcc of 5.0 is used; mine (via USB) is 4.86.
I had no 4k7 resistor at hand so used 5K1.
Assuming both of those cause a linear reduction would combine to give a result of 21.7, 2.3 below the program's output.
Comments appreciated, especially from anyone with experience of similar circuits please.
/*********
Rui Santos
Complete project details at https://randomnerdtutorials.com
Based on the Dallas Temperature Library example
*********/
#include <OneWire.h>
#include <DallasTemperature.h>
// Data wire is conntec to the Arduino digital pin 4
#define ONE_WIRE_BUS 4
// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature sensor
DallasTemperature sensors(&oneWire);
void setup(void)
{
// Start serial communication for debugging purposes
Serial.begin(115200);
delay(200);
Serial.print("TalkingTemp-DS18B20-Single");
// Start up the library
sensors.begin();
}
void loop(void){
// Call sensors.requestTemperatures() to issue a global temperature and Requests to all devices on the bus
sensors.requestTemperatures();
Serial.print("Celsius temperature: ");
// Why "byIndex"? You can have more than one IC on the same bus. 0 refers to the first IC on the wire
Serial.print(sensors.getTempCByIndex(0));
Serial.print(" - Fahrenheit temperature: ");
Serial.println(sensors.getTempFByIndex(0));
delay(1000);
}


Where did you buy your DS18B20? There are lots of "counterfeits" floating around on E-Bay, Ally, Amazon, etc. While not really counterfeit, they may be "rejects" kicked out by the manufacturing QC equipment for being out of spec (+/-0.5°), then bought in bulk and resold as "genuine" by unscrupulous sellers.
It's 23:00 here now, the Sun has been down for perhaps a couple of hours, outside is a shade over 17°, I'm indoors at around 21.5° in jeans and a polo shirt and very comfortable.
I don't imagine I'd be "cool" at 19.4°
Thanks, understood. I will test over a larger range tomorrow and see how the difference varies, ( I thought perhaps by ‘offset’ you were referring to circuitry voltages.)
Thanks, interesting and I will. But I haven’t a clue how to perform this ‘pathetically simple’ test!
Regarding (II), there is one pathetically simple test for differences with Maxim-produced DS18B20 sensors that apparently all counterfeit sensors fail [5]:
It is a fake if its ROM address does not follow the pattern 28-xx-xx-xx-xx-00-00-xx [5]. (Maxim's ROM is essentially a 48-bit counter with the most significant bits still at 0 [5].) Also, with the exception of rare Family A2 and Family E, none of the fake sensors adjust reserved byte 6 in the scratchpad register correctly. Only the fake sensors of Family A2 respond correctly to undocumented function codes regarding the Trim values.