Pages: 1 2 [3]   Go Down
Author Topic: Dallas Temperature Control Library released ;)  (Read 14091 times)
0 Members and 2 Guests are viewing this topic.
The Big Smoke
Offline Offline
Sr. Member
****
Karma: 0
Posts: 260
Hacking and Slashing
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, thanks to James Whiddon the library can change precision and read temperatures as Rusty suggested.

You can grab the latest version (Aside from my wiki) here: http://download.milesburton.com/Arduino/MaximTemperature/DallasTemperature_250.zip
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 3
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Champion, I'll check this out as soon as I get home.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Im a bit confused, does this library support only one temp sensor pr digital pin?
Logged

The Big Smoke
Offline Offline
Sr. Member
****
Karma: 0
Posts: 260
Hacking and Slashing
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Nope, it supports up to 64 devices per pin if I recall correctly. I could even be more
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I know the onewire bus supports that.

You wrote in post #3 in this thread:
"This library isn't designed to use more than one device on the wire. You could but I didn't see the need for "version 1"."

That made me believe that i can only adress one tempsensor for each digital pin whilst using your library.
Logged

The Big Smoke
Offline Offline
Sr. Member
****
Karma: 0
Posts: 260
Hacking and Slashing
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Sadly I cannot edit old posts. If you take a look at the web page you'll notice the library has been upgraded many times of the last few months. Each version has a change log so you can see what has been upgraded since.

Worth a look over, I hope the Arduino guys can sort the forum. Sorry for the confusion smiley-wink
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ahh I see.. thanks!

So the latest stable version is 3.40?

Ill get it tested right away.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Works like a charm with multiple sensors smiley

Though, i very often get 85C // 185F wich i only got  occanionally with the onewire library from the playground: http://www.arduino.cc/playground/Learning/OneWire

Now i have two sensors on my breadboard. If i touch one of them, to heat it up, It starts to read 85C and wont work until Arduino reset. With the onewire library it would read 85C once or twice, I could just unplug and reinsert the sensor, and it would read correct. I didnt have to reset the Arduino.

Should i run sensors.begin(); In loop main to avoid this?
« Last Edit: December 20, 2009, 02:17:48 am by gjelsvik » Logged

The Big Smoke
Offline Offline
Sr. Member
****
Karma: 0
Posts: 260
Hacking and Slashing
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hmm, you shouldn't see a crash at 85F, there could be a fault. I'll take a look when I get a chance.

You shouldn't need to use begin more than once
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

According to "google" the 85C / 185F is the value the DS18B20 is returning right after a reset.
So it might be my breadbord/ loose cables that is causing this. I have soldered it up now, and it doesnt give me a 85C anymore.

Great library, much easier to implement than the OneWire that is on the playground. You should get yours on the playground aswell.
Logged

The Big Smoke
Offline Offline
Sr. Member
****
Karma: 0
Posts: 260
Hacking and Slashing
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hmm, Unless someone took it off it should still be there. A little hidden maybe smiley-wink
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 2
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Has anyone tried dynamically plugging in and unpluging sensors. I can not find a way of seeing is the sensor has gone, isValid only appears to check the CRC of the stored sensor ID. At the moment I am reading the resolution, which works most the time but is a bit of a cludge. Any suggestions most welcome - it is for yet another Arduino Beer Making machine - I'll post more on the that when it is done.

Many thanks for the excellent code.
Logged

Netherlands
Offline Offline
Sr. Member
****
Karma: 0
Posts: 414
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I want to convert the sensor address to a string, but I have hard time getting it to work.

This is what I tried:
Code:
void DeviceAddressString(DeviceAddress deviceAddress)
{
  char *deviceAddressString="";
  char *tempAddr;
  strcpy(deviceAddressString, "");
  for (uint8_t i = 0; i < 8; i++)
  {
    itoa(*deviceAddress[i], tempAddr, 10);
    strcat(deviceAddressString, tempAddr);
  }
}

A call to this function should fill deviceAddressString with the value of the device address.

Code:
DeviceAddressString(insideThermometer);

Help/suggestions are appreciated.
Logged

Van Alstyne, TX
Offline Offline
Full Member
***
Karma: 1
Posts: 154
Haven't smoked an Arduino... yet.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Crash',

     Normally 1-wire device addresses are written out as hex, base 16.
Also, the way you're concatenating the output from itoa(), all of your
decimal numbers will be "squished" together without any character
separating them.  What you'd get is something like 950001261316316.

   Here's two functions I use to print out my 1-wire addresses.
I use them for debugging 1-wire code.
Code:
#define OW_ADDR_LEN     8     // bytes (64-bits

// Convert a byte to a 2-digit hex string, zero-filled, NULL terminated.
// Serial.print(x, HEX) doesn't do zero-fill.
char *byte2hex(byte b)
{
    static const char hex[] = "0123456789ABCDEF";
    static char answer[3] = {
        '\0', '\0', '\0'             };

    answer[0] = hex[(b & 0xf0) >> 4];
    answer[1] = hex[b & 0x0f];

    return (answer);    
}


// Print a OW address, but no newline afterwards
void print_address(byte *x)
{
    byte i;
    byte *p;

    p = &x[OW_ADDR_LEN-1];     // Point to end of address

    for (i=0; i<OW_ADDR_LEN; i++)
        Serial.print(byte2hex(*p--));

    Serial.print(" ");
}
Logged

Pages: 1 2 [3]   Go Up
Jump to: