Multiple DS18B20 Bus Sensor Code

Hi,

I am trying to take temperatures from my fish tanks that are in lots of 4, I don't want to have the DS18B20's on one bus so I have been looking for some code that takes temperature in celsiius from 4 sensors on their own bus, if anyone can help I would be very grateful.

Thanks
Stuart

I won't ask why, but perhaps you can take comfort in knowing you aren't the first.

Hi Nick,

Thanks for your hassle free info link, we need more people like you.

Happy New Year
Stuart

Hi,

One or more DS18B20 temperature sensors on Arduino- ar3ne1tt2.htm

Wow, that looks like a complicated solution. Can't we just create multiple instances of the library objects??

Sorry, travelling, but single instance like this:

/*-----( Import needed libraries )-----*/
#include <OneWire.h>
#include <DallasTemperature.h>

/*-----( Declare Constants )-----*/
#define ONE_WIRE_BUS 2 /*-(Connect to Pin 2 )-*/

/*-----( Declare objects )-----*/
/* Set up a oneWire instance to communicate with any OneWire device*/
OneWire ourWire(ONE_WIRE_BUS);

/* Tell Dallas Temperature Library to use oneWire Library */
DallasTemperature sensors(&ourWire);

So you'd define multiple one-wire busses and multiple sensor objects?

Hi Terry,

Thanks for your interest, basically I would have 4 DS18B20 connected to 4 different pins, I want to go down this road because of various reasons such as not getting involved with DS18B20 Roms making it easier to swap over sensors etc, any help with code for this would be greatly appreciated.

Thanks
Stuart

and Happy New Year