Creating mupltiple instances of ds18b20 on different pins

I am creating an enclosure and will have eight ds18b20 temp probes in different parts of the enclosure. Unfortuently due to having to assemble a lot of them I won’t have time to get the data address of each DS18b20 probe to connect them in series, so I will have to connect each probe to a different pin instead. However I am running into a problem of how to have multiple instances of the OneWire and DallasTemperature library run simultaneously. The code I am basing it from is the example from the Arduino Library for the DS18b20

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

// Data wire is plugged into port 2 on the Arduino
#define ONE_WIRE_BUS 2

// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);

void setup(void)
{
// start serial port
Serial.begin(9600);
Serial.println(“Dallas Temperature IC Control Library Demo”);
// Start up the library
sensors.begin();
}

void loop(void)
{
// call sensors.requestTemperatures() to issue a global temperature
// request to all devices on the bus
Serial.print(“Requesting temperatures…”);
sensors.requestTemperatures(); // Send the command to get temperatures
Serial.println(“DONE”);

Serial.print("Temperature for the device 1 (index 0) is: ");
Serial.println(sensors.getTempCByIndex(0));
}

Do I make multiple instances of OneWire and Sensors class and then call then separately or am I missing something else? Because of the time delay in reading the sensors and the need to have more accuracy I am hoping to first send all the commands to get the temperatures (sensor.requestTemperatures()) and then wait the amount of time needed and then collect the results (sensors.getTempCByIndex(0)) instead of looping through it for each sensor and having to wait 0.75 seconds per sensor. Thanks for your help, I am rather confused and don’t know how to proceed.

Do I make multiple instances of OneWire and Sensors class and then call then separately

Yes. It hardly makes sense, though. It would take longer to make the code deal with 8 buses than it would to get the addresses of each device on one bus.

Yes but I some volunteers will be making two hundred of these boxes and I won't be there to help them. Recording the addresses and programming it in the code for each box is going to be a huge headache. Also the code needs to be aware of which section of the box each temperature probe is in. Having to flash 200 boards with different address plus make sure that the right address is on the right side of the box is a huge hassle. It is easier from a instructions perspective to tell people that probe from front side goes into the PCB connector labeled front. Because of that I am having only one probe per pin

There is a faint chance that the following might be a good idea.

create_and_learn:
IDo I make multiple instances of OneWire and Sensors class and then call then separately or am I missing something else? Because of the time delay in reading the sensors and the need to have more accuracy I am hoping to first send all the commands to get the temperatures (sensor.requestTemperatures()) and then wait the amount of time needed and then collect the results (sensors.getTempCByIndex(0)) instead of looping through it for each sensor and having to wait 0.75 seconds per sensor. Thanks for your help, I am rather confused and don't know how to proceed.

One onewire and Sensors class per bus will work. But better is to declare them in a function and you need only one. Try to be inspired by my oneWireSearch sketch, latest version here

It creates the oneWire instance if it needs one.

You could write a function getTemperatures(byte pin); in a similar way.