I’ve got some trouble with the IO35 on the CYD board.
The board has two extended GPIO connectors labeled P3 and CN1 on the board.
In the Extended GPIO connectors, there are 4 GPIOs available: GPIO 35 , GPIO 22 , GPIO 21 , and GPIO 27
GPIO 21 is commen used with the backlight, so I can’t really use it as a output pin.
My plan was to connect on connector CN1 two DHT22 sensors on GPIO 22+27 as input ( on this connector is +3.3V and GND also availible) and connect the output (relais) on GPIO 35. That would be nice, because on connector P3 is also GND availible.
My problem is, that the Esphome compiler says: “GPIO35 (34-39) does not support output pin mode”
So I tried to switch GPIO35 with GPIO22 in my configuration. Compiler was happy, but the code doesn’t work. In the monitor was a Info message, that GPIO35 cannot used as input
Maybe I used the wrong board type - but on all examples I found this one was used:
esp32:
board: esp32dev
framework:
type: arduino
I hope somebody has a good idea
best regards
Sven
nickrout
(Nick Rout)
August 14, 2024, 9:27am
2
gpio35 is input only. So use it for an input. Use 22 or 27 as output.
nickrout
(Nick Rout)
August 14, 2024, 9:34am
3
By the way, in future post your yaml and logs
I made pin 22 to the output and pin 35 to input.
Result: this dht sensor doesn’t work on this input channel. I checked the pull up resistor and tried 4.7k instead of 10k, but nothing changed.
In the logfile is an message at 17:11:37 which only appears in this constellation.
Here is my esphome code:
# ============================================================
# Edit substitutions for your naming, devices and passwords here.
#
substitutions:
name: "kellerluefter"
friendly_name: Kellerluefter
api_key: !secret api_key
ota_password: !secret ota_password
ap_password: !secret ap_password
wifi_ssid: !secret wifi_ssid
wifi_password: !secret wifi_password
upper_devicename: "CYD Keller"
device_name_1: "Kellerluefter"
RELAIS_EIN: LOW
RELAIS_AUS: HIGH
RELAIS_PIN: '22'
DHT_1_PIN: '35'
DHT_2_PIN: '27'
# Home Assistant light bulb to toggle
bulb_name_1: "light.vent_1"
# ============================================================
# ESPHome YAML start
#
esphome:
name: ${name}
friendly_name: ${friendly_name}
min_version: 2024.6.0
name_add_mac_suffix: false
project:
name: esphome.web
version: dev
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
# Allow Over-The-Air updates
ota:
- platform: esphome
# Allow provisioning Wi-Fi via serial
improv_serial:
wifi:
# Set up a wifi access point
ap: {}
# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.
captive_portal:
dashboard_import:
package_import_url: github://esphome/example-configs/esphome-web/esp32.yaml@main
import_full_config: true
sensor:
- platform: dht
model: DHT22
pin: "$DHT_1_PIN"
temperature:
name: "Temperatur_aussen"
id: Temperatur_aussen
humidity:
name: "Feuchte_aussen"
id: Feuchte_aussen
update_interval: 30s
- platform: dht
model: DHT22
pin: "$DHT_2_PIN"
temperature:
name: "Temperatur_innen"
id: Temperatur_innen
humidity:
name: "Feuchte_innen"
id: Feuchte_innen
update_interval: 30s
- platform: absolute_humidity
name: Absolute_Humidity_out
temperature: Temperatur_aussen
humidity: Feuchte_aussen
- platform: absolute_humidity
name: Absolute_Humidity_in
temperature: Temperatur_innen
humidity: Feuchte_innen
- platform: template
name: "$name Taupunkt Keller"
id: "dewpoint_in"
lambda: |-
float t = id(Temperatur_innen).state ; // Luft-Temperatur (°C)
float r = id(Feuchte_innen).state ; // relative Luftfeuchtigkeit (%)
float a;
float b;
float ssd;
if (id(Temperatur_innen) >= 0) {
a = 7.5 ;
b = 237.3;
} else {
a = 7.6 ;
b = 240.7 ;
}
ssd = 6.1078 * pow(10, (a*t)/(b+t)) ;// Sättigungsdampfdruck (hPa)
float dd = ssd * (r/100) ;// Dampfdruck (hPa)
float mw = 18.016 ;// Molekulargewicht des Wasserdampfes (kg/kmol)
float gk = 8314.3 ;// universelle Gaskonstante (J/(kmol*K))
float t0 = 273.15 ;// Absolute Temperatur von 0 °C (Kelvin)
float tk = t + t0 ;// Temperatur in Kelvin
float v = log10(dd/6.1078) ; // v-Parameter
float td = ((b*v) / (a-v)) ; // Taupunkttemperatur (°C)
return (td) ;
state_class: measurement
device_class: temperature
unit_of_measurement: '°C'
- platform: template
name: "$name Taupunkt Aussen"
id: "dewpoint_out"
lambda: |-
float t = id(Temperatur_aussen).state ; // Luft-Temperatur (°C)
float r = id(Feuchte_aussen).state ; // relative Luftfeuchtigkeit (%)
float a;
float b;
float ssd;
if (t >= 0) {
a = 7.5 ;
b = 237.3;
} else {
a = 7.6 ;
b = 240.7 ;
}
ssd = 6.1078 * pow(10, (a*t)/(b+t)); // Sättigungsdampfdruck (hPa)
float dd = ssd * (r/100); // Dampfdruck (hPa)
float mw = 18.016 ; // Molekulargewicht des Wasserdampfes (kg/kmol)
float gk = 8314.3 ; // universelle Gaskonstante (J/(kmol*K))
float t0 = 273.15 ; // Absolute Temperatur von 0 °C (Kelvin)
float tk = t + t0 ; // Temperatur in Kelvin
float v = log10(dd/6.1078) ; // v-Parameter
float td = ((b*v) / (a-v)) ; // Taupunkttemperatur (°C)
return (td) ;
state_class: measurement
device_class: temperature
unit_of_measurement: '°C'
# Uptime sensor.
- platform: uptime
name: "${upper_devicename} Uptime"
entity_category: 'diagnostic'
update_interval: 300s
# WiFi Signal sensor.
- platform: wifi_signal
name: "${upper_devicename} WiFi Signal"
update_interval: 60s
entity_category: 'diagnostic'
- platform: template
name: "Differenz Taupunkt"
id: "delta_dew"
unit_of_measurement: "K"
state_class: "measurement"
lambda: |-
bool rel;
float DeltaTP;
float SCHALTmin = 5.0; // minimaler Taupunktunterschied, bei dem das Relais schaltet
float HYSTERESE = 1.0; // Abstand von Ein- und Ausschaltpunkt
float TEMP1_min = 10.0; // Minimale Innentemperatur, bei der die Lüftung aktiviert wird
float TEMP1_max = 35.0; // Minimale Innentemperatur, bei der die Lüftung aktiviert wird
float TEMP2_min = -10.0; // Minimale Außentemperatur, bei der die Lüftung aktiviert wird
DeltaTP = (float (id(dewpoint_out).state) - float(id(dewpoint_in).state));
if (DeltaTP > (SCHALTmin + HYSTERESE))rel = true;
if (DeltaTP < (SCHALTmin)) rel = false;
if (id(Temperatur_innen).state < TEMP1_min ) rel = false;
if (id(Temperatur_aussen).state < TEMP2_min ) rel = false;
if (id(Temperatur_innen).state > TEMP1_max > TEMP1_max ) rel = true;
if (rel == true) {
id(relay_1).turn_on();
} else {
id(relay_1).turn_off();
}
return (DeltaTP) ;
update_interval: 60s
output:
- platform: gpio
id: "relay_output"
pin: "$RELAIS_PIN"
time:
- platform: homeassistant
switch:
- platform: output
id: "relay_1"
name: "${device_name_1} vent"
output: "relay_output"
restore_mode: RESTORE_DEFAULT_OFF
# Restart Button
button:
- platform: restart
id: "restart_device"
name: "${device_name_1} Restart"
entity_category: 'diagnostic'
#reset button on device
binary_sensor:
- platform: gpio
name: "${upper_devicename} Button"
pin:
number: GPIO4
inverted: yes
mode:
input: true
pullup: true
on_press:
then:
- button.press: "restart_device"
filters:
- delayed_on_off: 5ms
internal: true
# To have a "next url" for improv serial
web_server:
and here is the log file:
INFO ESPHome 2024.7.0
INFO Reading configuration /config/esphome/kellerluefter.yaml...
INFO Detected timezone 'Europe/Berlin'
INFO Generating C++ source...
INFO Compiling app...
Processing kellerluefter (board: esp32dev; framework: arduino; platform: platformio/[email protected] )
--------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
- toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
Dependency Graph
|-- AsyncTCP-esphome @ 2.1.3
|-- WiFi @ 2.0.0
|-- FS @ 2.0.0
|-- Update @ 2.0.0
|-- ESPAsyncWebServer-esphome @ 3.2.2
|-- DNSServer @ 2.0.0
|-- ESPmDNS @ 2.0.0
|-- ArduinoJson @ 6.18.5
|-- Improv @ 1.2.3
RAM: [= ] 12.6% (used 41196 bytes from 327680 bytes)
Flash: [===== ] 49.9% (used 915725 bytes from 1835008 bytes)
========================= [SUCCESS] Took 16.18 seconds =========================
INFO Successfully compiled program.
INFO Connecting to 192.168.20.171
INFO Uploading /data/build/kellerluefter/.pioenvs/kellerluefter/firmware.bin (921504 bytes)
Uploading: [============================================================] 100% Done...
INFO Upload took 8.63 seconds, waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from 192.168.20.171 using esphome API
INFO Successfully connected to kellerluefter @ 192.168.20.171 in 7.123s
INFO Successful handshake with kellerluefter @ 192.168.20.171 in 0.093s
[17:10:56][I][app:100]: ESPHome version 2024.7.0 compiled on Aug 14 2024, 14:48:51
[17:10:56][I][app:102]: Project esphome.web version dev
[17:10:56][C][wifi:599]: WiFi:
[17:10:56][C][wifi:427]: Local MAC: 08:A6:F7:23:93:B8
[17:10:56][C][wifi:432]: SSID: 'Mariosnetzwerk'[redacted]
[17:10:56][C][wifi:435]: IP Address: 192.168.20.171
[17:10:56][C][wifi:439]: BSSID: F0:9F:C2:DD:E9:81[redacted]
[17:10:56][C][wifi:440]: Hostname: 'kellerluefter'
[17:10:56][C][wifi:442]: Signal strength: -49 dB ▂▄▆█
[17:10:56][C][wifi:446]: Channel: 11
[17:10:56][C][wifi:447]: Subnet: 255.255.255.0
[17:10:56][C][wifi:448]: Gateway: 192.168.20.1
[17:10:56][C][wifi:449]: DNS1: 192.168.20.99
[17:10:56][C][wifi:450]: DNS2: 0.0.0.0
[17:10:56][C][logger:185]: Logger:
[17:10:56][C][logger:186]: Level: DEBUG
[17:10:56][C][logger:188]: Log Baud Rate: 115200
[17:10:56][C][logger:189]: Hardware UART: UART0
[17:10:56][C][template.sensor:022]: Template Sensor 'kellerluefter Taupunkt Keller'
[17:10:56][C][template.sensor:022]: Device Class: 'temperature'
[17:10:56][C][template.sensor:022]: State Class: 'measurement'
[17:10:56][C][template.sensor:022]: Unit of Measurement: '°C'
[17:10:56][C][template.sensor:022]: Accuracy Decimals: 1
[17:10:56][C][template.sensor:023]: Update Interval: 60.0s
[17:10:56][C][template.sensor:022]: Template Sensor 'kellerluefter Taupunkt Aussen'
[17:10:56][C][template.sensor:022]: Device Class: 'temperature'
[17:10:56][C][template.sensor:022]: State Class: 'measurement'
[17:10:56][C][template.sensor:022]: Unit of Measurement: '°C'
[17:10:56][C][template.sensor:022]: Accuracy Decimals: 1
[17:10:56][C][template.sensor:023]: Update Interval: 60.0s
[17:10:56][C][uptime.sensor:033]: Uptime Sensor 'CYD Keller Uptime'
[17:10:56][C][uptime.sensor:033]: Device Class: 'duration'
[17:10:56][C][uptime.sensor:033]: State Class: 'total_increasing'
[17:10:57][C][uptime.sensor:033]: Unit of Measurement: 's'
[17:10:57][C][uptime.sensor:033]: Accuracy Decimals: 0
[17:10:57][C][uptime.sensor:033]: Icon: 'mdi:timer-outline'
[17:10:57][C][uptime.sensor:034]: Type: Seconds
[17:10:57][C][template.sensor:022]: Template Sensor 'Differenz Taupunkt'
[17:10:57][C][template.sensor:022]: State Class: 'measurement'
[17:10:57][C][template.sensor:022]: Unit of Measurement: 'K'
[17:10:57][C][template.sensor:022]: Accuracy Decimals: 1
[17:10:57][C][template.sensor:023]: Update Interval: 60.0s
[17:10:57][C][gpio.output:010]: GPIO Binary Output:
[17:10:57][C][gpio.output:011]: Pin: GPIO21
[17:10:57][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'CYD Keller Button'
[17:10:57][C][gpio.binary_sensor:016]: Pin: GPIO4
[17:10:57][C][output.switch:068]: Output Switch 'Kellerluefter vent'
[17:10:57][C][output.switch:091]: Restore Mode: restore defaults to OFF
[17:10:57][C][dht:017]: DHT:
[17:10:57][C][dht:018]: Pin: GPIO35
[17:10:57][C][dht:024]: Model: DHT22 (or equivalent)
[17:10:57][C][dht:027]: Update Interval: 30.0s
[17:10:57][C][dht:029]: Temperature 'Temperatur_aussen'
[17:10:57][C][dht:029]: Device Class: 'temperature'
[17:10:57][C][dht:029]: State Class: 'measurement'
[17:10:57][C][dht:029]: Unit of Measurement: '°C'
[17:10:57][C][dht:029]: Accuracy Decimals: 1
[17:10:57][C][dht:030]: Humidity 'Feuchte_aussen'
[17:10:57][C][dht:030]: Device Class: 'humidity'
[17:10:57][C][dht:030]: State Class: 'measurement'
[17:10:57][C][dht:030]: Unit of Measurement: '%'
[17:10:57][C][dht:030]: Accuracy Decimals: 0
[17:10:57][C][dht:017]: DHT:
[17:10:57][C][dht:018]: Pin: GPIO27
[17:10:57][C][dht:024]: Model: DHT22 (or equivalent)
[17:10:57][C][dht:027]: Update Interval: 30.0s
[17:10:57][C][dht:029]: Temperature 'Temperatur_innen'
[17:10:57][C][dht:029]: Device Class: 'temperature'
[17:10:57][C][dht:029]: State Class: 'measurement'
[17:10:57][C][dht:029]: Unit of Measurement: '°C'
[17:10:57][C][dht:029]: Accuracy Decimals: 1
[17:10:57][C][dht:030]: Humidity 'Feuchte_innen'
[17:10:57][C][dht:030]: Device Class: 'humidity'
[17:10:57][C][dht:030]: State Class: 'measurement'
[17:10:57][C][dht:030]: Unit of Measurement: '%'
[17:10:57][C][dht:030]: Accuracy Decimals: 0
[17:10:57][C][absolute_humidity.sensor:026]: Absolute Humidity 'Absolute_Humidity_out'
[17:10:57][C][absolute_humidity.sensor:026]: State Class: 'measurement'
[17:10:57][C][absolute_humidity.sensor:026]: Unit of Measurement: 'g/m³'
[17:10:57][C][absolute_humidity.sensor:026]: Accuracy Decimals: 2
[17:10:57][C][absolute_humidity.sensor:026]: Icon: 'mdi:water'
[17:10:57][C][absolute_humidity.sensor:036]: Saturation Vapor Pressure Equation: Wobus
[17:10:57][C][absolute_humidity.sensor:043]: Sources
[17:10:57][C][absolute_humidity.sensor:044]: Temperature: 'Temperatur_aussen'
[17:10:57][C][absolute_humidity.sensor:045]: Relative Humidity: 'Feuchte_aussen'
[17:10:57][C][absolute_humidity.sensor:026]: Absolute Humidity 'Absolute_Humidity_in'
[17:10:57][C][absolute_humidity.sensor:026]: State Class: 'measurement'
[17:10:57][C][absolute_humidity.sensor:026]: Unit of Measurement: 'g/m³'
[17:10:57][C][absolute_humidity.sensor:026]: Accuracy Decimals: 2
[17:10:57][C][absolute_humidity.sensor:026]: Icon: 'mdi:water'
[17:10:57][C][absolute_humidity.sensor:036]: Saturation Vapor Pressure Equation: Wobus
[17:10:57][C][absolute_humidity.sensor:043]: Sources
[17:10:57][C][absolute_humidity.sensor:044]: Temperature: 'Temperatur_innen'
[17:10:57][C][absolute_humidity.sensor:045]: Relative Humidity: 'Feuchte_innen'
[17:10:57][C][homeassistant.time:010]: Home Assistant Time:
[17:10:57][C][homeassistant.time:011]: Timezone: 'CET-1CEST,M3.5.0,M10.5.0/3'
[17:10:57][D][api:102]: Accepted 192.168.20.97
[17:10:57][C][restart.button:017]: Restart Button 'Kellerluefter Restart'
[17:10:57][C][restart.button:017]: Icon: 'mdi:restart'
[17:10:57][D][api.connection:1375]: Home Assistant 2024.7.3 (192.168.20.97): Connected successfully
[17:10:57][C][captive_portal:088]: Captive Portal:
[17:10:57][D][time:051]: Synchronized time: 2024-08-14 17:10:57
[17:10:57][C][web_server:173]: Web Server:
[17:10:57][C][web_server:174]: Address: kellerluefter.local:80
[17:10:57][C][mdns:116]: mDNS:
[17:10:57][C][mdns:117]: Hostname: kellerluefter
[17:10:57][C][esphome.ota:073]: Over-The-Air updates:
[17:10:57][C][esphome.ota:074]: Address: kellerluefter.local:3232
[17:10:57][C][esphome.ota:075]: Version: 2
[17:10:57][C][safe_mode:018]: Safe Mode:
[17:10:57][C][safe_mode:020]: Boot considered successful after 60 seconds
[17:10:57][C][safe_mode:021]: Invoke after 10 boot attempts
[17:10:57][C][safe_mode:023]: Remain in safe mode for 300 seconds
[17:10:57][C][api:139]: API Server:
[17:10:57][C][api:140]: Address: kellerluefter.local:6053
[17:10:57][C][api:144]: Using noise encryption: NO
[17:10:57][C][improv_serial:032]: Improv Serial:
[17:10:57][C][wifi_signal.sensor:009]: WiFi Signal 'CYD Keller WiFi Signal'
[17:10:57][C][wifi_signal.sensor:009]: Device Class: 'signal_strength'
[17:10:57][C][wifi_signal.sensor:009]: State Class: 'measurement'
[17:10:57][C][wifi_signal.sensor:009]: Unit of Measurement: 'dBm'
[17:10:57][C][wifi_signal.sensor:009]: Accuracy Decimals: 0
[17:11:07][D][esp-idf:000]: E (18904) gpio: gpio_set_level(226): GPIO output gpio_num error
[17:11:07][D][esp-idf:000]: E (18910) gpio: io_num=35 can only be input
[17:11:07][D][esp-idf:000]: E (18915) gpio: gpio_set_level(226): GPIO output gpio_num error
[17:11:07][W][dht:174]: Requesting data from DHT failed!
[17:11:07][W][dht:060]: Invalid readings! Please check your wiring (pull-up resistor, pin number).
[17:11:07][D][sensor:094]: 'Temperatur_aussen': Sending state nan °C with 1 decimals of accuracy
[17:11:07][D][sensor:094]: 'Feuchte_aussen': Sending state nan % with 0 decimals of accuracy
[17:11:07][W][component:237]: Component dht.sensor took a long time for an operation (56 ms).
[17:11:07][W][component:238]: Components should block for at most 30 ms.
[17:11:07][W][absolute_humidity.sensor:061]: No valid state from temperature sensor!
[17:11:07][W][absolute_humidity.sensor:064]: No valid state from temperature sensor!
[17:11:07][W][absolute_humidity.sensor:066]: Unable to calculate absolute humidity.
[17:11:07][D][sensor:094]: 'Absolute_Humidity_out': Sending state nan g/m³ with 2 decimals of accuracy
[17:11:08][D][dht:048]: Got Temperature=28.5°C Humidity=60.0%
[17:11:08][D][sensor:094]: 'Temperatur_innen': Sending state 28.50000 °C with 1 decimals of accuracy
[17:11:08][D][sensor:094]: 'Feuchte_innen': Sending state 60.00000 % with 0 decimals of accuracy
[17:11:08][D][absolute_humidity.sensor:095]: Saturation vapor pressure 3.891041 kPa
[17:11:08][D][absolute_humidity.sensor:101]: Publishing absolute humidity 16.769516 g/m³
[17:11:08][D][sensor:094]: 'Absolute_Humidity_in': Sending state 16.76952 g/m³ with 2 decimals of accuracy
[17:11:21][D][sensor:094]: 'kellerluefter Taupunkt Aussen': Sending state nan °C with 1 decimals of accuracy
[17:11:28][D][switch:012]: 'Kellerluefter vent' Turning ON.
[17:11:28][D][sensor:094]: 'Differenz Taupunkt': Sending state nan K with 1 decimals of accuracy
[17:11:37][D][esp-idf:000]: E (48904) gpio: gpio_set_level(226): GPIO output gpio_num error
[17:11:37][D][esp-idf:000]: E (48910) gpio: io_num=35 can only be input
[17:11:37][D][esp-idf:000]: E (48916) gpio: gpio_set_level(226): GPIO output gpio_num error
[17:11:37][W][dht:174]: Requesting data from DHT failed!
[17:11:37][W][dht:060]: Invalid readings! Please check your wiring (pull-up resistor, pin number).
[17:11:37][D][sensor:094]: 'Temperatur_aussen': Sending state nan °C with 1 decimals of accuracy
[17:11:37][D][sensor:094]: 'Feuchte_aussen': Sending state nan % with 0 decimals of accuracy
[17:11:37][W][component:237]: Component dht.sensor took a long time for an operation (62 ms).
[17:11:37][W][component:238]: Components should block for at most 30 ms.
[17:11:37][W][absolute_humidity.sensor:061]: No valid state from temperature sensor!
[17:11:37][W][absolute_humidity.sensor:064]: No valid state from temperature sensor!
[17:11:37][W][absolute_humidity.sensor:066]: Unable to calculate absolute humidity.
[17:11:37][D][sensor:094]: 'Absolute_Humidity_out': Sending state nan g/m³ with 2 decimals of accuracy
[17:11:38][D][dht:048]: Got Temperature=28.6°C Humidity=58.6%
[17:11:38][D][sensor:094]: 'Temperatur_innen': Sending state 28.60000 °C with 1 decimals of accuracy
[17:11:38][D][sensor:094]: 'Feuchte_innen': Sending state 58.60000 % with 0 decimals of accuracy
[17:11:38][D][absolute_humidity.sensor:095]: Saturation vapor pressure 3.913687 kPa
[17:11:38][D][absolute_humidity.sensor:101]: Publishing absolute humidity 16.468092 g/m³
[17:11:38][D][sensor:094]: 'Absolute_Humidity_in': Sending state 16.46809 g/m³ with 2 decimals of accuracy
I hope you’ve got further ideas.
EBME2
(Ebme2)
August 19, 2024, 7:08pm
5
I’d try clean building your files, to me looks like you still have some left over from your previous config.
Andy
Obelixxx
(Rein Graat)
September 5, 2024, 12:42pm
6
@svenny80
I have some different issues with this board on ESPHome.
Are you using the screen at all in your project?