0

MCP9808 accuracy?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

MCP9808 accuracy?

by mknoblock on Mon Feb 04, 2019 8:53 pm

I bought several MCP9808 sensors for Raspberry Pi applications. Using the supplied Adafruit library, if I put two of these side-by-side, connected to separate Pi Zeros, they read 6 degrees (F) apart!

Is there a way to calibrate these? Accuracy is supposed to be +- 0.5 degF, thereabouts

mknoblock
 
Posts: 13
Joined: Tue Jul 26, 2016 12:44 pm

Re: MCP9808 accuracy?

by franklin97355 on Mon Feb 04, 2019 9:12 pm

Have you tried other combinations? How are you connecting them to the Pi? They should not be that far apart in identical conditions.

franklin97355
 
Posts: 20986
Joined: Mon Apr 21, 2008 2:33 pm
Location: Lacomb, OR.

Re: MCP9808 accuracy?

by mknoblock on Mon Feb 04, 2019 9:27 pm

[edited for clarity]

No other combinations; two new Pi Zeros, with the new MCP9808s, connected as follows:

Code: Select all | TOGGLE FULL SIZE
9808                    PI 
 Vdd <-----------    3.3V   1
 SDA <-----------    SDA    3
 SCL <-----------    SCL    5
 GND <-----------    GND    9             


as per the tutorial, I read them from a python script:
SensorTemp = int(sensor.readTempC()*9/5+32)

Here is a larger context:
Code: Select all | TOGGLE FULL SIZE
def bigtick():
    #one second timer
    global seconds, SensorTemp, sensor,ticks,DrivewayAlarm1Count,DrivewayAlarm2Count,Runtime
    if seconds >= 60:
        error = False
        # once/minute report local sensor temperature
        seconds = 0
        try:
            SensorTemp = int(sensor.readTempC()*9/5+32)
        except Exception as e:
            publish("exception/%s/%s"%(HOSTNAME,PROCESS),"sensor fail")
            error=True
        if not error:
            print("temp %d"%(SensorTemp))             
            publish(TOPIC,"%s"%(SensorTemp))

not only are these 6 degrees apart, I put a little thermometer next to them, and it reads 5-6 degrees below the lower-reading MCP9808!

I use these to sense temperature in a remote building to turn heaters on/off in the winter, so I could tolerate += 1 degF, but these are way off base.

mknoblock
 
Posts: 13
Joined: Tue Jul 26, 2016 12:44 pm

Re: MCP9808 accuracy?

by franklin97355 on Tue Feb 05, 2019 1:50 pm

Have you tried swapping the boards and Pis they are attached to?

franklin97355
 
Posts: 20986
Joined: Mon Apr 21, 2008 2:33 pm
Location: Lacomb, OR.

Re: MCP9808 accuracy?

by adafruit_support_bill on Tue Feb 05, 2019 2:09 pm

Is there a way to calibrate these?

Different manufacturers use the word 'accuracy' to mean different things in their spec sheets. It often means some combination of linearity and precision. It rarely means absolute accuracy traceable to a standard. NIST traceable sensors cost big-bucks and often come with a sheet of correction factors telling you where and how far they deviate from the standard.

But linearity and precision are really the most important qualities. Accuracy can be achieved with calibration. A two-point calibration against a reliable reference should be sufficient for the MCP9808.
https://learn.adafruit.com/calibrating-sensors

adafruit_support_bill
 
Posts: 74058
Joined: Sat Feb 07, 2009 10:11 am

Re: MCP9808 accuracy?

by mknoblock on Tue Feb 05, 2019 3:17 pm

Well... first I'd like to quote from your own blurb about the high-precision MCP9808:

This I2C digital temperature sensor is one of the more accurate/precise we've ever seen,
with a typical accuracy of ±0.25°C over the sensor's -40°C to +125°C range and precision of +0.0625°C.
They work great with any microcontroller using standard i2c...


So, sure, I can do a two-point calibration correction (thanks for the suggestion). Does this mean that I need to do separate calibrations on each of the two identical sensor assemblies I have? So that,once I've done that, I have to make sure I match up the correct python script for the correct hardware set? This is nowhere near what I expected from these units - had I known, I might have just bought a bunch of TMP36 sensors and spent lab time calibrating and breadboarding them. 'They work great' led me to believe I could make this a quick project.

One project I had in mind was a smart thermostat using PiZeroW and two of these MCP9808 sensors. Now I'm not sure if I can make a reliable thermostat with this approach...

mknoblock
 
Posts: 13
Joined: Tue Jul 26, 2016 12:44 pm

Re: MCP9808 accuracy?

by adafruit_support_bill on Tue Feb 05, 2019 3:39 pm

How many sensors did you purchase and how far apart are their measurements under identical conditions?

adafruit_support_bill
 
Posts: 74058
Joined: Sat Feb 07, 2009 10:11 am

Re: MCP9808 accuracy?

by millercommamatt on Tue Feb 05, 2019 3:42 pm

So, sure, I can do a two-point calibration correction (thanks for the suggestion). Does this mean that I need to do separate calibrations on each of the two identical sensor assemblies I have? So that,once I've done that, I have to make sure I match up the correct python script for the correct hardware set?


Yes. And this is going to be true for just about any sensor you buy unless it comes with specs for absolute accuracy. And, in my experience, even those typically need recalibration out of the box.

millercommamatt
 
Posts: 389
Joined: Tue Jul 31, 2018 4:57 pm

Re: MCP9808 accuracy?

by adafruit2 on Tue Feb 05, 2019 6:06 pm

do you have a bunch that are off by 6*? i wonder if they are self heating ? it is odd to have it be off by that much

adafruit2
Site Admin
 
Posts: 18599
Joined: Fri Mar 11, 2005 7:36 pm

Re: MCP9808 accuracy?

by millercommamatt on Tue Feb 05, 2019 6:14 pm

Section 6.2 of the datasheet addresses self-heating. The manufacturer suggests that it shouldn't be more than + 0.5 C based on the power consumption.

millercommamatt
 
Posts: 389
Joined: Tue Jul 31, 2018 4:57 pm

Re: MCP9808 accuracy?

by mknoblock on Tue Feb 05, 2019 6:16 pm

I only have wired two (I think I bought 6). One is wired to the Pi via a small prototype board. The other is hardwired with about 1 1/2" 22 ga wire. So technically, the second is closer to the Pi board.

To test all this, and create a multipoint correction scale, I brought one sensor to the house, mounted outside a window, with the external thermometer. In 48 hours I should have a really good temperature swing to use as a starting point.

mknoblock
 
Posts: 13
Joined: Tue Jul 26, 2016 12:44 pm

Re: MCP9808 accuracy?

by adafruit2 on Tue Feb 05, 2019 6:18 pm

ok plz let us know - you say 'several' - does that mean you have 2 or more than 2?

adafruit2
Site Admin
 
Posts: 18599
Joined: Fri Mar 11, 2005 7:36 pm

Re: MCP9808 accuracy?

by mknoblock on Tue Feb 05, 2019 6:24 pm

I have more than 2 - probably 6. Only have 2 wired up, the others have not yet been used.

mknoblock
 
Posts: 13
Joined: Tue Jul 26, 2016 12:44 pm

Re: MCP9808 accuracy?

by adafruit2 on Tue Feb 05, 2019 6:34 pm

if you can try the others, that will help us identify if its one odd one or maybe something else!

adafruit2
Site Admin
 
Posts: 18599
Joined: Fri Mar 11, 2005 7:36 pm

Re: MCP9808 accuracy?

by mknoblock on Tue Feb 05, 2019 6:46 pm

Right... ok it will take me a few days to gather all this up and I will post.

thanks..

mknoblock
 
Posts: 13
Joined: Tue Jul 26, 2016 12:44 pm

Please be positive and constructive with your questions and comments.