I'm new to C programming so please be kind to me - I can be quiet slow and dense at times!!
( have done some Pic assembler).
I've got the Ds18b20 sensor up and running on the Uno in both single and multiple versions.
For my home project I would like to use a separate i/o line for each of three sensors rather than a daisy chain.
Have tried a couple of things to get the 'single' version to do separate channels but its doesn't like it - can it be done in its existing form ?
The reason I don't want to use the 'multiple' version is that if /when a sensor fails, its not a case of just plug in a new sensor, its address has to be read and added to the main program - too cumbersome. Also the chance of a failing sensor blocking out all the others on that line seems to increase the failure potential, which is not good for my purpose.
You should be able to create multiple instances of the objects needed:
Compiles but not tested as I have no sensors nearby.
#include <OneWire.h>
#include <DallasTemperature.h>
// Data wire is plugged into pin 2 on the Arduino
#define ONE_WIRE_BUS 2
#define OWB2 3
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
OneWire OW2(OWB2);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
DallasTemperature zenz(&OW2);
void setup(void)
{
 // start serial port
 Serial.begin(9600);
 Serial.println("Dallas Temperature IC Control Library Demo");
 // Start up the library
 sensors.begin();
 zenz.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 Device 1 is: ");
 Serial.print(sensors.getTempCByIndex(0)); // Why "byIndex"? You can have more than one IC on the same bus. 0 refers to the first IC on the wireÂ
 Serial.print("Requesting temperatures...");
 zenz.requestTemperatures(); // Send the command to get temperatures
 Serial.println("DONE");
Â
 Serial.print("Temperature for Device 1 is: ");
 Serial.print(zenz.getTempCByIndex(0)); // Why "byIndex"? You can have more than one IC on the same bus. 0 refers to the first IC on the wireÂ
}
If I had spare I/O lines, I'd do the same as the OP, if only to avoid the nuisance of dealing with the chips' IDs. It will also allow a star topology, which 1-Wire doesn't like for multiple devices on one line... though in some circumstances, where a single run will work, multiple sensors on one line will of course save wire. Ah the joys of design!
However... I really write to address the question of the sensor chips failing. I've "worked" (as a hobbyist) with them for year, with some outdoors as well as indoors, and never had one fail. (yet!)
The temperature readings at my FarWatch page are done with Dallas chips...
I was using that library already and with a friends help had tried something similar but clearly wrong.
Yes, you are right about sensor failure, it being the weakest link in the design imho , not from the actual circuit design of the sensor but enviromental factors usually resulting from corrosion of the devices pins.
I am also new to Arduino and have a question about the code you posted for putting DS18B20 sensors on separate ports. I have tested your code and it does work, however, I would like for it to not only display in degrees C but if degrees F as well and have no idea how to do that. Can you help ?