Go Down

Topic: DS18B20 & onewire.h (Read 16750 times) previous topic - next topic

phoyt

Hi there,

I see it has been almost a month since anyone posted to this thread. I have a similar project that uses 10 DS18B20 sensors as input to a temperature control system. I've skimmed almost all of this thread hoping to reach the end to find the answer... but it seems the story isn't over yet.

so I'm wondering... did you ever get this system working as intended?

So far I've found a working sketch to list the addresses of all 10 of my sensors but haven't taken the next step in the software.

I'm using the Arduinio ver 1.0 software and I'm a bit confused about compatibility between that version of the Arduinio software and the DallasTemperature.h file I downloaded. I don't find any comments indicating a version number of the .h file or a version number for the OneWire.h file. I think I have the most recent version of both files.

However, a note on the vendor's web site, from which I bought the sensors. says the DallasTemperature.h and OneWire.h files are not compatible with the Arduino ver 1.0 software.

Is there an easy way to determine if I have the proper software loaded to write a program to read and report temperature readings from all 10 sensors?

Thanks,
Peter H.
Sandpoint, Idaho

strykeroz

Hi Peter

I've got a sketch running with 2 sensors using the dallas libraries and it works fine using the mechanism above to report the value of each specific one (one sensor inside and one on the roof at the far end of 30.5m of cable). 

I can't remember if I had to modify them to work with IDE 1.0 or not, so I suspect it worked fine out of the box.  Give it a crack anyway, it won't be a big change if there's one needed.

Cheers !
Geoff
"There is no problem so bad you can't make it worse"
- retired astronaut Chris Hadfield

Nick Gammon

To compile under version 1.0 of the IDE:

Change the includes at the start of OneWire.cpp to be:

Code: [Select]
#include "OneWire.h"

#if defined(ARDUINO) && ARDUINO >= 100
  #include "Arduino.h"
#else
  #include "WProgram.h"
#endif

extern "C" {
  #include <avr/io.h>
  #include <avr/interrupt.h>
  #include <avr/pgmspace.h>
}


Change the includes at the start of DallasTemperature.cpp to be:

Code: [Select]
#include "DallasTemperature.h"

#if defined(ARDUINO) && ARDUINO >= 100
  #include "Arduino.h"
#else
  #include "WProgram.h"
#endif


Then it should compile OK.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

phoyt

Wonderful. Thanks for the responses. I'll get back onto this project this evening!

Peter H.
Sandpoint

Go Up