ESP8266 Fried on Binary Sensor High

Hello,

I feel like I’m losing my mine and hope one of you lovely people may be able to help. I have an ESP8266 running ESPHome that I’m powering by 5v. I have a simple momentary push putting that I’ve connected to D5 and ground. When I push the button it fries the board and is no longer usable. I thought it was a dodgy board so swapped it out and also measured the voltage on D5 which was showing at 3v which I believe should be in range.

Can anyone help me understand what is happening here? I’ve used the same board with sensors, relays and LED strips without issue.

Are you sure it’s ground you connected it to.
Sounds like you connected D5 to 5 volt

Photo of your setup might help diagnose the problem. :thinking:

…and yaml code. Are you sure that D5 is input? If it’s output (and set to 1) then connecting it to GND causes short…

Thanks for the responses so far. Please see my crude diagram of how I’ve set this up:

And the ESPHome config:

  name: side-doorbell
  platform: ESP8266
  board: nodemcuv2

logger:

api:

ota:
  password: "removed"

wifi:
  ssid: "Test"
  password: "removed"
t

  ap:
    ssid: "Side Doorbell Fallback Hotspot"
    password: "removed

captive_portal:

web_server:
  port: 80
  
binary_sensor:
  - platform: gpio
    pin:
      number: D5
      mode: INPUT_PULLUP
      inverted: True
    name: "Side Doorbell"
    filters:
      - delayed_on: 10ms

The button is a simple doorbell with two connectors and the wires come straight from the door to the ESP8266. I tried adding a 1k resistor to the GPIO which stopped it frying when the button was pressed but the button presses weren’t detected.

12 volts!!!??
Yeah well… there’s the problem…

Not really…Vi pin is intended for such voltages. Base board has switching voltage regulator below esp board, input voltage can be up to 24V, while regulator then outputs 3.3V
It looks all ok. I would check with continuity meter/ohmmeter if D5 on outside board is indeed connected to D5 on esp module… just in case.

1 Like

How do you know? Did it release magic smoke?

What steps did you use to determine that the board is “fried”?

Remove the NodeMCU from the motherboard and simply plug in a micro-USB cable to your PC. Run the “blink” example sketch from the Arduino IDE. If this works then the ESP is probably OK. You would need to change the GPIO numbers because the example sketches use pin numbers for the Arduino Uno. The “button” sketch can also be used to verify that the GPIO pin is working.

It should be 3.3V, so this is what you should see.

edit: Your code is fine. I just flashed a NodeMCU board here and the button works as expected.

What happens if you put the board 180 degrees wrong on the base board?

That would short the 3.3V pin to ground, likely smoking the regulator on the board. That would also put Vin on D0 (GPIO14) likely destroying the I/O register and the eight GPIO pins connected to it.

Makes a sizzle noise, smells or burning then doesn’t respond when plugged in via micro USB.

It’s definitely the right way around. it’s easy to determine the correct orientation as the PIN numbers are listed on the side of the ESP8266 so you at least know they are facing the right way.

I added a delay off of 350ms and also added a 10k resistor to the GPIO. I’m not getting any more issues for now but will keep an eye on it to see if anything odd happens (I tried a 1k resistor again and it was fine in the day but as it’s heading towards night it is bouncing from on to off and the 10k seems to have stopped this).

If match the pin labels to the pins in your pic you are connecting ground to ground , not D5. Perhaps you just drew the green line in the wrong pin and your actual lead goes to next pin that sits slightly closer to label D6. It’s not unusual for some boards to be labelled wrong anyway. Perhaps the black line that appears to go to gnd could also be labelled wrong. Can you check them with multimeter?

Yeah good point. It is definitely going to D5 and I’m now detecting the button presses without frying the board so the resistor on the GPIO seems to be the answer however I spoke to soon about the 10k resistor resolving the floating pin issue. I changed the 10k for a 100k and then 150k and it still seems to jump from on to off albeit not as rapidly.

Do I just keep increasing the resistor until it it stops floating?

Where do you have the resistor connected?

How long are the wires to the actual switch?

You might be picking up noise on the wires if they are long. And going to higher resistance will lower the current, and make it more susceptible to noise. 1k should have worked better.

You could try twisting the wires together, that should help. Or use shielded cable. Or put the ESP closer to the switch.

Connect the button to +3V (black line) and connect a 10k resistor from D5 to GND. It will work in reverse. Edit the button code.

On GPIO D5 and then connected to the green line.

I use it with a magnetic contact to read the gas and it works reliably about 4m, UTP cat5 cable