Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Honeywell HIH-4030 Humidity Sensor


  • Please log in to reply
25 replies to this topic

#21 phantomtypist

phantomtypist

    Advanced Member

  • Members
  • PipPipPip
  • 142 posts
  • LocationNew York, NY

Posted 09 April 2013 - 05:06 PM

zee,

 

Would you just be able to attach your entire program?  Or link to it on github, etc?  It's a bit hard to debug if I don't see your code.



#22 zee

zee

    Advanced Member

  • Members
  • PipPipPip
  • 47 posts

Posted 10 April 2013 - 12:57 AM

Here's the attached of the program. Sorry again..

Attached Files



#23 zee

zee

    Advanced Member

  • Members
  • PipPipPip
  • 47 posts

Posted 10 April 2013 - 12:58 AM

Here's the attached of the program. 

Sorry again..



#24 zee

zee

    Advanced Member

  • Members
  • PipPipPip
  • 47 posts

Posted 10 April 2013 - 12:59 AM

Here's the program.  

Sorry again..



#25 zee

zee

    Advanced Member

  • Members
  • PipPipPip
  • 47 posts

Posted 10 April 2013 - 01:01 AM

Here is the code of the program. 

Sorry again.



#26 vlicovali

vlicovali

    New Member

  • Members
  • Pip
  • 1 posts

Posted 26 April 2013 - 04:06 PM

This is code for the Honeywell HIH-4030 humidity sensor (SparkFun SKU: SEN-09569).

Please note that the sensor is supposed to be used with 5v input, but it works just fine with 3.3v input because the output is linear.

The code below is tailored to 3.3v input.
 

    /// <summary>    /// Honeywell HIH-4030 humidity sensor (SEN-09569).     /// Please note that the sensor is supposed to be used with 5v input,     /// but it works just fine with 3.3v input because the output is linear.    /// The code below is tailored to 3.3v input.    /// </summary>    public class HIH4030 : IDisposable    {        private AnalogInput _sensor;        private bool _disposed;        protected virtual void Dispose(bool disposing)        {            // Check if Dipose has already been called.            if (!_disposed)            {                if (disposing)                {                    _sensor.Dispose();                    _disposed = true;                }            }        }        ~HIH4030()        {            Dispose(false);        }        public void Dispose()        {            Dispose(true);            GC.SuppressFinalize(this); // tell the GC not to finalize.        }        public HIH4030(Cpu.Pin analogPin)        {            _sensor = new AnalogInput(analogPin);            _sensor.SetRange(0, 3300);        }        /// <summary>        /// Calculates the relative humidity with temperature compensation.        /// </summary>        /// <param name="temp">Current temperature in Celsius.</param>        /// <returns>Returns the relative humidity as a percentage.</returns>        public double RelativeHumidity(float temp)        {            // Get the humidity sensor reading.            int sensorReading = _sensor.Read();            // Calculate the humidity sensor voltage.            double sensorVoltage = (((double)sensorReading / 3300) * 3.3);            // Define the voltage the sensor returns at 0% humidity.            double zeroVoltage = 0.528;            /* It has been observed that some sensors are consistently              * inaccurate and off by a certain voltage than what they              * should be.  Use this variable to compensate for what the              * voltage should be if needed. */            double calibrationVoltage = 0.00;            /* Determine the maxium voltage of the sensor with                 temperature compensation. */            double maxVoltage = (2.1582 - (0.004426 * temp));            /* Determine the temperature compensated relative humidity                 as a percentage. */            double rh = ((sensorVoltage + calibrationVoltage - zeroVoltage) / maxVoltage) * 100;                        return rh;        }            }

Hi, can you explain me, based on the spec sheet how you calculate the constants inf formulas? i have a hih-5030 but i can't understand how determinate the values for this sensor...

 

Regards

Virgilio






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.