Pages: [1]   Go Down
Author Topic: DS18B20 Temperature Sensor returns "No more addresses."  (Read 2897 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

After hours of trying, you are my last resort of hope.

I'm using the DS18B20 Temperature Sensor and tried to install it based on this OneWire-tutorial here:
http://www.arduino.cc/playground/Learning/OneWire

As I understand it the breadboard should look like this:

(the flat surface is facing to the front in this picture)
Unfortunately I have no 4.7k resistor, so I took two 2.2K resistors.

The code (taken from the tutorial) is this one:
Code:
#include <OneWire.h>

// DS18S20 Temperature chip i/o
OneWire ds(10);  // on pin 10

void setup(void) {
  // initialize inputs/outputs
  // start serial port
  Serial.begin(9600);
}

void loop(void) {
  byte i;
  byte present = 0;
  byte data[12];
  byte addr[8];

  if ( !ds.search(addr)) {
      Serial.print("No more addresses.\n");
      ds.reset_search();
      return;
  }

  Serial.print("R=");
  for( i = 0; i < 8; i++) {
    Serial.print(addr[i], HEX);
    Serial.print(" ");
  }

  if ( OneWire::crc8( addr, 7) != addr[7]) {
      Serial.print("CRC is not valid!\n");
      return;
  }

  if ( addr[0] == 0x10) {
      Serial.print("Device is a DS18S20 family device.\n");
  }
  else if ( addr[0] == 0x28) {
      Serial.print("Device is a DS18B20 family device.\n");
  }
  else {
      Serial.print("Device family is not recognized: 0x");
      Serial.println(addr[0],HEX);
      return;
  }

  ds.reset();
  ds.select(addr);
  ds.write(0x44,1);         // start conversion, with parasite power on at the end

  delay(1000);     // maybe 750ms is enough, maybe not
  // we might do a ds.depower() here, but the reset will take care of it.

  present = ds.reset();
  ds.select(addr);    
  ds.write(0xBE);         // Read Scratchpad

  Serial.print("P=");
  Serial.print(present,HEX);
  Serial.print(" ");
  for ( i = 0; i < 9; i++) {           // we need 9 bytes
    data[i] = ds.read();
    Serial.print(data[i], HEX);
    Serial.print(" ");
  }
  Serial.print(" CRC=");
  Serial.print( OneWire::crc8( data, 8), HEX);
  Serial.println();
}

I am using the OneWire 2.0 library: http://www.pjrc.com/teensy/td_libs_OneWire.html


All I get in the Serial Monitor is "No more addresses."
What does this error mean? How can I fix it?

Thank you so much for your answers!


* DS18B20_Tutorial.png (82.32 KB, 766x419 - viewed 284 times.)
Logged

Lancashire, UK
Offline Offline
Edison Member
*
Karma: 9
Posts: 1991
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The resistor should be connected to the 5V line rather than Gnd.  (Pull up, not pull down).
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Pluggy

Thank you for your fast answer!

I tried that. Now the setup looks like this:


But still I get "No more addresses."
Any other guesses?


* DS18B20_Tutorial2.png (82.35 KB, 765x424 - viewed 262 times.)
Logged

Lancashire, UK
Offline Offline
Edison Member
*
Karma: 9
Posts: 1991
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you got another DS18B20 you could try ?  If you're using 'stock' code it should work.  You could try just one 2.2k resistor or a 10k if you have one (its not cast in stone , nor an exact science).  No more addresses suggests it isn't seeing anything on the bus.
Logged


Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 223
Posts: 13876
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


some additional tests I would do:
- test pin 10 - just a simple digitalRead(10) HIGH/LOW test
- use other cables.
- use another place at the breadboard
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Pluggy and robtillaart

Thank you so much for your input!

I tried the following:
- use another place at the breadboard  and
- use other cables.
- just one 2.2K resistor instead of the 4.7K-resistor

Not it finds the DS18B20!

Great! smiley

PS. @all: if you haven't tried it out yet, use the Dallas Temperature Control Library:
http://milesburton.com/index.php/Dallas_Temperature_Control_Library
So much more easier to use than the demo-code in the tutorial!
« Last Edit: February 22, 2011, 02:15:19 am by arduinotestbox » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I had the same problem, the 2.2K resistor solved it!! All other tutorials were referring tot the 4.7K one... smiley-neutral
Logged

Dee Why NSW
Offline Offline
Edison Member
*
Karma: 48
Posts: 2300
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I had the same problem, the 2.2K resistor solved it!! All other tutorials were referring tot the 4.7K one... smiley-neutral

The reason  why tutorials refer to 4.7k is that it is the correct value.  A 2.2k may be used when the cable is really long - over 10m.

If you don't have a very long cable and using a 2k2 fixed the problem, it may be because of a bad connection somewhere providing the extra 2.5k, or more.....
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I had the same problem, the 2.2K resistor solved it!! All other tutorials were referring tot the 4.7K one... smiley-neutral

Same here, changed down to 2.2K Resistor, and now it's working again.
Before it was working perfectly even with cables around 20m length (1.5mm2 ! smiley-lol), but after it startet to rain outside all the sensors just showed 0.0°C…

Thanks for the help here!
Logged

Pages: [1]   Go Up
Jump to: