Open Heiko-L opened 3 months ago
Why do you think the pullup is enabled?
Why do you think the pullup is enabled?
I have an external circuit with pullup, series resistor and schottky diodes and it can't be pulled down because of the enabled internal pullups (only to about 1,8V - 33k external series resistor against the 45k internal pullup). Defining the GPIO as binary sensor everything works fine because internal pullups are disabled then.
There is nothing in the code that would enable the pullup.
But they are enabled.
These options I tried:
- platform: pulse_counter
pin: GPIO27
name: ${friendly_name} RPM1
- platform: pulse_counter
pin:
number: GPIO14
mode:
input: true
pullup: false
name: ${friendly_name} RPM2
- platform: pulse_counter
pin:
number: GPIO27
mode:
input: true
pullup: true
name: ${friendly_name} RPM1
- platform: pulse_counter
pin:
number: GPIO14
inverted: true
mode:
input: true
pullup: false
name: ${friendly_name} RPM2
Then I tried to enable pulldowns and that doesn't work either:
- platform: pulse_counter
pin:
number: GPIO27
mode:
input: true
pulldown: true
name: ${friendly_name} RPM1
- platform: pulse_counter
pin:
number: GPIO14
inverted: true
mode:
input: true
pulldown: true
name: ${friendly_name} RPM2
The circuit (FanXTachoOut is connected to ESP32's GPIO):
With all of the above options I get ~1,8-1,9V at FanXTachoOut when FanXTachoIn is tied to ground.
Using:
binary_sensor:
- platform: gpio
pin:
number: GPIO14
mode:
input: true
name: ${friendly_name} Pulse Counter 1
- platform: gpio
pin:
number: GPIO27
mode:
input: true
pullup: false
name: ${friendly_name} Pulse Counter 2
I get <2mV at FanXTachoOut when FanXTachoIn is tied to ground.
That is the output after esphome run:
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 |-- noise-c @ 0.1.4 |-- ArduinoJson @ 6.18.5
AAAARGH, it is hard coded in esp-idf... Why??? pulse_cnt.c from esp-idf's GitHub
@ssieb is it possible to alter the IO_MUX_x_REG after creating the pulse counter to set the Pin to the desired input mode?
You can try. Why do you have such a circuit?
You can try.
How?
Why do you have such a circuit?
Because the NodeMCU Boards I have are pus***s... I have already three with some defect GPIOs (I think because of weak/non existent clamping diodes)- so I decided to pull up, clamp and limit the current externally.
Adding a pulse counter with setup_priority: 601 and a binary sensor with setup_priority: 599 on the same GPIO pin let me change the pin configuration via the binary sensor (allow_other_uses must be configured on both components)
The problem
When using the Pulse Counter Sensor pullups are active and can't be disabled (pullup: false does not do anything either). If I configure the same Pins as simple binary sensor pullups can be disabled: binary_sensor:
platform: gpio pin: number: GPIO14 mode: input: true id: pulse_counter_1 name: ${friendly_name} Pulse Counter 1
platform: gpio pin: number: GPIO27 mode: input: true id: pulse_counter_2 name: ${friendly_name} Pulse Counter 2
Can someone confirm this?
TIA Heiko
Which version of ESPHome has the issue?
2024.7.2
What type of installation are you using?
pip
Which version of Home Assistant has the issue?
No response
What platform are you using?
ESP32
Board
nodemcu-32s
Component causing the issue
Pulse Counter Sensor
Example YAML snippet
Anything in the logs that might be useful for us?
No response
Additional information
No response