Issue with DS18B20 temp sensor(s) and Teensy 3.6

oudevolvo

Member
In a project I am using six DS18B20 temperature sensors on a Teensy 3.6.
I'm using the 'local power' approach in which I am powering the DS8B20's from the 3.3V out pin from the Teensy.
Furthermore I have a 4,7 kOhm pullup in place between this 3.3V power source and the signal.

It all worked fine until a sensor warmed up.
I saw a value of 38 degrees and then jumping to 85 degrees.
Then the Teensy 'went offline'. All processes stopped and it disappeared from USB and no serial connection was possible etc.

Online I found:
"The power-on reset value of the temperature register is +85°C"
So I guess it got in power-on reset.

Hope you can think along in what is happening here. My questions are:
  • Why is it upsetting the Teensy?
  • Is it perhaps a faulty or broken sensor?
  • Is the 4,7 kOhm too high when powering it with 3,3V instead of 5V and should I reduce that to 3,3 kOhm to again have 1 mA current (now only 0,7mA)?
Thanks in advance.
 
Last edited:
If you have the Vdd of the sensors wired to the Teensy 3.3Vpin then you shouldn't use the 4.7k pullup. That is only for the 'parasitic' power mode which also requires a FET if more than 1 sensor on bus.
 
The power on reset value will change once the processor has performed a valid read of the temperature.
I've been using a pullup of 3.3kohm on 3.3V Teensys.
I've never had a DS18B20 fail on me but I suppose it is possible that one shorted out the power.
Can you remove all but one of the DS18B20 and try a scanner to check each sensor individually? This scanner code will find all the DS18B20 on the specified pin (default pin 10).
Code:
#include <OneWire.h>

// >>> SET THE PIN NUMBER HERE <<<
OneWire  ds(10);

/*
  I've modified this to identify DS18B20 and DS18S20.
  Enumerate any DS18B20 on the OneWire bus.
  A table of family codes is here:
  http://owfs.sourceforge.net/family.html
  and here:
  http://owfs.org/index.php?page=family-code-list

  DS18B20 datasheet
  http://datasheets.maxim-ic.com/en/ds/DS18B20.pdf

  From the datasheet:
  "The least significant 8 bits of the ROM code
   contain the DS18B20’s 1-Wire family code: 28h."

*/

// DS18B20 address data
byte addr[8][8];

void print_rom(byte *p)
{
  if(*p == 0x10)Serial.print("DS18S20 ");
  else if(*p == 0x28)Serial.print("DS18B20 ");
  else Serial.print("        ");

  Serial.print("ROM =");
  for(int i = 0; i < 8; i++) {
    Serial.write(' ');
    if(*p < 10)Serial.print(" ");
    Serial.print(*p++, HEX);
  }
  Serial.println(" ");
}


void setup(void)
{
  byte i;

  Serial.begin(9600);
  while(!Serial);
  delay(2000);
  
  Serial.println("Start");

  i = 0;

  while(ds.search(addr[i])) {
    if (OneWire::crc8(addr[i], 7) != addr[i][7]) {
      print_rom(addr[i]);
      Serial.println("CRC is not valid! - ignored");
      continue;
    }
    print_rom(addr[i]);
    i++;
  }
  if(i == 0) {
    Serial.println("Nothing found");
  }
  Serial.println("Done");
}


void loop(void)
{
}

Pete
 
If you have the Vdd of the sensors wired to the Teensy 3.3Vpin then you shouldn't use the 4.7k pullup. That is only for the 'parasitic' power mode which also requires a FET if more than 1 sensor on bus.

On the contrary a 4k7 pullup is standard for OneWire devices. Parasitic power mode also requires the 4k7 pullup and a FET hard pullup as
well during the conversion phase. I've used 20 DS18B20 's on a single bus (not parasite power), using 4k7 pullup, running 24/7 for years.
If you look at the datasheet every circuit shows the 4k7 pullup...

One thing to note is that you need to buy DS18B20's from reputable source, they are largely counterfeit from eBay and the like.
 
Thanks your your replies.
For now my solution is to just keep that sensor disconnected. It is not critical and it is a huge job to replace it.
Will replace the resistor from 4.7 kOhm to 3.3 kOhm to test.
But since the readings were fine unit it heated up I am afraid the sensor is shorting the power supply when it warms up.
Unfortunately I did not buy from a reputable source so I think that is the root cause.
I prefer the waterproof model and not the open resistor type.
Any suggestions for a reputable source of those?
I saw Mouser stocks the SEN-11050 by Sparkfun
10 times more expensive compared to the ones I have bit not when taking into account the time required to replace it.....
Penny wise pound foolish, lesson learned!
 
Back
Top