I had made a circuit for led strip using esp12e. I had also attached two button to change between colors on the strip. To make it compact I inserted the circuit board inside the casing of 12v supply. Its a metal box with power circuit and some empty space where my circuit fits exactly. Leds are working 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:-


And 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\$ – Chris Stratton Sep 3 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 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 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 at 20:38

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)
| improve this answer | |
  • \$\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 at 16:35
  • \$\begingroup\$ I can add detail for an RC filter if you're interested. \$\endgroup\$ – mbedded Sep 5 at 17:28
  • \$\begingroup\$ Yes please. I am just about to ask that. Thanks in advance. \$\endgroup\$ – Rishabh Sep 5 at 17:38

Here are some things that can help you find the errors:

  • Please use a multimeter and check for the rectifier output and its corresponding current. Make sure the ESP is getting 3.3V or less. Do NOT give it 5V.
  • Short all mutual GND pins of all modules to remove floating values.
  • Check your code to determine if your pinMode is set right.
  • Because its a metal case, Make sure its not unintentionally shorting any two exposed metal conductors. This can create the disturbance. This is my main hunch on your query
  • Perform a continuity check on the button. Faulty components know how to hide.
  • Check if each modules are working using the multimeter. Replace any component you might have a doubt with.

Hope this helped.

| improve this answer | |
  • \$\begingroup\$ Thanks for reply. I've taken care of all the things mentioned above. Still the problem persists. I think some kind of interference is causing this. \$\endgroup\$ – Rishabh Sep 3 at 18:49
  • 1
    \$\begingroup\$ Generally answers on stack exchange sites should be specific. You've been posting a lot of "list of ideas" answers today, which may in some cases be warranted but are not generally how this site is supposed to be used. \$\endgroup\$ – Chris Stratton Sep 3 at 20:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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