element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
In the Air Design Challenge
  • Challenges & Projects
  • Design Challenges
  • In the Air Design Challenge
  • More
  • Cancel
In the Air Design Challenge
Blog AirMobile - 7 - Humidity sensor
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: amgalbu
  • Date Created: 25 Nov 2014 11:28 AM Date Created
  • Views 313 views
  • Likes 1 like
  • Comments 0 comments
  • iot_distributed
  • msp430fr5969
  • in_the_air
  • adc
  • hih-4000
Related
Recommended

AirMobile - 7 - Humidity sensor

amgalbu
amgalbu
25 Nov 2014

Humidity sensor HIH4000


Today I connected the temperature sensor Honeywell HIH 4000 to the MSP430 Launchpad.

With a typical current draw of only 200 µA, this sensor is ideally suited for low-drain battery-powered devices.

Hardware considerations

HIH4000 has only three connections:

  • Vcc
  • GND
  • Output



image

The output voltage varies linearly with the Relative Humidity. Output voltage depends on Relative Humidity as shown in picture

 

image

 

According to datasheet, output voltage ranges from 0.8 V to 4 V. Because ADCs are configured to have a Vref of 2.0 V, a voltage divider is required.

Just to prevent any possible impedance mismatch between the HIH4000 output and the ADC input, I added a 741 operational amplifier in buffer configuration

The Vcc is provided through the ULN2003LV integrated circuit

 

image

 

To determine the R1-to-R2 ratio, the following equalities can be written

 

image

 

and substituting

 

image

 

Vmax is the maximum sensor output voltage (4 V) and Vadc is the ADC maximum input voltage (2.0 V). This leads to

 

image

image

Assuming R1 and R2 equals to 10 kΩ, the Equivalent Series Resistor seen by the sensor output (ignoring the input impedance of the operational amplifier, which is in theory infinite) is

image

So the sensor current load is

image

which seems to be ok

 

Software implementation

Using the same functions I already talked about in my previous post, I can write a the function to read out the output value provided by the HIH4000 sensor

 

float val = SENSORS_AnalogRead(ADC12_B_MEMORY_1);

 

According to the datasheet, relative humidity read by the sensor must be compensated in temperature according to the formula

 

image

T being expressed in degrees Celsius

The formula to convert ADC reading into RH is

image

where

  • "RH"  is the relative humidity (%)
  • "ADC reading" is value returned by the AD converter
  • "ADC precision"  is the ADC reference voltage (2.0 V) divided by the maximum value returned by the AD converter (1024). This resulting value is 2.0 V / 1024 = 0.00195
  • "Vout @ 0 RH"  is the output voltage when the sensor measures a Relative Humidity of 0. According to datasheet, this is 0.8 V. This value must be divided by the voltage divider ratio (2)
  • "Voltage step per RH"  is the variation in the voltage output when Relative Humidity changes of 1%. This can be calculated as

image

Note that the voltage divider ration must be taken into account when defining Vout@100RH and Vout@0RH

 

#define SENSORS_HIH4000_V_RATIO    2.0f

#define SENSORS_HIH4000_V_0RH      (0.8f / SENSORS_HIH4000_V_RATIO)

#define SENSORS_HIH4000_V_100RH    (4.0f / SENSORS_HIH4000_V_RATIO)

#define SENSORS_HIH4000_RH_MAX      100

#define SENSORS_HIH4000_V_PER_RH    \

  ((SENSORS_HIH4000_V_100RH - SENSORS_HIH4000_V_0RH) / SENSORS_HIH4000_RH_MAX)

 

void SENSORS_ReadRH()

{

  // read sensor value

  float val = SENSORS_AnalogRead(ADC12_B_MEMORY_1);

 

  // compensate with temperature

  val = val / (1.0305 +

            (0.000044 * SENSORS_Data.temperature) +

            (0.0000011 * SENSORS_Data.temperature * SENSORS_Data.temperature));

 

  // scale value to get RH

  val = (val * SENSORS_ADC_VMAX) / SENSORS_ADC_STEPS_MAX;

  val = (val - SENSORS_HIH4000_V_0RH) / SENSORS_HIH4000_V_PER_RH;

 

  SENSORS_Data.humidity = val;

}

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube