Hello,
I have connected an ENS160+AHT21 sensors to an ESP, everything works fine but the temperature.
I used this sensor because I have read that it is very accurate but mine it is not. I always have +5/6 °C above the ambient temperature.
I powered it with the +5V because all the diagrams I found uses that pin, but onboard there is also a 3.3V
How can I solve? Is there a sort of calibration to do?
Here there reference:
a random digital thermometer 22°C
a motion sensor with temp from philips 21,22 °C
and the AHT21 I have to use with the Ikea Vindriktning 27.07°C
# -------------------------------------------------------------
# PROGETTO ZERO
# -------------------------------------------------------------
#
# creato da RP
# data creazione 28.01.2024
# data_modifica 28.01.2024
# versione 0.20
#
#
# -------------------------------------------------------------
esphome:
name: zero-1
friendly_name: zero-1
platform: ESP8266
board: d1_mini
# on_boot:
# - priority: -100
# then:
# - wait_until: api.connected
# - delay: 1s
# - if:
# condition:
# switch.is_on: use_wake_word
# then:
# - voice_assistant.start_continuous:
api:
encryption:
key: "chiave-api"
ota:
password: "chiave-ota"
wifi:
ssid: !secret wifi_iot_ssid
password: !secret wifi_iot_password
ap:
ssid: "zero-1-wifi"
password: "my_super_password"
manual_ip:
static_ip: 192.168.207.41
gateway: 192.168.207.254
subnet: 255.255.255.0
dns1: 192.168.207.254
domain: .mydomain.cloud
logger:
## porta UART per sensore ikea (pin rest)
uart:
- rx_pin: D7
# tx_pin: D8
baud_rate: 9600
## porta i2c
i2c:
sda: D2
scl: D1
scan: true
id: bus_a
# frequency: 200khz
binary_sensor:
# ## Use the on-board LED to show "Fan Running"
# - platform: gpio
# name: zero-1-ventola
# id: fan
# pin:
# number: D4
# inverted: true
- platform: template
name: zero-1-luce-ok
id: bright
sensor:
## IKEA PMS 2.5um Sensor
- platform: pm1006
id: aq_sensor
pm_2_5:
name: zero-1-pm-25
## The IKEA Light Level Sensor
- platform: adc
id: zero_1_livello_luce
name: zero-1-livello-luce
pin: A0
update_interval: 10s
## Check the value and turn On/Off our Binary Sensor
on_value:
- lambda: !lambda |
if (x > 0.01) {
id(bright).publish_state(true);
} else {
id(bright).publish_state(false);
}
- logger.log:
format: "livello luce %.6f"
args: id(zero_1_livello_luce).state
# ENS160 qualità aria, co2 e voc
- platform: ens160
eco2:
name: zero-1-co2
tvoc:
name: zero-1-voc
aqi:
name: zero-1-aqi
id: id_zero_1_aqi
update_interval: 10s
address: 0x53
compensation:
temperature: id_zero_1_temperatura
humidity: id_zero_1_umidita
# AHT21 temperatura e umidità
- platform: aht10
variant: AHT20
temperature:
name: zero-1-temperatura
id: id_zero_1_temperatura
humidity:
name: zero-1-umidita
id: id_zero_1_umidita
update_interval: 30s
address: 0x38
text_sensor:
- platform: template
name: zero-1-qualita-aria
lambda: |-
switch ( (int) (id(id_zero_1_aqi).state) ) {
case 1: return {"eccellente"};
case 2: return {"buona"};
case 3: return {"media"};
case 4: return {"scarsa"};
case 5: return {"molto scarsa"};
default: return {"non disponibile"};
}
EDIT: add code
Have you waited the 1 hour +/- it takes before itd ready to take readings?
Yes I did,
but the temperature as well as humidity are present since the first boot up, the hour is needed for the ENS160
here is a comparison between the temperature read from the sensor (blue) and from the philips hue motion sensor
the gap since the beginning is +5/6 °C
PS. I just noticed that the sensor stop sending all data (from ENP160 and from AHT), on log I have
[20:00:08][C][ens160:314]: State Class: 'measurement'
[20:00:08][C][ens160:314]: Unit of Measurement: '%'
[20:00:08][C][ens160:314]: Accuracy Decimals: 2
[20:00:08][C][aht10:150]: AHT10:
[20:00:08][C][aht10:151]: Address: 0x38
[20:00:08][E][aht10:153]: Communication with AHT10 failed!
[20:00:08][C][aht10:155]: Temperature 'zero-1-temperatura'
[20:00:08][C][aht10:155]: Device Class: 'temperature'
[20:00:08][C][aht10:155]: State Class: 'measurement'
[20:00:08][C][aht10:155]: Unit of Measurement: '°C'
[20:00:08][C][aht10:155]: Accuracy Decimals: 2
[20:00:08][C][aht10:156]: Humidity 'zero-1-umidita'
[20:00:08][C][aht10:156]: Device Class: 'humidity'
[20:00:08][C][aht10:156]: State Class: 'measurement'
[20:00:10][C][aht10:156]: Unit of Measurement: '%'
[20:00:10][C][aht10:156]: Accuracy Decimals: 2
I have reboot it and it start to send data again
Have you watched the logs to see if its picking up any other i2c addresses in the backround?
Your power supply is more than adequate, right?
You can always swap out sensors to rule out the actual sensor as the problem too.
How can I do? (sorry I am not so expert of esphome)
Anyway when I start the log this is what I get
[21:22:33][I][i2c.arduino:069]: Results from i2c bus scan:
[21:22:33][I][i2c.arduino:075]: Found i2c device at address 0x38
[21:22:33][I][i2c.arduino:075]: Found i2c device at address 0x53
these are the only 2 i2c devices connected, the other one used uart (for the pm2.5 from the ikea board).
Esphome sees two devices but the board is one
I am using the usb from the ikea board to power up everything (for the power I am using a 60W from ugreen) so unless some regulator inside of this board I should be ok with the current.
I have checked the voltage on the esp and on the board and I have 5.1V
Unfortunately this is the only sensor I have.
I can try to change the esp itself… using a full length board instead of the mini, but I don’t think that this will solve…
I think I find the problem, when operate this combo device, it heats up and this cause the wrong temperature reading.
opened 12:13PM - 24 Dec 22 UTC
closed 04:31AM - 24 Nov 23 UTC
Type: Air Quality
<!-- READ THIS FIRST:
- This is for feature requests only, for issues please g… o to the issues repository.
- Please be as descriptive as possible, especially use-cases that can otherwise not be solved boost the problem's priority.
DO NOT DELETE ANY TEXT from this template! Otherwise the issue may be closed without a comment.
-->
**Describe the problem you have/What new integration you would like**
Add support for the ens160 air quality sensor.
**Please describe your use case for this integration and alternatives you've tried:**
A new type of air quality sensor has started to appear in the electronic shops, the ens160. It supports VOC, CO2 and AQI measurements and esphome doesn't support it.
I'm working on a pull request to add support for this sensor. The goal of this issue is to track any progress.
**Additional context**
https://www.sciosense.com/products/environmental-sensors/digital-multi-gas-sensor/
https://learn.adafruit.com/adafruit-ens160-mox-gas-sensor
https://learn.sparkfun.com/tutorials/sparkfun-indoor-air-quality-sensor---ens160-qwiic-hookup-guide
…there is a strong correlation between the temperature and the validity of the ENS160 data. It seems that the heater of the ENS160 significantly warms up the AHT21 as there is an increase of about 6 °C when the ENS160 is producing data. This is a bad sign for anyone wanting to use this sensor for environment monitoring. Furthermore, at the same time that data retrieval from ENS160 stops, the temperature starts to drop again which implies that the ENS160’s heaters are turned off.
so it is compact and complete, but not the best sensor around…
Idk if you did or didnt but, researching devices/sensors before you buy them is a good idea. It doesnt seem like most people do any at all.
I can’t check all feedback that people leaves around the whole web, the few info I found were positives so I trusted them…
Anyway… Don’t worry, next time I will ask directly to you
Ya, thats true. I wasnt going to bring it up but, since you did. Im honestly a little disappointed you didnt check with me first on this one…
Next time I will, I have read some other of your posts and you are look very prepared!
Wheemer
(Wheemer)
February 8, 2024, 2:20pm
11
I am seeing the same problem. The AHT21 is basically useless.
I complained to the seller and got half off. So using it as just the ens160 currently, although I am still unsure if that can be trusted considering how dumb the designers of this combo sensor were.
This probably would not be a problem if the sensors were not active at the same time, so this is more of a software problem than anything else.
Anyway, thanks for the info I am going to access the sensors from arduino instead so that this does not become a problem.