Mathematical calculation


Results 1 to 17 of 17

Threaded View

  1. #6
    Join Date
    Aug 2006
    Location
    Omaha, Nebraska USA
    Posts
    263


    Did you find this post helpful? Yes | No

    Lightbulb

    Important questions here are how precise and how accurate does your result need to be? (There is a difference between precision and accuracy.)

    The formula you give compensates for the non-linearity of the sensor, and it is from the product data sheet, section 4.1:

    http://www.sensirion.com/en/pdf/prod...nsor-SHT7x.pdf

    Warning: Do not try to use anything like:

    RH=(0-2046800+(36700*(SORH*1000000))-((SORH*1000000)*(SORH*1000000)*1595500/10000
    ("Danger, Will Robinson!")

    Substitute 2353 (approximately 76% RH) for SOrh in the above formula and you will see why. (I get something like 883 quintillionths of a percent . . . very dry humor, indeed.)

    Suggestion:

    For the 12-bit data for which it is intended, the formula can be reduced, with some loss of precision, to:

    %RH = (SOrh/27) - [(SOrh)(SOrh)/627,000] - 2

    Again using 2353 (for 75.79% RH, according to the manufacturer), this gives 76.3; the manufacturer's formula gives 75.5.

    The 12-bit output from the sensor ranges from 0 (for 0%) to about 3400 (for 100%). I'm guessing the 8-bit output goes from 0 to about 212, so you may be a lot happier using the 8-bit output. (212 squared is 44,944; the square root of 65,536 is 256. But 2353--for about 76% RH--when squared is over 5.5 million!)

    By the way, that is only compensating for non-linearity of the sensor itself; compensation for temperature is given in 4.2. (A 10 degree difference from 25 Celsius amounts to an adjustment of 1.2 percent RH, an increase if more, a decrease if less.)

    The manufacturer provides an application note that gives three other ways to calculate the compensated value for non-linearity; the first two methods are much simpler and ideally suited to a microprocessor application. The formulas are given for both 8 and 12 bits:

    See section 2 of: http://www.sensirion.com/pdf/product..._Sensors_E.pdf

    If an accurate result, precise within a percent or two, plus or minus, is acceptable, you should have no problem. If you need help converting the factors in the tables of sections 2.1 or 2.2, just ask.

    Another suggestion: It is easier to divide by a whole number than to multiply by a decimal fraction.
    Last edited by RussMartin; - 19th October 2008 at 10:51.
    Russ
    N0EVC, xWB6ONT, xWN6ONT

    "Easy to use" is easy to say.

Similar Threads

  1. Calculation Problem - value goes to zero after 65
    By Tom Gonser in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 12th March 2010, 06:10
  2. how to add the calculation of temperature in my source code
    By slimpeng in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 20th February 2008, 17:31
  3. Mathematical problem
    By iugmoh in forum General
    Replies: 2
    Last Post: - 25th January 2008, 19:24
  4. Need help with lookup table or direct calculation
    By nverma in forum mel PIC BASIC Pro
    Replies: 24
    Last Post: - 11th October 2006, 19:27
  5. Mathematical Precedence
    By keithdoxey in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 6th October 2006, 22:44

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts