DS18B20 Sensors output temperature as 0

I am pretty new to Arduino but I am working on an undergraduate experiment to measure heat flow across a metal plate. The idea is that I have an 8x8 grid of these DS18B20 sensors wired up on one side of an aluminum plate. I started by gluing each one down with thermal epoxy and soldering ground and +5v to the appropriate pins on each sensor (total of 64). After each was wired to ground and power, I individually went through each sensor to find its hard codes address using the Find_Address_Temp.Sensor.ino file attached below.

<#include <OneWire.h>
#include <DallasTemperature.h>
#define NDevices 1          // Max number of devices for now
#define ONE_WIRE_BUS 4

OneWire oneWire(ONE_WIRE_BUS);                    // Bus on pin 4
DallasTemperature sensors(&oneWire);    // pass to the DT library

int N;                                  // number of sensors
DeviceAddress address[NDevices];        // space for addresses 
DeviceAddress thisAddress;

void setup() {
   Serial.begin(9600);
   sensors.begin();

   // check for number of devices
   N = sensors.getDeviceCount();
   Serial.print(N, DEC);
   Serial.println(" sensor(s) detected.");

   // Find the address for each device
   for (byte j=0;j<NDevices;j++) {
       if (sensors.getAddress(thisAddress, j)) {
           for (byte k=0;k<8;k++) {
               Serial.print(thisAddress[k], HEX);
               Serial.print(" ");
               address[j][k] = thisAddress[k];
           }
           Serial.println("");
       }
   }
}

void loop() {
   // Do nothing.
   delay(1000);
}

I also used a 4.7kOhm resistor attached from +5v to the Data line. Next, I cleared the EEPROM and wrote to the EEPROM the addresses of each sensor using this code:

<#include <EEPROM.h>

byte j, k;              // Used for counting loops

// Addresses of 64 sensors on my board
// First 8 are the first row
byte addr[64][8] = {

 {0x28, 0x30, 0x34, 0xC8, 0x0B, 0x00, 0x00, 0x8C},
 {0x28, 0xE6, 0x1D, 0xCA, 0x0B, 0x00, 0x00, 0xF6},
 {0x28, 0xF3, 0x3F, 0xC9, 0x0B, 0x00, 0x00, 0xB5},
 {0x28, 0x3D, 0x7E, 0xC7, 0x0B, 0x00, 0x00, 0x08},
 {0x28, 0x85, 0x1D, 0xCA, 0x0B, 0x00, 0x00, 0x6C},
 {0x28, 0x27, 0x8F, 0xC9, 0x0B, 0x00, 0x00, 0xE2},
 {0x28, 0xED, 0x31, 0xCA, 0x0B, 0x00, 0x00, 0xD7},
 {0x28, 0xE5, 0x4E, 0xC7, 0x0B, 0x00, 0x00, 0xE9},

56 MORE ADDRESSES THAT DONT NEED TO BE COPIED ON HERE AND WASTE YOUR TIME

};

void setup() {

 for (j = 0; j < 1; j++) { // Go through all addresses
   for (k = 0; k < 8; k++) { // Loop through 8 bytes per address
     EEPROM.write(((j * 8) + k), addr[j][k]);
   }
 }
 pinMode(13, OUTPUT);
 for (j = 0; j < 5; j++) {
   digitalWrite(13, HIGH);
   delay(200);
   digitalWrite(13, LOW);
   delay(200);
 }
}

void loop() {
 // Loop does nothing.
 delay(1000);
}

I then used this code to send a command to each individual address on the bus to send its temperature.

* Reads the addresses from the EEPROM then sends a message out to 
 * each sensor at that adrress and requests its temperature.
 */

#include <OneWire.h>
#include <DallasTemperature.h>
#include <EEPROM.h>

#define NDevices 64                    // Number of DS18B20s
#define BUS 4                          // OneWire bus on pin 10

OneWire oneWire(BUS);
DallasTemperature sensors(&oneWire);    // pass to the DT library

DeviceAddress TAddress;                 // 8-bit T-sensor address
int EAddress;                           // EEPROM address pointer

void setup() {
    // Just get ready for communication. loop() does all the work.
    Serial.begin(9600);
    sensors.begin();
}

void loop() {
    
    // Send out a global "check temperatures" command
    sensors.requestTemperatures();

    // Now get those temperatures
    EAddress = 0;
    for (byte j=0;j<NDevices;j++) {     // loop over devices
        for (byte k=0;k<8;k++) {        // loop over address bytes
            TAddress[k] = EEPROM.read(EAddress);
            EAddress += 1;
        }
        // Now TAddress is the next sensor address, read it
        // and send the results on the serial line.
        Serial.print(sensors.getTempC(TAddress));
        Serial.print(" ");
    }
    // Now we're done with all sensors, so end the line.
    Serial.println("");
    
  
    delay(1000);
}

Before soldering all data lines together, I ran this code with the data line connected the only one sensor and it seemed to work out well. It correctly outputted the temperature of whatever sensor the data line was connected to and 0 (zero) for the other 62 sensors not connected yet. This worked well so I went ahead and soldered the data lines together. I soldered about half together and checked again. It still worked- giving me the correct temp for the sesnors actually connected and zero for the rest. Now, after I’ve finished connecting each data line, when I run the code it gives me 0 (zero) for every sensor. I gone through the whole circuit, made sure I have no wires crossed. Everything seems to be in order. I assume each has sufficient power because each worked when the were all given power and ground and checked individually. I have tried to keep these codes pretty simple as you can see, but at this point, I’m really unsure of how I should proceed. Any advice at all would be so very helpful.

EEPROM_Address_Storage.ino (4 KB)

Find_Address_Temp.Sensor.ino (1.16 KB)

Sensor_Read.ino (1.37 KB)

w_koopman:
I have tried to keep these codes pretty simple as you can see,

No, I don’t see, and I’m not going to look. Read the stickies at the top of the forum with particular attention to posting code using </> tags. Don’t bother with the find address one. I’m guessing the sensors are not outputting a zero, I don’t believe they ever do, and your problem is in the EEPROM code. How does your project go when you simply send the data to the serial monitor?

Sorry about the poor format... It is my first post on here. I seem to have trouble when there are more than a few sensors are the data bus. Do you think having all of them on there may just be drawing too much current? I am on an Arduino Uno.

DS18B20 takes about 1mA. If you don't have trouble when there are not more than a few sensors then power may be a problem. Since you intend having a swag of sensors eventually, it might be a good idea to provide the whole setup with decent 5v power anyway, thereby relieving Uno's regulators.

I assume the comment about the one wire bus on pin 10 isn't serious.

No comment on the EEPROM, other than that I don't know why you are using it. No matter how you go about this, you still need to know which sensor is where and, with so many sensors, I guess this is the time when you use the "by index" method. This is something that might have been better entertained before you glued the sensors down.

I'm surprised it worked fine with a few as, since the delay is at the end of the loop rather than at the beginning, I would have expected the first reading to be 85.

No matter how you go about this, you still need to know which sensor is where and, with so many sensors, I guess this is the time when you use the "by index" method.

When documenting the addresses of each and uploading them to the EEPROM, they are ordered in a top to bottom left to right order- 8 in one row, 8 in the next, and so on.

So?