5
\$\begingroup\$

I'm making my project and I managed to kill 2 ESP32 boards. First time I thought it was just accident (me shorting 2 wires) because my cables were messy, but it happened again and the circumstances were pretty similar, so I suppose that the fist time it happened was the same problem.

Diagram of my circuit enter image description here

Situation

Servo was spinning for about 2 minutes without any problem, but when I switched the switch it stopped and my ESP was fried. The switch is supposed to stop the servo, but turn it on again when not switched.

This situation alone happened many times without causing the MCU to burn out. I can't think of any thing that was different from the usual when it happened.

What I mean by fried

The ESP's main chip gets 90℃ just connected to 5V and doesn't respond to uploading/run any code that was previously there.

My idea of what the problem migth be

Maybe there is voltage spike when the servo stops, but I thought that the power should not go through the MCU because it should find the path of least resistance (going directly from the source)

I don't have electrical background and I only know the basics so I write here if anyone with more experience and expertise might know what happened and how to prevent such thing from happening ever again.

Thank you very much in advance.

EDIT: Board data sheet here

\$\endgroup\$
2
  • 8
    \$\begingroup\$ "... but I thought that the power should not go through the MCU because it should find the path of least resistance ..." That saying is common but misleading. Current will take all paths with the current through each path inversely proportional to its resistance. In addition the resultant voltage will be give by \$ V = IR \$ where \$I\$ is the total current and \$R\$ is the result of all the parallel resistances. \$\endgroup\$
    – Transistor
    Commented Apr 29, 2023 at 16:28
  • 1
    \$\begingroup\$ Please add a link to the module datasheet. \$\endgroup\$
    – Rodo
    Commented Apr 29, 2023 at 17:44

2 Answers 2

11
\$\begingroup\$

You're probably killing it with the switch. You can't put 5 volts on the gpio; it only supports 3.3 volts. That's the first problem.

The next problem is that you have no current limiting on the port, so if you accidentally set the port to an output and connect it to VCC, you would burn it out. You need a current-limiting resistor.

\$\endgroup\$
5
  • \$\begingroup\$ Power supply bypass capacitors should be installed, and perhaps TVS diodes. \$\endgroup\$
    – PStechPaul
    Commented Apr 29, 2023 at 22:15
  • \$\begingroup\$ It's likely that the module has caps built in \$\endgroup\$
    – Voltage Spike
    Commented Apr 30, 2023 at 1:56
  • \$\begingroup\$ Looking at the module datasheet it seems like it can supply a 3V3 output if VIN is powered, so a fix could be to just wire the switch up to that instead. Or use an SPST switch to ground and use an internal pullup. \$\endgroup\$
    – Thomas
    Commented Apr 30, 2023 at 13:46
  • \$\begingroup\$ resource.heltec.cn/download/Wireless_Stick_Lite/… which is the pin-out for the module contains the note ADC preamplifier GPIOs are 3.3V tolerant only, which suggests some GPIOs may be 5V tolerant. However, the publicly available datasheet isn't explicit about which GPIOs are 5V tolerant (if any). The schematic for the module, which could indicate protection to allow 5V tolerant GPIOs is only available to those who have purchased the module so I can't check. \$\endgroup\$ Commented Apr 30, 2023 at 15:51
  • \$\begingroup\$ Even when the GPIOS are only 3.3V tolerant, would it survive hours on 5V? It lasted for a really long time on the 5V. Could maybe the combination of servo running for few minutes and then the 5V being applied make a difference? \$\endgroup\$
    – krystof18
    Commented May 1, 2023 at 13:44
0
\$\begingroup\$

Your circuit is not suitable for safe work. Due to the esp32 data sheet the maximum supply voltage is 3.6 V. This means any higher voltage applied to the chip will damage the chip. Even if not completely distroyed it will not work properly anymore.

Use a 10kOhm Pull-up resistor from GPIO16 to 3V3 and connect the switch from GPIO16 to GND. Put a 1uF condensator parallel to the switch. Further you will need some algorithm in your progeam to debounce your mechanical switch.

Secondly, all those chips can sink significantly more current than source.

Connect a Pull-up resistor (~ 3k3 Ohm) from GPIO25 to V3V, connect the Base of some NPN transistor to GPIO25 over a 100 Ohms Resistor. Put a Zener (~ 24V) between Collector (Anode) and Base of the NPN transistor to suppress transient voltages and connect your servo to the collector of the NPN transistor. The Emitter of the NPN must be connected to GND. For your choice of the transistor consider its maximum collector current, current amplification and the maximum sink current capability of the GPIO output.

\$\endgroup\$

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