0
\$\begingroup\$

I have a button connected to the power rail of my project and I want to know when it's pressed with an ESP32 chip. Since the input voltage (6.5V to 15V) is higher than the maximum rating of the ESP32 I need to bring it down.

Like this video of a power switch circuit, I used a current limiting resistor of 10K ohm between the button and the chip, relying on the protective diodes of the GPIO pin. But when I measure the voltage it's 4.1V which is still higher then the maximum spec of the ESP32; so I'd like a safer way.

Is this circuit using a 3.3V voltage regulator appropriate? I use a 1k ohm resistor to load the voltage regulator, and 2 10uF caps as suggested in the datasheet. The low response time of the button should be fine.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
2
\$\begingroup\$

That would still pull up to 5V via the 10k resistor. Simply use a transistor, it will be cheaper than regulator and caps. Pushbutton would drive the transistor and the transistor would drive the input pin.

\$\endgroup\$
0
\$\begingroup\$

Yes, it will work if you use an LM7833. They're not that common.

You could also alter the design to substitute a 3.3V regulator that can easily withstand 15V input and alter the output capacitor to suit (often ceramic output capacitors are unsuitable). There are a few places where it can go badly.. many fixed-output 3.3V regulators like to go unstable with the wrong type or value of caps or have a maximum input voltage that is not high enough for your application (sometimes as low as 5.5V maximum).

Or use an LM7805 or 78L05 (TO-92 package available) and add a 2K+3K divider on the output, with that exact circuit and it will work. You can reduce the capacitors to 100nF.

\$\endgroup\$
0
\$\begingroup\$

Do you really mean "ESP32 chip" or rather "ESP32 dev board"?

Actually... it does not matter. In either case there is 3.3V source somewhere powering ESP32 MCU. All dev boards have VCC routed to some pin. Simply use that one for your button, no extra parts except for one pull-down resistor, and 100% guarantee it won't be out of input range, even if VCC drops for some reason.

I would also recommend about 100R resistor between the button and GPIO and 0.1uF capacitor in parallel to the pull-down.

\$\endgroup\$
2
  • \$\begingroup\$ The button is also connected to a soft power touch circuit, it needs to be connected to the power rail... \$\endgroup\$
    – csiz
    Dec 18 '19 at 20:06
  • 1
    \$\begingroup\$ Ah, OK. Then go with @Justme answer and use a transistor. \$\endgroup\$
    – Maple
    Dec 18 '19 at 20:10

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.