Pages: 1 [2]   Go Down
Author Topic: Help with DS18B20, not found  (Read 4223 times)
0 Members and 1 Guest are viewing this topic.
South Africa
Offline Offline
Sr. Member
****
Karma: 2
Posts: 416
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think the 4,7k resistor is supposed to be between sensor pin 2 and 5v+

Please check my thinking.
Logged

South Africa
Offline Offline
Sr. Member
****
Karma: 2
Posts: 416
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ps .. conflict of info here.  Your original post and the wiring diagram you just posted have the resistor in different positions ?

Logged

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

I think the 4,7k resistor is supposed to be between sensor pin 2 and 5v+

Please check my thinking.


Arrgghhh yes, sorry that diagram was done in a rush and is, as you pointed out incorrect. My resistor is actually between pin 2 and +5v however....

As I was in the process of putting a new diagram together I happen to notice that I am indeed being dim, I appear to have ordered 4R7 not 4K7 resistors which one would assume is the reason things are not working.

I do not have any 4K7 resistors (anything common I could rob one of these from?) so cannot confirm until I have one.

Thanks for all of your help guys, sorry to have been a fool

Logged

Netherlands
Offline Offline
God Member
*****
Karma: 7
Posts: 658
A naughty mind is a joy forever.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I also didn't have 4k7 available for my last test (too lazy to get one from the attic), but 4x1K in series worked perfectly. 4r7 will indeed cause problems, but as pull up I guess 4k7 isn't really a critical value.
It wouldn't surprise me if anything between 3k3 and 10k works.
You should be able to find resistors in the right range in most electronic equipment.

The schematics given (with resistor connected to data and +5v) is exactly what tells me it's 21.87C/71.37F in my room right now.

Talking about fools, I love meeting equals ;-)
Logged

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

It wouldn't surprise me if anything between 3k3 and 10k works.

You're spot on. I managed to savlage a 3k3 from an old board and now I am getting a reading, finally.

Talking about fools, I love meeting equals ;-)

Pleased to meet you then smiley-grin

Thanks again to everyone for their input on this.
Logged

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

Having the same problem, the ds18b20 is not found, this is my first arduino project, but checked sevral times, and pretty sure wiring is correct(used this as ref for wiring http://bildr.org/blog/wp-content/uploads/2011/06/DS18S20-hookup.png) . also measured resistor got (4.66 k ohms) voltage on chip was about 4.9 tried all codes I could find for example:

Code:
#include <OneWire.h>
 
//init the one wire interface on pin 10
OneWire ow(10);
 
void setup(void) {
  Serial.begin(9600);
  lookUpSensors();
}
 
void lookUpSensors(){
  byte address[8];
  int i=0;
  byte ok = 0, tmp = 0;
  //start the search
  Serial.println("--Search started--");
  while (ow.search(address)){
    tmp = 0;
    //0x10 = DS18S20
    if (address[0] == 0x10){
      Serial.print("Device is a DS18S20 : ");
      tmp = 1;
    } else {
      //0x28 = DS18B20
      if (address[0] == 0x28){
        Serial.print("Device is a DS18B20 : ");
        tmp = 1;
      }
    }
    //display the address, if tmp is ok
    if (tmp == 1){
      if (OneWire::crc8(address, 7) != address[7]){
        Serial.println("but it doesn't have a valid CRC!");
      } else {
        //all is ok, display it
        for (i=0;i<8;i++){
          if (address[i] < 9){
            Serial.print("0");
          }
          Serial.print(address[i],HEX);
          if (i<7){
            Serial.print("-");
          }
        }
        Serial.println("");
        ok = 1;
      }
    }//end if tmp
  }//end while
  if (ok == 0){
    Serial.println("No devices were found");
  }
  Serial.println("--Search ended--");
}
 
void loop(void) {
  //do nothing :)
}

included the library too

used pin 10 with this one

is there a way to find out if the DS18B20 is bad, or may be misswired (got it already sealed with cable) ?
« Last Edit: June 08, 2013, 10:38:16 am by Rullis » Logged

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

The DS18B20 is pretty reliable and can stand abuse. If it gets seriously hot, you have wired it the wrong way round, but it is likely to survive it. The 4k7 pullup is not verfy critical.

Here is an address finder that works.

Code:
// http://www.hacktronics.com/Tutorials/arduino-1-wire-address-finder.html

#include <OneWire.h>

OneWire  ds(3);  // Connect your 1-wire device to pin 3

void setup(void) {
  Serial.begin(9600);
  discoverOneWireDevices();
}

void discoverOneWireDevices(void) {
  byte i;
  byte present = 0;
  byte data[12];
  byte addr[8];
 
  Serial.print("Looking for 1-Wire devices...\n\r");

  while(ds.search(addr)) {
    Serial.print("\n\rFound \'1-Wire\' device with address:\n\r");

    for( i = 0; i < 8; i++) {
      Serial.print("0x");
      if (addr[i] < 16) {
        Serial.print('0');

      }
      Serial.print(addr[i], HEX);
      if (i < 7) {
        Serial.print(", ");

      }
    }
    if ( OneWire::crc8( addr, 7) != addr[7]) {
        Serial.print("CRC is not valid!\n");
        return;
    }
  }
  Serial.print("\n\r\n\rThat's it.\r\n");
  ds.reset_search();
  return;
}

void loop(void) {
  // nothing to see here
}
Logged

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

Got another four and they are working - the sensor was bad. Coincidence that it was with first thing I tried to connect to arduino, and I spent a lot of time trying to figure out what I did wrong. Thanks for trying to help  smiley
« Last Edit: July 02, 2013, 03:46:48 am by Rullis » Logged

Pages: 1 [2]   Go Up
Jump to: