I had made a circuit for an LED strip using an EDP12e. I had also attached two buttons to change between colors on the strip.

To make it compact I inserted the circuit board inside the casing of the 12V supply. It is a metal box with power circuit and some empty space where my circuit fits exactly. The LEDs work fine except the button inputs are throwing false positive signals when open (floating.)

I had connected a pull down resistor to the input pin. Below is the schematic I used:


This is the actual circuit:

Actual Circuit

Please help me solve this issue.

Without passing those wires from supply didn't cause such noisy triggers but I kind of wanted to put my circuit inside the casing.

  • \$\begingroup\$ How do you expect the ESP8266 to function as a WiFi device when the whole thing including antenna is inside a metal box? Or are you not using the radio functionality? \$\endgroup\$ Sep 3, 2020 at 17:20
  • \$\begingroup\$ Actually top part is of plastic and esp's antenna is very close to that. I've a plan of extending antenna to outside of the box too. \$\endgroup\$
    – Rishabh
    Sep 3, 2020 at 18:50
  • \$\begingroup\$ @ChrisStratton: i build lots of ESP projects in metal "handy boxes", and they actually work just fine. Range might be shorter, but it's not been an issue for me. \$\endgroup\$
    – dandavis
    Sep 3, 2020 at 20:36
  • \$\begingroup\$ this is why i (almost) always use INPUT_PULLUP for buttons; no need for external resistors, no interference from strays. You could try EMF blocking ferrite "beads", the black plastic collars you find on some USB cables and other signaling cables; they effectively prevent false PIR firings. Or use grounded+shielded cables to route the buttons. \$\endgroup\$
    – dandavis
    Sep 3, 2020 at 20:38

1 Answer 1


Noise is coupling onto the line, with enough current to create a voltage drop across your pulldown resistor.

The quickest fix would be to use a stronger (lower R) pulldown resistor. R=1k would be much less likely to false trigger, and would only draw 11mW.

The next step would be to filter the noise, using a ferrite on the cable or adding an RC (watch the time constant) filter near the input.


This circuit has the following properties:

  • No voltage divider: input will (eventually) reach full 3.3V
  • C1 charges through R2: rises to 2.1V (63% of 3.3V) in 1 millisec (R2*C1)
  • C1 discharges through R1+R2: drops 63% (3.3V to 1.2V) in 2 millisec ((R1+R2)*C1)
  • 1
    \$\begingroup\$ Lowering R helped a lot. Its not sensing false signals now. Although still on touching the input wires, causes false positives but its bearable. Thanks. \$\endgroup\$
    – Rishabh
    Sep 5, 2020 at 16:35
  • 1
    \$\begingroup\$ I can add detail for an RC filter if you're interested. \$\endgroup\$
    – mbedded
    Sep 5, 2020 at 17:28
  • 1
    \$\begingroup\$ Yes please. I am just about to ask that. Thanks in advance. \$\endgroup\$
    – Rishabh
    Sep 5, 2020 at 17:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.