Shop OBEX P1 Docs P2 Docs Learn Events
Measuring Temperature Below 0 with a Sensirion. . .? — Parallax Forums

Measuring Temperature Below 0 with a Sensirion. . .?

everesteverest Posts: 141
edited 2009-09-17 17:13 in BASIC Stamp
Can the Sensirion sensor measure temperatures below freezing? I've got one wired up exactly like the demo, running the demo code, and everything works great until I hit the below 0C point, then things get crazy!

SHT1x Demo

soT...... 1854
tC....... 6532.1º
tF....... 6546.9º

soRH..... 1924
rhLin.... 63.7%
rhTrue... 449.5%

Any ideas on where I might find out why this is happening?

-Jeff

Comments

  • everesteverest Posts: 141
    edited 2009-09-14 07:30
    To anyone else that might have this requirement and search the archives, I figured this out. The demo program can't figure out that the temperature values are going to spill into the negative and handle that. I've written a revised version that's a bit simpler, but handles below zero temperatures quite well.

    Note that I only handle below zero temps in Celsius. . .I don't need F so I didn't update that code. But you'll get the idea when you look at it. . .pretty easy.

    Here's what I'm reading NOW in my freezer:

    SHT1x Demo

    soT...... 2363
    tC....... -16.3º

    soRH..... 1236
    rhLin.... 41.8%
    rhTrue... 40.9%

    -Jeff

    Post Edited (everest) : 9/14/2009 7:47:06 AM GMT
  • WBA ConsultingWBA Consulting Posts: 2,934
    edited 2009-09-15 02:43
    Excellent job resolving the problem. I haven't measured temps that low so haven't come across the issue. Now I might have to put one in my freezer just to see the results. hop.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Andrew Williams
    WBA Consulting
    WBA-TH1M Sensirion SHT11 Module
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2009-09-17 06:28
    Jeff,
    I like to leave the temperature in twos complement form, and display it using a debug command that can handle either the positive or the negative:
    tC = soT / 10 - 400  ' raw soT value is positive number; result tC is Celsius from -400 to +1238 (-40.0 to +123.8)
    DEBUG REP "-"\tC.bit15, DEC ABS tC/10, ".", DEC1 ABS tC    ' displays both + & - temperatures
    


    Your approach is fine, but it does take unnecessary (IMHO) lines of code to separately compute and flag the positive and negative temperatures, and also separate routines to display them.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • TomvnTomvn Posts: 103
    edited 2009-09-17 10:05
    Hi Tracy Allen , how can i write the code to allow one stamp send temperature data to othen stamp via Rf 912mhz thank .
  • everesteverest Posts: 141
    edited 2009-09-17 15:55
    Good point Tracy. . .honestly I was just trying to stick with the same conventions as exist in the current demo code. I learned about 4 new things looking at your code snippet though! Thanks!!!

    -Jeff
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2009-09-17 17:00
    Many ways to "skin the cat". (strange expression!). Tricks to reduce code become essential as programs approach the 2k hard limit per BS2 slot!

    @Tomvn, that should be its own thread topic, and I see you have one already. Maybe you should edit the title of your thread so that it also focuses on the radio aspect.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • everesteverest Posts: 141
    edited 2009-09-17 17:05
    Yea, I've started to bump into those quite regularly. . .in fact, this project has forced me to abandon the BS2 platform and I'm now developing on a SE2e platform across three slots.

    -Jeff
  • TomvnTomvn Posts: 103
    edited 2009-09-17 17:13
    Yes Tracy, i writer my own before i see this one , but sorry anyway.
Sign In or Register to comment.