milesburton / Arduino-Temperature-Control-Library

Arduino Temperature Library
https://www.milesburton.com/w/index.php/Dallas_Temperature_Control_Library
972 stars 487 forks source link

Difference's between older library and latest ? #1

Closed questuk closed 11 years ago

questuk commented 12 years ago

Hi,

I am using XP and a DS18S20.

I have been using your v3.5 library (dated 17/02/10) for 2 years now and has worked as expected and very reliable. Recently I updated to VERSION 3.7.2 BETA.

I am not sure if this a bug or my misunderstaning something, my original code using the old library always took 750ms for a conversion as per Maxim datasheet. Using the latest library it takes 96ms, I am wondering if this is giving the sensor enough time for its conversion at 12 bit resolution?


This is the readout from the serial monitor:

Using latest library

After blocking requestForConversion Time used: 96 Temperature: 18.50

Using old library

After blocking requestForConversion Time used: 752 Temperature: 18.44



The code I am using is:

include

include

// Data wire is plugged into port 2 on the Arduino

define ONE_WIRE_BUS 3

// 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 Control Library - Async Demo"); Serial.println("\nDemo shows the difference in length of the call\n\n");

// Start up the library DeviceAddress tempDeviceAddress; sensors.begin(); sensors.setWaitForConversion(true); // Comment this line out when used with old library sensors.getAddress(tempDeviceAddress, 0); sensors.setResolution(tempDeviceAddress, 12); }

void loop(void) { // Request temperature conversion (traditional) unsigned long start = millis();

sensors.requestTemperatures();

unsigned long stop = millis(); Serial.println("After blocking requestForConversion"); Serial.print("Time used: "); Serial.println(stop - start);

// get temperature Serial.print("Temperature: "); Serial.println(sensors.getTempCByIndex(0));
Serial.println("\n");

delay(1000); }


Any idea what I may be doing wrong?

I do note that you mention that the DS18S20 - appears to have a issue with this series. Although it doesn't state what the problem was?

Thanks for a great library and look forward to hearing your thoughts.

Regards

Gary

milesburton commented 11 years ago

Hi Gary, sorry for the /really/ late response. Did you get your answer?

questuk commented 11 years ago

Hi,

Well I never had an answer, but I have been using your library for the last 6 weeks and it does seem mostly reliable but did have one reading of -127, which means it could not read it ? But thats out of thousands of readings.

I just wondered if I was doing something wrong using your new library?

With your old library, I have a menu on an lcd that would update after a button press every time a reading of the DS18S20 was ready, with the new library I hardly have time to look at the LCD, thats how I know something has changed.

I can easily remedy the menu if I need to, but just wondered if it was a bug or something I am not setting up correctly?

Thanks

for your help and a great program!

Regards

Gary

questuk commented 11 years ago

Ooops sorry just pressed the close button by mistake, please keep this open ?

Gary

hagai-shatz commented 11 years ago

This is a bug, see issue #4

milesburton commented 11 years ago

Issue #4 fixed