Need a source for a GENUINE DS18B20 in the waterproof configuration

Hi,

I am using an Arduino Uno to pulse IGBTs and control motor power in a car I'm converting to full electric (DC Forklift motor). The motor controller works now.

One thing I'm now trying to implement is a temperature sensor that's going to sense the IGBT's. If they start getting hot, the Arduino code cuts the power to the IGBTs and runs the system at reduced load. If it gets hotter still, it would shut down the motor.

Here's the deal: the DS18B20 I used is super flakey. I have tried different resistors, decoupling capacitors, etc., but when I am testng the system and raising the temp on the probe to intiate the backoff/shutdown logic I start seeing temp readings like -127 popping up. Sometimes I get the flakey readings when nothing is happening and it's only reading ambient room temperatures.

I suspect a bad knockoff sensor, which won't do in a real car. I need rock solid stability.

Where can I buy the genuine article?

Depends where you live. Any of the large electronics parts suppliers like Digikey, Mouser, Farnell, RS, Element14 etc. can't afford the hassle of factory-lot returns.

"waterproof sensor" might be a Chinese thing only, because they are not.
You might have to make your own, with blank stainless tubes or thermowells.
Fill with epoxy glue and seal with hotglue-lined heatshrink.
Leo..

2 Likes

There may not be anything wrong with your sensor - try running it on it’s own with an example sketch .
The best approach for wet applications is to buy or make a thermowell . ( I’ve two in a pond for years now ), as previously said .
The so called waterproof ones are not at the cable side , only the tip .

You sketch and wiring may be an issue , especially how you power the external bits .
So code and sketch would be useful .

None of the above suggests a faulty sensor, but they do suggest user error, maybe mechanical. I have never heard of a dud waterproof sensor.

I have read that some fake ones stop working above about 60 degrees C.
Never had that problem myself.
Leo..

Hi,
I helped a friend with a brewery project. There were several DS18B20 sensors. They were purchased from a Chinese shopping site. Some kept varying between actual readings and -127 values. The problem was only resolved by replacing all sensors with sensors purchased from Mouser.

I have semi-recently had issues with the chinese sensors myself.
They seem to work fine when you only use one and have short wire runs
my project required 2 sensors on a 5 meter run. most often getting the -127 error. And yes I followed the advice posted in these forums for wire layout, pullups and caps.

Getting quality waterproof sensors from Adafruit fixed the issues.

Thanks everyone. By waterproof, I really just meant in a metal probe case, not the thing that looks like a naked transistor.

I did run these probes with simpler, different code. I do get the intermittent -127 there as well.

I'll get one of the Mouser/Digikey ones... if it fixes it, it fixes it. I'll report back.

The Dallas temperature sensor DS18B20 in a standard TO92 case from a reputable US distributor runs about $8.50 to $10.00 per single unit. However, off the boat they sell for about a buck each. So out of curiosity I bundled ten of the off the boat flavors in a right common thermal environment, at ambient room temperature along with a standard liquid mercury in glass thermometer and allowed time for things to stabilize. The results look like this.

I have not run them over a large temperature span.

I do have 5 of the encapsulated versions off the boat which eventually I will wrap in a nice thermal conductive bundle around a heater tube element and see what we get. While these numbers are close and consistent with no bad readings they do run close. Not quite to specification but close.

These examples were run on a node MCU 8266 module.

Newark Electronics $8.62 Each but a lead time of December 2023 (over a year)
Digikey reflects Obsolets.
Then I also see Digikey in stock for DS18B20+PAR so best luck on your search. :slight_smile:

Ron

The Dallas Semiconductor part number is no longer current. Maxim have begun to no longer use the DS part numbers. They are now designated as MAX31820MCR from Maxim and run about $4 from Digikey.

You might consider a NTC** resistor instead. Good stability, easy to filter when noise picked up by the IGBT. NTC resistors are pretty much the standard in home thermometers, grill thermometers etc.

** Negative Temperature Coefficient

Thanks for clearing that up for me. :slight_smile:

Ron

1 Like

So... I got the reputable part from DigKey, wired it up most carefully, and this is the input I get now:

6:06:36.524 -> Temperature from Sensor: 85.00 *C
16:06:37.007 -> potentiometer = 134t motor = 0
16:06:37.041 -> Temperature from Sensor: 85.00 *C
16:06:37.553 -> potentiometer = 136t motor = 0
16:06:37.587 -> Temperature from Sensor: 85.00 *C
16:06:38.061 -> potentiometer = 127t motor = 0
16:06:38.098 -> Temperature from Sensor: 85.00 *C
16:06:38.585 -> potentiometer = 132t motor = 0
16:06:38.621 -> Temperature from Sensor: 85.00 *C
16:06:39.123 -> potentiometer = 130t motor = 0
16:06:39.156 -> Temperature from Sensor: 85.00 *C
16:06:39.667 -> potentiometer = 153t motor = 5

The motor controller is working fine, but the only Temp reading is always 85 C.

The temperature in my shop is, BTW, around 50 degrees F. So!

Something's wrong.

Here's my code:

#include <OneWire.h>
#include <DallasTemperature.h>

OneWire oneWire(2); //Sensor signal pin is connected with DPin-2
DallasTemperature sensors(&oneWire);// Pass our oneWire reference to Dallas Temperature.
int potPin = A0;
int motorPin = 9;
int potValue = 0;
int motorValue = 0;

void setup(void)
{
  Serial.begin(9600); // start serial port
  sensors.begin();    // Start up the library
  //TCCR1B = TCCR1B & B11111000 | B00000101; // enable to set for PWM frequency of 30.64 Hz
  //pinMode(5, OUTPUT);  //DPin-5 is output to drive LED2 (yet to test)
  //pinMode(13, OUTPUT);  //DPin-13 is output to drive L (built-in LED og UNO)
  pinMode(9, OUTPUT); //readies pin 9
  pinMode(A0, INPUT); //readies analog in
  pinMode(2, INPUT); //readies pin 2

}

void loop()
{
Serial.print("Temperature from Sensor: ");
float myTemp = sensors.getTempCByIndex(0);
delay(500);// allows time for Temperature sensor libraries to load and stabilize
Serial.print(myTemp, 2);//2-digit after decimal point
Serial.println("  *C");
potValue = analogRead(potPin);   
 motorValue = map(potValue, 137 , 895, 0, 245);// sets scale to Subaru pedal
  if (motorValue < 0) motorValue = 0; //never drop below zero
  if (motorValue < 4) motorValue = 0; //stop random judders
  if (motorValue > 245) motorValue = 245; //caps top end
 //if (myTemp>21)  motorValue=motorValue/2; //Cuts motor power whenever temp exceeds value
 //if (myTemp>31)  motorValue=motorValue/4;
 //if (myTemp>41)  motorValue=motorValue/8;// in prod do 65,75,80
 analogWrite(motorPin, motorValue);  //Sends PWM signal out
 Serial.print("potentiometer = " );     
 Serial.print(potValue);
 Serial.print("t motor = ");  
 Serial.println(motorValue); 
 
}

/>

The 1-wire sensor takes 750ms for a conversion. Did you test to see if a serial number is returned from the sensor?

What size pull-up resistor are you using? Post a schematic of the 1-wire circuit and a picture of the actual wiring. Verify that you didn't get the -PAR version of the sensor.

The delay 500 may be insufficient and is for the wrong reasons. Try a delay( 1000) .

Don't you have to call this

sensors.requestTemperatures(); // Send the command to get temperatures

before you get the temperature?

That's the way the example does it:

  // call sensors.requestTemperatures() to issue a global temperature
  // request to all devices on the bus
  Serial.print("Requesting temperatures...");
  sensors.requestTemperatures(); // <<<<<<<<<<<<<<<<<<----------------------
  Serial.println("DONE");
  // After we got the temperatures, we can print them here.
  // We use the function ByIndex, and as an example get the temperature from the first sensor only.
  float tempC = sensors.getTempCByIndex(0);

requestTemperatures() is AFAIK blocking, so the vaue of delay() doesn't matter.
Must be called though, before printing.
Leo..

47k

Where would I put that statement?

Tried shorter and longer