I am using existing cabling from my breadboard ( where my Mega is located ) - it is a 12 core cable used for domestic alarm systems.
What would be a safe maximum distance (if distance would be a factor) that the sensor could be away from the board and still get a reasonably accurate reading. Will be powering the sensor with 12VDC.
I see the DS1820 available from my online supplier.
Although a lot more expensive than the analog sensors, I 'think' the digital signal would be less affected by the length of the cable from board to sensor.
Do you possibly have a wiring sketch for connecting these to a board ( digital or analog input ? ) and any sample code to get the temperature reading from the sensor into a variable in the code would be very greatly appreciated.
This is for a home DIY project and I need to get all my parts ordered online together to reduce delivery charges.
Check out the - MilesBurton.com - for the DS18B20 as it contains many working examples. If you have multiple sensors and you have pins to spare it is possible to have multiple instances of the Dallas lib (I tried it recently) . This way you dont need the addresses, as there is only one sensor on the one-wire bus.
wrt length my max cable was ~ 4 meters / 13 feet , was a single sensor.
Can you tell me if it is possible to isolate the data line from the sensor to the boards input pin with an optocoupler ?
That won't work in any simple scenario...
Both the Arduino and the DS1820 "hanging" on the data line need to be able to pull the data line low. The pin switches between being an input and being an output.