The button that pressed itself
A washroom disco button started pressing itself hundreds of times a day. The bug was not in the code, and neither was the fix.
A button with one job
In a community kitchen’s washroom there is a red arcade button under a sign that reads “DO NOT PUSH!”. Press it and the room light goes off, a disco light comes on, a random song plays, and about half a minute later the room puts itself back. I built it for Good Hood Community Kitchen in early 2026. The full case study covers the build.
This post is about the part that took the longest. A few weeks after the install, the button started pressing itself.
The setup, briefly
- An ESP32 controller (a wired-Ethernet board in the final install) runs ESPHome and reads the button.
- The disco light has no network connection. The controller drives it the way its remote does: an infrared LED sending the light’s own remote codes on a 38 kHz carrier.
- Home Assistant runs the show. It switches the room light, starts the music and resets everything when the song ends.
Remember the infrared LED. It matters later.
Symptom: a disco with nobody in the room
From the end of March the show started going off on its own. The obvious suspects were mechanical: switch bounce, or a weak spring in the button.
The usual fix for bounce is software debounce, which ignores any change shorter than a set time. It didn’t work, and it failed in both directions. A short debounce let the phantom presses through. A long one made the button ignore real presses. When a filter can’t tell the signal from the noise at any setting, the noise isn’t bounce.
Measure before guessing
So I stopped tuning and added press counters and logging to the firmware. The logs told a clear story. On one day in late April they showed hundreds of presses with nobody touching the button.
A worn spring doesn’t press a button hundreds of times a day. Something electrical was making the input look pressed.
The root cause: the light was pressing the button
The input pin used the chip’s internal pull-up, a weak resistor that holds the line high until the button pulls it to ground. “Weak” is the problem. A weakly held wire is easy to push around, and the same controller was also producing fast, repeating pulses: the 38 kHz infrared drive for the disco light.
That signal was coupling into the button wire. The weak pull-up couldn’t hold the line steady against it, so the controller read the noise as presses. In other words, the disco light was setting itself off.
That also explains why software debounce couldn’t win. Debounce is built for a contact that settles after a few milliseconds. This was an input being driven by noise over and over, so there was nothing for a timer to wait out.
Fixed in hardware
The fix went where the problem was, at the input:
- An external 4.7 kΩ pull-up resistor, which holds the line far more firmly than the internal one.
- A 100 nF capacitor, which filters fast noise off the line before the chip sees it.
Both parts sit at the controller. The fix went in on 8 May 2026, and my log has shown no phantom presses since.
One more bug: impatient fingers
With the ghosts gone, one timing bug was left. If someone pressed the button again quickly, the light, the music and the button glow could drift out of step.
The automations used to drop a press that came in while a show was already running. I changed them to restart on a new press. Each press now starts one clean show from the beginning, so the parts can’t drift apart. A 3-second cooldown still ignores very fast repeat presses.
What I took from it
- If a filter can’t be tuned, the problem isn’t what you think it is. When no debounce setting worked, that was the clue to stop tuning.
- Count before you change things. A press counter turned “it sometimes goes off” into “hundreds of times a day”, and that number ruled out the spring at once.
- Fix the layer that’s broken. The noise was electrical, so the fix was a resistor and a capacitor, not more code.
- Your own outputs are part of the environment. The interference came from inside the build: the part that makes the show was also triggering it.
The full ESPHome and Home Assistant config, including the final input circuit, is public at github.com/AlexTu2/ghck-disco-arcade.