Go Down

Topic: DS18B20 Temperature Sensor returns "No more addresses." (Read 3 times) previous topic - next topic

arduinotestbox

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: [Select]
#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!

pluggy

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

arduinotestbox

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?

pluggy

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.

robtillaart


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
Rob Tillaart

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

arduinotestbox

#5
Feb 22, 2011, 07:36 am Last Edit: Feb 22, 2011, 08:15 am by arduinotestbox Reason: 1
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! :)

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!

evertharmeling

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

Nick_Pyner


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


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.....

martin_schilliger


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


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 ! XD), but after it startet to rain outside all the sensors just showed 0.0°C…

Thanks for the help here!

Go Up