Can't get my DS18B20 to work on Arduino Uno

(deleted)

This sketch will print out the address of any Onewire devices it can find on pin 3. Make sure that it prints the same addresses as those in Thermo1 and Thermo2. If it doesn’t, copy and paste what it prints into those two arrays.
If it doesn’t find anything, you’ve got them wired up incorrectly.

// This sketch looks for 1-wire devices and
// prints their addresses (serial number) to
// the serial monitor, in hexadecimal format
// so that the ROM code can be copied and pasted
// into a sketch.
// Pete El_Supremo
#include <OneWire.h>

#define ONEWIRE_PIN 3

OneWire  ds(ONEWIRE_PIN);

void setup(void) {
  Serial.begin(9600);
  while(!Serial);
  delay(2000);
  discoverOneWireDevices();
}

void discoverOneWireDevices(void) {
  byte i;
  byte present = 0;
  byte data[12];
  byte addr[8];
  
  Serial.print("Looking for 1-Wire devices on pin ");
  Serial.println(ONEWIRE_PIN);
  
  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.println("");
  }
  Serial.print("\nThat's all.\n");
  ds.reset_search();
}

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

And read how to post code properly and then fix up your previous message so that your code is in code tags, which makes it much easier to read and copy and paste. Notice the Select option at the top of the code I have pasted.

Pete

(deleted)

Thanks for fixing your code.

If that sketch only prints "That's all." then it hasn't found any DS18B20 devices at all on pin 3 which means you haven't wired them properly. The sketch should print the ROM address of each DS18B20 on pin 3 before it prints "That's all." Maybe I should modify that sketch so that it prints a different message if it doesn't find anything. Draw a diagram to show each of the 3 pins on the DS18B20 are connected.

Pete

(deleted)

I shifted all my pins 3 holes to the left

I don't understand this at all. Which pins? And "left" has no context for me. The photo in your original post is very clear except that it doesn't how the red, yellow and black wires are connected to the Arduino.

Pete

(deleted)

GND 17, digital 13 and 5v in 10

The GND wire on the ds18b20 must go to the ground connection on the Arduino. The power wire (Vdd) on the DS18B20 must go to the Arduino's 5V connection. The code you posted uses pin 3 for the DS18B20. There's no way that connecting the DS18B20 data pin (DQ) to pin 13 is going to work unless you also change the code to use pin 13. You can't have had everything connected correctly and it looks like you still haven't.

Pete

(deleted)

Ohhhh! I've had that happen too. Best thing to do now is get a new breadboard and throw that one out. Otherwise this problem will bite you again sooner or later :)

Pete

(deleted)

It looks like you are using code submitted by me. You must substitute my sensor addresses with your own. You can use the Hacktronics sniffer to this.