HDC1080 is a Temperature and Humidity Sensor IC (-40°C~+125°C、0.0%RH~100.0%RH) made by Texas Instruments. This posting will provide the OSS-ECAL(Open Source Software for Electronic Components Abstraction Layer) for HDC1080.
MCU interface : I2C,
CAUTION:Please be sure to refer to the latest version of the Datasheet prior to actual design.
HDC1080
General description
The HDC1080 is a digital humidity sensor with integrated temperature sensor that provides excellent measurement accuracy at very low power. The HDC1080 operates over a wide supply range, and is a low cost, low power alternative to competitive solutions in a wide range of common applications. The humidity and temperature sensors are factory calibrated.
Feature
- Relative Humidity Accuracy ±2% (typical)
- Temperature Accuracy ±0.2°C (typical)
- Excellent Stability at High Humidity
- 14 Bit Measurement Resolution
- 100 nA Sleep Mode Current
- Average Supply Current:
710 nA @ 1sps, 11 bit RH Measurement
1.3 µA @ 1sps, 11 bit RH and Temperature Measurement - Supply Voltage 2.7 V to 5.5 V
- Small 3 mm x 3 mm Device Footprint
- I2C Interface
Application
- HVAC
- Smart Thermostats and Room Monitors
- White Goods
- Printers
- Handheld Meters
- Medical Devices
- Wireless Sensor (TIDA: 00374, 00484, 00524)
OSS-ECAL specification
API Function
etSTS oHDC1080( etCMD cmd, uint16 cfg, stHDC1080_O* rlt )
The oHDC1080 function is an API function that executes HDC1080 processing according to the command in the argument.
NOTE:
The measurement time is as follows. (Decimal places less than 1 ms are rounded up)
Temperature: 11bit conversion 3.65ms, 14bit conversion 6.35ms
Humidity: 8bit conversion 2.50ms, 11bit conversion 3.65ms, 14bit conversion 6.5ms
The Measurement time is calculated from the Thread period that calls this API function, so set the Thread period to THREAD_OSS_ECAL_PERIOD[ms].
Return value | etSTS | OSS-ECAL status code | |
eSTS_FIN | Completed successfully | ||
eSTS_EXE | During execution | ||
eSTS_ERR_MIN | Minimum temperature error (rlt.temperature is minimum temperature) or Minimum humidity error (rlt.humidity is minimum humidity) | ||
eSTS_ERR_MAX | Maximum temperature error (rlt.temperature is maximum temperature) or Maximum humidity error (rlt.humidity is maximum humidity) | ||
eSTS_ERR_COMMAND_CODE | Command selection error | ||
eSTS_ERR_DIAG | If the comparison result is NG with the following commands eCMD_DIAG_DEVI_ID eCMD_DIAG_MANU_ID | ||
eSTS_ERR_I2C_OBJECT | I2C object selection error | ||
eSTS_ERR_OTHERS_RUN | Other components are executing the process | ||
eSTS_ERR_HAL_OTHERS_RUN | Other application is running HAL | ||
eSTS_ERR_HAL_I2C | HAL I2C error | ||
Parameter IN | etCMD cmd | OSS-ECAL command code | |
eCMD_WRITE_CFG | Command to write cfg value to Configuration Register (Pointer Register 0x02). 1. Calculate measurement time from the number of conversion bits for temperature and humidity. 2. Write cfg value to Configuration Register (Pointer Register 0x02). | ||
eCMD_READ_TEMP | Command that reads the value in the Temperature Register, converts that value to a temperature, and stores that temperature in rlt.temperature 1. Write 0x00 to Pointer Register. 2. Wait until the Measurement time has elapsed (return value eSTS_EXE while waiting). 3. Read the value of Temperature Register. 4. Convert Temperature Register value to Temperature. Temperature = (Temperature Register value/Temperature Gain) + Temperature Offset Value (Min, Max Limit) 5. Store Temperature in rlt.temperature. | ||
eCMD_READ_HUMI | Command that reads the value in the Humidity Register, converts the value to humidity, and stores the humidity in rlt.humidity. 1. Write 0x01 to Pointer Register. 2. Wait until the Measurement time has elapsed (return value eSTS_EXE while waiting). 3. Read the value of Humidity Register. 4. Convert Humidity Register value to Humidity. Humidity = Humidity Register value/Humidity Gain (Min, Max Limit) 5. Store Humidity in rlt.humidity. | ||
eCMD_READ_TEMP_HUMI | Commands that read the values in the Humidity Register and Temperature Register, convert that value to temperature and humidity, and store that temperature and humidity in rlt.temperature and rlt.humidity. 1. Write 0x00 to Pointer Register. 2. Wait until the Measurement time has elapsed (return value eSTS_EXE while waiting). 3. Reads the value of Temperature Register (Pointer 0x00) and Humidity Register (Pointer 0x01). 4. Converts Temperature Register readings to Temperature. Temperature = (Temperature Register value/Temperature Gain) + Temperature Offset Value (Min, Max Limit) 5. Convert Humidity Register value to Humidity. Humidity = Humidity Register value/Humidity Gain (Min, Max Limit) 6. Store Temperature in rlt.temperature. 7. Store Humidity in rlt.humidity. | ||
eCMD_READ_SERI_ID | Command that reads the value of Serial ID and stores it in rlt.serialID. 1. Write 0xFB to Pointer Register. 2. Read Serial ID ( First ). 3. Write 0xFC to Pointer Register. 4. Read Serial ID ( Mid ). 5. Write 0xFD to Pointer Register. 6. Read Serial ID ( Last ). 7. Store Serial ID in rlt.serialID. | ||
eCMD_READ_CFG | Command that reads the value of the Configuration Register and store the value in rlt.config. 1. Write 0x02 to Pointer Register. 2. Read Configuration Register. 3. Store the value read in rlt.config. | ||
eCMD_DIAG_DEVI_ID | Command that reads the value of DeviceID Register and returns the result of comparing the value with 0x1050 as the return value. 1. Write 0xFF to Pointer Register. 2. Read DeviceID Register. 3. Returns the result of comparing the read value with 0x1050 as the return value. True : eSTS_FIN False : eSTS_ERR_DIAG | ||
eCMD_DIAG_MANU_ID | Command that reads the value of ManufacturerID Register and returns the result of comparing the value with 0x5449 as the return value. 1. Write 0xFE to Pointer Register. 2. Read ManufacturerID Register. 3. Returns the result of comparing the read value with 0x5449 as the return value. True : eSTS_FIN False : eSTS_ERR_DIAG | ||
uint16 cfg | Configuration register (Pointer 0x02) settings | For cfg settings, please refer to the Datasheet “Configuration Register Description”. | |
Parameter OUT | stHDC1080_O* rlt | Receive data from HDC1080 | |
float32 temperature | Temperature [°C] | ||
float32 humidity | Humidity [%RH] | ||
uint16 config | Register 0x02 Configuration | ||
uint64 serialID | Register 0xFB to 0xFD Serial ID (First, Mid, Last) |
etSTS oHDC1080_WRITE_CFG( uint16 cfg )
The oHDC1080_WRITE_CFG function is an API function to write to the Configuration Register (Pointer Register 0x02) of the HDC1080.
- Calculate measurement time from the number of conversion bits for temperature and humidity.
- Write cfg value to Configuration Register (Pointer Register 0x02).
NOTE:
The measurement time is as follows. (Decimal places less than 1 ms are rounded up)
Temperature: 11bit conversion 3.65ms, 14bit conversion 6.35ms
Humidity: 8bit conversion 2.50ms, 11bit conversion 3.65ms, 14bit conversion 6.5ms
The Measurement time is calculated from the Thread period that calls this API function, so set the Thread period to THREAD_OSS_ECAL_PERIOD[ms].
Return value | etSTS | OSS-ECAL status code | |
eSTS_FIN | Completed successfully | ||
eSTS_EXE | During execution | ||
eSTS_ERR_I2C_OBJECT | I2C object selection error | ||
eSTS_ERR_OTHERS_RUN | Other components are executing the process | ||
eSTS_ERR_HAL_OTHERS_RUN | Other application is running HAL | ||
eSTS_ERR_HAL_I2C | HAL I2C error | ||
Parameter IN | uint16 cfg | Configuration register (Pointer 0x02) settings | For cfg settings, please refer to the Datasheet “Configuration Register Description”. |
etSTS oHDC1080_READ_TEMP( stHDC1080_O* rlt )
The oHDC1080_READ_TEMP function is an API function that reads the value of the Temperature Register of the HDC1080, converts that value to a temperature, and stores that temperature in rlt.temperature.
- Write 0x00 to Pointer Register.
- Wait until the Measurement time has elapsed (return value eSTS_EXE while waiting).
- Read the value of Temperature Register.
- Convert Temperature Register value to Temperature.
Temperature = (Temperature Register value/Temperature Gain) + Temperature Offset Value (Min, Max Limit) - Store Temperature in rlt.temperature.
NOTE:
The Measurement time is calculated from the Thread period that calls this API function, so set the Thread period to THREAD_OSS_ECAL_PERIOD[ms].
Return value | etSTS | OSS-ECAL status code | |
eSTS_FIN | Completed successfully | ||
eSTS_EXE | During execution | ||
eSTS_ERR_MIN | Minimum temperature error (rlt.temperature is minimum temperature) | ||
eSTS_ERR_MAX | Maximum temperature error (rlt.temperature is maximum temperature) | ||
eSTS_ERR_I2C_OBJECT | I2C object selection error | ||
eSTS_ERR_OTHERS_RUN | Other components are executing the process | ||
eSTS_ERR_HAL_OTHERS_RUN | Other application is running HAL | ||
eSTS_ERR_HAL_I2C | HAL I2C error | ||
Parameter OUT | stHDC1080_O* rlt | Receive data from HDC1080 | |
float32 temperature | Temperature [°C] | ||
float32 humidity | Humidity [%RH] (not updated) | ||
uint16 config | Register 0x02 Configuration (not updated) | ||
uint64 serialID | Register 0xFB to 0xFD Serial ID (First, Mid, Last) (not updated) |
etSTS oHDC1080_READ_HUMI( stHDC1080_O* rlt )
The oHDC1080_READ_HUMI function is an API function that reads the value of the Humidity Register of the HDC1080, converts that value to humidity, and stores that humidity in rlt.humidity.
- Write 0x01 to Pointer Register.
- Wait until the Measurement time has elapsed (return value eSTS_EXE while waiting).
- Read the value of Humidity Register.
- Convert Humidity Register value to Humidity.
Humidity = Humidity Register value/Humidity Gain (Min, Max Limit) - Store Humidity in rlt.humidity.
NOTE:
The Measurement time is calculated from the Thread period that calls this API function, so set the Thread period to THREAD_OSS_ECAL_PERIOD[ms].
Return value | etSTS | OSS-ECAL status code | |
eSTS_FIN | Completed successfully | ||
eSTS_EXE | During execution | ||
eSTS_ERR_MIN | Minimum humidity error (rlt.humidity is minimum humidity) | ||
eSTS_ERR_MAX | Maximum humidity error (rlt.humidity is maximum humidity) | ||
eSTS_ERR_I2C_OBJECT | I2C object selection error | ||
eSTS_ERR_OTHERS_RUN | Other components are executing the process | ||
eSTS_ERR_HAL_OTHERS_RUN | Other application is running HAL | ||
eSTS_ERR_HAL_I2C | HAL I2C error | ||
Parameter OUT | stHDC1080_O* rlt | Receive data from HDC1080 | |
float32 temperature | Temperature [°C] (not updated) | ||
float32 humidity | Humidity [%RH] | ||
uint16 config | Register 0x02 Configuration (not updated) | ||
uint64 serialID | Register 0xFB to 0xFD Serial ID (First, Mid, Last) (not updated) |
etSTS oHDC1080_READ_TEMP_HUMI( stHDC1080_O* rlt )
The oHDC1080_READ_TEMP_HUMI function reads the values of the Humidity Register and Temperature Register of the HDC1080, converts them to temperature and humidity, and stores the temperature and humidity in rlt.temperature and rlt. temperature and rlt. humidity.
- Write 0x00 to Pointer Register.
- Wait until the Measurement time has elapsed (return value eSTS_EXE while waiting).
- Reads the value of Temperature Register (Pointer 0x00) and Humidity Register (Pointer 0x01).
- Converts Temperature Register readings to Temperature.
Temperature = (Temperature Register value/Temperature Gain) + Temperature Offset Value (Min, Max Limit) - Convert Humidity Register value to Humidity.
Humidity = Humidity Register value/Humidity Gain (Min, Max Limit) - Store Temperature in rlt.temperature.
- Store Humidity in rlt.humidity.
NOTE:
The Measurement time is calculated from the Thread period that calls this API function, so set the Thread period to THREAD_OSS_ECAL_PERIOD[ms].
Return value | etSTS | OSS-ECAL status code | |
eSTS_FIN | Completed successfully | ||
eSTS_EXE | During execution | ||
eSTS_ERR_MIN | Minimum humidity error (rlt.humidity is minimum humidity) or Minimum temperature error (rlt.temperature is minimum temperature) | ||
eSTS_ERR_MAX | Maximum humidity error (rlt.humidity is maximum humidity) or Maximum temperature error (rlt.temperature is maximum temperature) | ||
eSTS_ERR_I2C_OBJECT | I2C object selection error | ||
eSTS_ERR_OTHERS_RUN | Other components are executing the process | ||
eSTS_ERR_HAL_OTHERS_RUN | Other application is running HAL | ||
eSTS_ERR_HAL_I2C | HAL I2C error | ||
Parameter OUT | stHDC1080_O* rlt | Receive data from HDC1080 | |
float32 temperature | Temperature [°C] | ||
float32 humidity | Humidity [%RH] | ||
uint16 config | Register 0x02 Configuration (not updated) | ||
uint64 serialID | Register 0xFB to 0xFD Serial ID (First, Mid, Last) (not updated) |
etSTS oHDC1080_READ_SERI_ID( stHDC1080_O* rlt )
The oHDC1080_READ_SERI_ID function is an API function that reads the Serial ID value of the HDC1080 and stores the value in rlt.serialID.
- Write 0xFB to Pointer Register.
- Read Serial ID ( First ).
- Write 0xFC to Pointer Register.
- Read Serial ID ( Mid ).
- Write 0xFD to Pointer Register.
- Read Serial ID ( Last ).
- Store Serial ID in rlt.serialID.
NOTE:
Return value | etSTS | OSS-ECAL status code | |
eSTS_FIN | Completed successfully | ||
eSTS_ERR_I2C_OBJECT | I2C object selection error | ||
eSTS_ERR_OTHERS_RUN | Other components are executing the process | ||
eSTS_ERR_HAL_OTHERS_RUN | Other application is running HAL | ||
eSTS_ERR_HAL_I2C | HAL I2C error | ||
Parameter OUT | stHDC1080_O* rlt | Receive data from HDC1080 | |
float32 temperature | Temperature [°C] (not updated) | ||
float32 humidity | Humidity [%RH] (not updated) | ||
uint16 config | Register 0x02 Configuration (not updated) | ||
uint64 serialID | Register 0xFB to 0xFD Serial ID (First, Mid, Last) |
etSTS oHDC1080_READ_CFG( stHDC1080_O* rlt )
The oHDC1080_READ_CFG function is an API function that reads the value of the Configuration Register of the HDC1080 and stores the value in rlt.config.
- Write 0xFF to Pointer Register.
- Read DeviceID Register.
- Returns the result of comparing the read value with 0x1050 as the return value.
True : eSTS_FIN
False : eSTS_ERR_DIAG
NOTE:
See Datasheet “Configuration Register Description”.
Return value | etSTS | OSS-ECAL status code | |
eSTS_FIN | Completed successfully | ||
eSTS_ERR_I2C_OBJECT | I2C object selection error | ||
eSTS_ERR_OTHERS_RUN | Other components are executing the process | ||
eSTS_ERR_HAL_OTHERS_RUN | Other application is running HAL | ||
eSTS_ERR_HAL_I2C | HAL I2C error | ||
Parameter OUT | stHDC1080_O* rlt | Receive data from HDC1080 | |
float32 temperature | Temperature [°C] (not updated) | ||
float32 humidity | Humidity [%RH] (not updated) | ||
uint16 config | Register 0x02 Configuration | ||
uint64 serialID | Register 0xFB to 0xFD Serial ID (First, Mid, Last) (not updated) |
etSTS oHDC1080_DIAG_DEVI_ID( void )
The oHDC1080_DIAG_DEVI_ID function is an API function that reads the value of the DeviceID Register of the HDC1080 and returns the result of comparing that value with 0x1050 as the return value.
- Write 0xFF to Pointer Register.
- Read DeviceID Register.
- Returns the result of comparing the read value with 0x1050 as the return value.
True … eSTS_FIN
False … eSTS_ERR_DIAG
NOTE:
Return value | etSTS | OSS-ECAL status code | |
eSTS_FIN | Completed successfully | ||
eSTS_ERR_DIAG | DeviceID Register value and 0x1050 mismatch | ||
eSTS_ERR_I2C_OBJECT | I2C object selection error | ||
eSTS_ERR_OTHERS_RUN | Other components are executing the process | ||
eSTS_ERR_HAL_OTHERS_RUN | Other application is running HAL | ||
eSTS_ERR_HAL_I2C | HAL I2C error |
etSTS oHDC1080_DIAG_MANU_ID( void )
The oHDC1080_DIAG_DEVI_ID function is an API function that reads the value of the ManufacturerID Register of the HDC1080 and returns the result of comparing that value with 0x5449 as the return value.
- Write 0xFE to Pointer Register.
- Read ManufacturerID Register.
- Returns the result of comparing the read value with 0x5449 as the return value.
True : eSTS_FIN
False : eSTS_ERR_DIAG
NOTE:
Return value | etSTS | OSS-ECAL status code | |
eSTS_FIN | Completed successfully | ||
eSTS_ERR_DIAG | ManufacturerID Register value and 0x5449 mismatch | ||
eSTS_ERR_I2C_OBJECT | I2C object selection error | ||
eSTS_ERR_OTHERS_RUN | Other components are executing the process | ||
eSTS_ERR_HAL_OTHERS_RUN | Other application is running HAL | ||
eSTS_ERR_HAL_I2C | HAL I2C error |
Files
Folder* | File | summary |
---|---|---|
HDC1080_HALNAME_VERSION/sample | sample.c (.cpp) | Sample Application Program |
| sample.h | Sample Application Header |
HDC1080_HALNAME_VERSION | oHDC1080.c (.cpp) | OSS-ECAL Program for HDC1080 |
| oHDC1080.h | OSS-ECAL Header for HDC1080 |
HDC1080_ARDUINO.ino | Sample application programs for Arduino | |
| oss_ecal.h | OSS-ECAL Common Header (Ver 01.01.00 or later, AUTOSAR is Ver 01.01.07 or later) |
| user_setting.c (.cpp) | Const and Table of User setting |
| user_setting.h | Header of User setting |
oHAL_i2c_stm32f4.c | HAL Program for STM32Cube FW_F4 | |
oHAL_i2c_stm32f4.h | HAL Header for STM32Cube FW_F4 | |
| readme.md | Readme |
| OSS-ECAL Terms of Use.txt | OSS-ECAL Terms of Use |
* For HALNAME, please refer to HAL Support.
HAL Support List
HAL | MCU* | Development environment* | HALNAME |
---|---|---|---|
Arduino 1.8.6 | ATmega2560 ATmega328P | Mega 2560 Rev3 Arduino Pro Mini 3.3V | ARDUINO |
ARM Mbed 6.17.0 | STM32F401RE | STM32 Nucleo-64 boards | MBED |
Infineon ModusToolbox HAL Cat1 2.4.3 | CYBLE-416045-02 | CY8CPROTO-063-BLE PSoC 6 BLE Prototyping Kit | ModusToolbox |
NXP MCUXpresso SDK iMXRT1051B_1052B ksdk2_0 | MIMXRT1052DVL6A | IMXRT1050-EVKB | iMXRT1051B1052B |
Renesas SSP 2.4.0 | R7FS7G27H3A01CFC | S7G2 SK | SSP |
STM STM32Cube FW_F4 V1.27.1 | STM32F401RE | STM32 Nucleo-64 boards | STM32F4 |
Debian(Linux) v2022.04 | TI AM335x | BeagleBone Black – Rev C | Linux |
* MCU and development environment at the time of development. Even if the same HAL is used, different MCUs and development environments may not work together.
OSS-ECAL Download
Please login before downloading. To register as a new user, please click here.
Built-in How to
How to incorporate OSS-ECAL into user programs
How to incorporate multiple OSS-ECALs in a user program (same MCU function)
How to incorporate multiple OSS-ECALs in a user program (different MCU function)
How to incorporate multiple identical electronic components into a user program
How to reduce the impact on user programs by replacing electronic components
CAUTION
The sample version of OSS-ECAL is not intended to be used with Threads (Tasks) or interrupts of different priority. Please do not use it as in the example below.
Example: If each sensor is assigned to the same ADC group and the OSS-ECAL API is executed in processes with different priorities, correct values may not be obtained.
ADC Gr0 Ch0 Temperature sensor AD22100A 100ms cycle Thread (low priority) to take in temperature
ADC Gr0 Ch1 Pressure sensor MPX5999D Event interrupts (high priority) to take pressure