I have ESPhome installed in D1mini board connected to simple 4 channel relay board and binary sensor switches to control relays, all connected to D1mini GPIO pins.
No Issues with relay board, but one binary sensor switch acting weird. I’m using momentary switches with 2 pins, one connected to GPIO pin allocated to binary sensor pin and one to ground. When I press the button, it’s working for only once, later not working no matter how many times I press, but working when I touch the GPIO pin wire with my finger/screw driver/any object, but not ground pin.
I’m searching for this phenomenon for long time, without any answer. Is it because any polarity? Do I need to use any kind of resistor or anything? Don’t know much about electronics.
Thanks for this info. Next time, I’ll refer to this while assigning GPIO pins. I mostly use MCP23017 to extend GPIOs for more than 4 switches which has no issues. Previously I used almost all pins on D1mini (except D8 as it needs pull down resistor which I don’t have) without any issue. Now I have 3 prototype boards only have issues with D0 pin (for input). I better leave that pin alone.
Putting aside the issue about which pin to use, the “activated by finger” evidence suggests you don’t have a pull-up resistor on that gpio pin. You can configure esphome to use the internal pull-up or wire in an external pull-up.
I’d suggest doing this for all of your inputs - even if they aren’t currently showing problems. If those pins are floating when button not pressed, you could see errors pop up as environment changes.
can’t assign a different pin as all are occupied (except D8 as it causing boot failures and need to use a pull down resistor).
Also tried input_pulldown_16, not worked
Just to make sure, I’m using below diagram to use a 5K resistor between 5V and pin.
Sure, I have spare 10K resistors to use right now.
Can I use D8 pin with a pull down resistor (may be between pin and ground) with same resistance value without causing boot failure?
d8 is actually gpio15. This pin needs to be in a certain state during boot, but after that, should work. IE, wire correctly so pin is in correct state when button not pressed - and then be sure to not press button during boot.
@sathish can you share your confíguration for using the MCP23017 with switches? Im currently trying to use it with esphome and some momentary switches but it just doesnt register any input.
[18:00:29][C][api:095]: API Server:
[18:00:29][C][api:096]: Address: 192.168.10.105:6053
[18:00:59][D][binary_sensor:036]: 'MCP23008 Pin #1': Sending state OFF
[18:00:59][D][binary_sensor:036]: 'MCP23008 Pin #1': Sending state ON
[18:01:20][D][binary_sensor:036]: 'MCP23008 Pin #1': Sending state OFF
[18:01:20][D][binary_sensor:036]: 'MCP23008 Pin #1': Sending state ON
[18:01:21][D][binary_sensor:036]: 'MCP23008 Pin #1': Sending state OFF
[18:01:21][D][binary_sensor:036]: 'MCP23008 Pin #1': Sending state ON
[18:01:22][D][binary_sensor:036]: 'MCP23008 Pin #1': Sending state OFF
[18:01:22][D][binary_sensor:036]: 'MCP23008 Pin #1': Sending state ON
[18:01:22][D][binary_sensor:036]: 'MCP23008 Pin #1': Sending state OFF
[18:01:22][D][binary_sensor:036]: 'MCP23008 Pin #1': Sending state ON
[18:01:23][D][binary_sensor:036]: 'MCP23008 Pin #1': Sending state OFF
[18:01:23][D][binary_sensor:036]: 'MCP23008 Pin #1': Sending state ON
[18:01:28][D][binary_sensor:036]: 'MCP23008 Pin #1': Sending state OFF
[18:01:28][D][binary_sensor:036]: 'MCP23008 Pin #1': Sending state ON
[18:01:39][D][binary_sensor:036]: 'MCP23008 Pin #1': Sending state OFF
[18:01:39][D][binary_sensor:036]: 'MCP23008 Pin #1': Sending state ON
[18:01:43][D][binary_sensor:036]: 'MCP23008 Pin #1': Sending state OFF
[18:01:43][D][binary_sensor:036]: 'MCP23008 Pin #1': Sending state ON
[18:01:47][D][binary_sensor:036]: 'MCP23008 Pin #1': Sending state OFF
[18:01:47][D][binary_sensor:036]: 'MCP23008 Pin #1': Sending state ON
[18:01:53][D][binary_sensor:036]: 'MCP23008 Pin #1': Sending state OFF
[18:01:53][D][binary_sensor:036]: 'MCP23008 Pin #1': Sending state ON
[18:01:54][D][binary_sensor:036]: 'MCP23008 Pin #1': Sending state OFF
[18:01:54][D][binary_sensor:036]: 'MCP23008 Pin #1': Sending state ON
[18:01:55][D][binary_sensor:036]: 'MCP23008 Pin #1': Sending state OFF
[18:01:55][D][binary_sensor:036]: 'MCP23008 Pin #1': Sending state ON
[18:01:56][D][binary_sensor:036]: 'MCP23008 Pin #1': Sending state OFF
[18:01:56][D][binary_sensor:036]: 'MCP23008 Pin #1': Sending state ON
[18:01:59][D][binary_sensor:036]: 'MCP23008 Pin #1': Sending state OFF
[18:01:59][D][binary_sensor:036]: 'MCP23008 Pin #1': Sending state ON
[18:02:08][D][binary_sensor:036]: 'MCP23008 Pin #1': Sending state OFF
[18:02:08][D][binary_sensor:036]: 'MCP23008 Pin #1': Sending state ON
[18:02:09][D][binary_sensor:036]: 'MCP23008 Pin #1': Sending state OFF
[18:02:09][D][binary_sensor:036]: 'MCP23008 Pin #1': Sending state ON
[18:02:10][D][binary_sensor:036]: 'MCP23008 Pin #1': Sending state OFF
[18:02:10][D][binary_sensor:036]: 'MCP23008 Pin #1': Sending state ON
without pushing any button it is automatically on and off … what to do ?
for testing in the same device instead of mcp23017 pin 8, I used ESP gpio33 with the same wiring. it is not having any problem works perfectly.
mcp23017 pin is connected to GPIO21 and 22 VCC to 5v and GND to GND and A0 A1 A2 are connected to Ground (for 0x20)
When my esp is not configured in home assistant the physical switch works fine and I receive output from the log. But as soon as I connect the esp to home assistant I can turn the switch on and off from the dashboard but the physical switch no longer works. Any ideas what I need to fix?