Dealing with finicky 1-wire errors

Discussion & updates on SimpleWeather

Moderator: tbitson

Dealing with finicky 1-wire errors

Postby pwillard » Tue Oct 18, 2011 4:35 am

I found that every so often, for reasons unclear at this point, that I would experience 1 wire CRC errors and therefore bad results. This one bad read would skew the long term settings to read wildly incorrect trend values. I tried a number of wiring related fixes but I still would get these errors a few times a day.

I'm not a typical setup, so it's unlikely that what I do to eventually solve this problem is useful to others, but my code adjustment might me useful.

Here's my setup: Ubuntu 10.04 LTS, AAG TAI603B USB-1wire adapter but connected to the legacy Dallas 1-wire station (version 1). This creates some unique challenges, no doubt.

Anyway, the coding fix I implemented involves RETRIES. I've setup a constant retryCount for retries before giving up... 10 seems to be a good value.

Here is a snippet:

Code: Select all
// humidity ============================================================
        retries = 0;
         while (retries < retryCount)
          {
              humidity = hs1.getHumidity();  // If we get a good reading, just take it.
            if (humidity == -999.0f)              // otherwise, try a few times to see if we get a good reading.
            {
            System.out.println("***  OOPS  Retry # " + retries + "***");
            humidity = hs1.getHumidity();
            } else {
               
                 break;
                    }
          retries ++;
          }


I was able to do this for all sensors as Tim set up the code to use return values similar to -999.9. If we see one... which means "wrong", a retry can be made till we don't... or give up after X tries.
pwillard
 
Posts: 17
Joined: Tue Apr 01, 2008 12:17 pm

Re: Dealing with finicky 1-wire errors

Postby ace » Tue Oct 18, 2011 4:09 pm

one of the things that i found helpful was at the end of the 1-wire chain was to add a small titaninum cap across the 2 wires, it seemed to steady the current and make read more reliable.
ace
 
Posts: 15
Joined: Sat Jun 30, 2007 2:26 pm

Re: Dealing with finicky 1-wire errors

Postby pwillard » Sat Oct 22, 2011 1:21 pm

Not tried that... easy to validate. thanks
pwillard
 
Posts: 17
Joined: Tue Apr 01, 2008 12:17 pm


Return to SimpleWeather

Who is online

Users browsing this forum: No registered users and 1 guest