grstat/hdc1080

uploaded 2 months ago
HDC1080 Driver for the ESP32

readme

# ESP32 HDC1080 COMPONENT DRIVER LIBRARY

ESP32 HDC1080 component driver library for the esp-idf

The HDC1080 is a temperature and humidity sensor made by 
Texas Instruments. For more information visit: https://www.ti.com/product/HDC1080

## Examples

Here is an example on how to configure and use the driver [Example](https://github.com/grstat/esp32-hdc1080/tree/main/examples)

changelog

# Changelog

## [0.2.0](https://github.com/grstat/esp32-hdc1080)

### Notes

- Transformed inital commits into a managed component library

readme of hdc1080_example_main example

                                        
                                        # ESP32 HDC1080 COMPONENT DRIVER LIBRARY EXAMPLE

The example code should give a good understanding of how to configure and use the hdc1080 component driver.

It includes how to use the aspects of the driver as well as the available macros for calculating and converting 
the data into various formats. Including: 
- Celsius -> Fahrenheit
- Temperature & humidity -> Dewpoint
- Temperature -> Air saturation vapor pressure
- Air saturation vapor pressure & humidity -> Air vapor pressure deficit

## Example workflow

- I2C is initalized, included is an I2C scan event that will display current devices on the bus for troubleshooting
- If the I2C initalized successfully the following occurs
- hdc1080_settings_t is filled with the I2C configuration and callback procedure
- hdc1080_config_t is filled with the defined register values
- The hdc1080 sensor is configured with the settings and configuration defined
- If the sensor is configured without error and inital sensor read is started; upon completion the hdc1080_settings_t.callback is called
- The callback procedure performs various conversions and prints the current sensor data.
- The current hdc1080 configuration is captured

## Pinout

| ESP32 | HDC1080 |
|-------|---------|
| 22    | SCL     |
| 21    | SDA     |
| 3.3v  | VCC     |
| GND   | GND     |

## Requirements

- An ESP32 Dev Kit
- An HDC1080 i2c Sensor module.
- esp-idf and tools (Developed and tested on v5.1.1)

### Project configuration

* Open the project configuration menu (`idf.py menuconfig`)
* Go to the HDC1080 Example config section
* Set the I2C SCL, SDA, PORT NUMBER & FREQUENCY if they are not the default
* If you do not wish to perform the I2C device scan you can disable the option 

### Build and Flash

Build the project and flash it to the board, then run monitor tool to view serial output:

```
idf.py -p PORT flash monitor
```

### EXAMPLE OUTPUT
```
I (347) main_task: Calling app_main()
I (367) I2C: FOUND DEVICE AT ADDRESS: 0x40
I (367) I2C: FOUND DEVICE AT ADDRESS: 0x44
I (367) MAIN: HDC1080 CONFIGURATION SUCCESSFUL
I (367) MAIN: READINGS WERE REQUESTED
E (377) MAIN: REQUEST FAILED, CONVERSION IN PROGRESS
I (377) main_task: Returned from app_main()
I (867) SENSOR_DATA: TEMPERATURE: 24.16°C | 75.49°F
I (877) SENSOR_DATA: HUMIDITY: 37.12%  -  DEWPOINT: 8.52°C | 47.34°F
I (877) SENSOR_DATA: AIR SATURATION VAPOR PRESSURE: 3.01 kPa  -  AIR VAPOR PRESSURE DEFICIT: 1.89 kPa
```
                                    

Links

Supports all targets

License: Apache-2.0

To add this component to your project, run:

idf.py add-dependency "grstat/hdc1080^0.2.2"

or download archive

Dependencies

  • ESP-IDF >=5.0
  • Examples:

    hdc1080_example_main

    more details

    To create a project from this example, run:

    idf.py create-project-from-example "grstat/hdc1080^0.2.2:hdc1080_example_main"

    or download archive

    Stats

    • Downloaded in total
      Downloaded in total 2 times
    • Downloaded this version
      This version: 1 time

    Badge

    grstat/hdc1080 version: 0.2.2
    |