Open Joshfindit opened 4 years ago
You might look through the options on https://esphome.io/ in particular: https://esphome.io/components/sensor/dht.html. https://esphome.io/components/sensor/htu21d.html
Some of the particulate and gas sensors also provide temp and humidity: https://esphome.io/components/sensor/pmsx003.html https://esphome.io/components/sensor/scd30.html
It would be great to have a sensor comparison material! I saw that your example has a lot of sensors that are already supported, I would be great if you could contribute.
The HDC2080 might look similar to the HDC1080, have you tried?
The HDC2080 might look similar to the HDC1080, have you tried?
I did, yes. Unfortunately it's too different 😔
Nov 25 15:02:43 d3miniv3breadboarder/debug [I][i2c:033]: Scanning i2c bus for active devices...
Nov 25 15:02:43 d3miniv3breadboarder/debug [I][i2c:040]: Found i2c device at address 0x40
Nov 25 15:02:43 d3miniv3breadboarder/debug [C][logger:175]: Logger:
Nov 25 15:02:43 d3miniv3breadboarder/debug [C][logger:176]: Level: DEBUG
Nov 25 15:02:43 d3miniv3breadboarder/debug [C][logger:177]: Log Baud Rate: 115200
Nov 25 15:02:43 d3miniv3breadboarder/debug [C][logger:178]: Hardware UART: UART0
Nov 25 15:02:43 d3miniv3breadboarder/debug [C][hdc1080:028]: HDC1080:
Nov 25 15:02:43 d3miniv3breadboarder/debug [C][hdc1080:029]: Address: 0x40
Nov 25 15:02:43 d3miniv3breadboarder/debug [E][hdc1080:031]: Communication with HDC1080 failed!
I'm mostly familiar with Sensirions environmental sensors and the popular models are already implemented: STS3x: Temp SHTCx: Temp + Humidity SHTx-D: Temp + Humidity SCD30: COâ‚‚ + Temp + Humidity SGP30: COâ‚‚eq + VOC
The SPS30: Particulate Matter support is also coming
For Temp & Humidity sensors there is detailed table which might be useful
regards, Nad
I tried the same, but I get a different error, and I actually get reportings, but always -40 and 0, so there seem to be communication over the bus
[D][hdc1080:069]: Got temperature=-40.0°C humidity=0.0%
[C][hdc1080:016]: Setting up HDC1080...
[W][hdc1080:025]: HDC1080 initial config instruction error
[...]
[C][i2c.arduino:053]: I2C Bus:
[C][i2c.arduino:054]: SDA Pin: GPIO21
[C][i2c.arduino:055]: SCL Pin: GPIO22
[C][i2c.arduino:056]: Frequency: 100000 Hz
[C][i2c.arduino:059]: Recovery: bus successfully recovered
[I][i2c.arduino:069]: Results from i2c bus scan:
[I][i2c.arduino:075]: Found i2c device at address 0x40
here I read the sensor supports i2c with either 100k or 400k data rate, but setting i2c frequency to either 100000
or 400000
did not made it work either
I also tried different hdc2080 to make sure it's not a buggy sensor.
I continued further and tried to load the platform.io library for the HDC2080 in the esphome config, but my skills to actively hook into the existing lib are not enough. If there is someone able to help calling the function from library with template sensor in esphome we can continue
esphome:
libraries:
- "Wire"
- "lime-labs/Lime Labs HDC2080"
includes:
- hdc2080.h
#--- SENSOR CONFIG ---#
sensor:
- platform: custom
lambda: |-
return {hdc2080->temperature_sensor, hdc2080->humidity_sensor};
sensors:
- name: "Temperature"
id: sensor_temperature
unit_of_measurement: °C
accuracy_decimals: 2
- name: "Humidity"
id: sensor_humidity
unit_of_measurement: "%"
accuracy_decimals: 2
I understand that somehow I now need to call the functions from the library with the hdc2080.h but I have no clue how.
This is what I copied from another project, blindly not knowing what I really do, hoping I can work myself through the failure messages afterwards. I ended up commenting out the two includes, but failure messages with my C skills are not enough to further troubleshoot it.
// #include "esphome.h"
// #include "HDC2080.h"
class HDC2080 : public PollingComponent {
public:
HDC2080 hdc2080;
Sensor *temperature_sensor = new Sensor();
Sensor *humidity_sensor = new Sensor();
// To prevent self-heating, the datasheet warns to do
// maximum two measurements per second at 12-bit accuracy.
// Stay on the safe side by polling every five seconds,
// because the calls to vpd() and dew_point() also measure
// the temperature.
HDC2080() : PollingComponent(5000) { }
void setup() override {
if(!hdc2080.begin()) {
ESP_LOGE("HDC2080", "Sensor is not connected");
}
}
void update() override {
float temperature = hdc2080.temperature();
temperature_sensor->publish_state(temperature);
int humidity = hdc2080.humidity();
humidity_sensor->publish_state(humidity);
}
};
The HDC2080 is superior to the HDC1080, it uses less power and allows for an alternative i2c address, so one can have 2 of them on the same bus
Additional info: the project I copied the idea and code from: https://github.com/koenvervloesem/M5Stack-Air-Quality-ESPHome the HA forum where I got the hint to do it that way (unfortunately another hopeless fail :-) ): https://github.com/koenvervloesem/M5Stack-Air-Quality-ESPHome
+1 for HDC3020, much more RH (0.5%) accurate compared to e.g. ScioSense ENS212 (1.5%) or Sensirion SHT41 (2%) for about the same price.
+1 for HDC3020, much more RH (0.5%) accurate compared to e.g. ScioSense ENS212 (1.5%) or Sensirion SHT41 (2%) for about the same price.
Can you back this with some test results?
Can you back this with some test results?
No, per spec sheets:
TI HDC302x looks very attractive as it offers four selectable I2C addresses (0x44, 0x45, 0x46, 0x47)
Describe the problem you have/What new integration you would like
Support for the HDC2080 temperature sensor
Please describe your use case for this integration and alternatives you've tried:
Standard stuff: want an esphome-based thermostat
Side note: There are a lot of temp/humidity sensors available. If someone has the raw data and I have dev blessing, I'll build a documentation page about the best options when using ESPHome: what's used and praised by maintainers, relative accuracy, what the trade-offs are, etc. Possibly titled "Measuring indoor/outdoor temperature with ESPHome"
Additional context
Test results showing it's very accurate for humidity, and a couple degrees off for temperature: https://wiki.liutyi.info/display/ARDUINO/Test+4+v6+Saturated+NaCl+solution Example code: https://github.com/tinkeringtech/HDC2080_breakout Datasheet: http://www.ti.com/lit/ds/symlink/hdc2080.pdf Application notes etc: http://www.ti.com/product/HDC2080/technicaldocuments