Loading...
Pages: [1]   Go Down
Author Topic: DS18B20 Temperature Sensor returns "No more addresses."  (Read 905 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!
Logged

Lancashire, UK
Offline Offline
Edison Member
*
Karma: 8
Posts: 1988
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?
Logged

Lancashire, UK
Offline Offline
Edison Member
*
Karma: 8
Posts: 1988
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


Netherlands
Offline Offline
Tesla Member
***
Karma: 101
Posts: 9553
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 -

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

Pages: [1]   Go Up
Print
 
Jump to: