I need some help regarding a small circuit that I'm currently working on. I have a microcontroller (ESP32) that I want to use to control a chip with a GPIO pin of my ESP32 as output, and at the same time, I want to be able to also use a physical push button to do the same job.

The chip is a RF module with a power on/off pin. When this pin is held low (sub 1.5 V) for 1 sec the module boots (or reboots). Otherwise it's internally pulled high to 1.8 V during normal operation.


The datasheet suggests to use a NPN transistor for this purpose following this figure:

enter image description here

I used Falstad circuit simulator (first time using it) to try to design a good circuit but I have to admit that I'm struggling. I came up with this circuit. It seems to work fine without the push button, the RF pin goes high when ESP pin is low and goes low when ESP pin is high.

enter image description here

However, I would like this push button to also reboot the RF module. And I don't know how and where to place it. I tried to connect the base with the emitter and the collector like this and now the RF pin follows ESP pin (RF high when ESP high and low when low) but now of course it's as if I didn't have a transistor. Moreover, the voltage is now 3.3 V at the RF pin and I think it might damage the RF module given that its internal voltage is 1.8 V. What's the best and simple way to deal with this? Just for info, I will be using this transistor:


enter image description here

Another question: What's the purpose of the 47 k resistor? It doesn't change anything when I remove it and the simulator says that it's a bad connection. I don't understand.

  • 1
    \$\begingroup\$ connect the switch between the collector and the emitter of the transistor \$\endgroup\$
    – jsotola
    Commented Jan 25 at 21:24

1 Answer 1


There's a few options for the pushbutton. You could simply parallel the C-E of the transistor with your pushbutton. Especially in this case, the TVS (ESD protection device) shown is highly recommended since ESD could work its way from the finger to the switch to the input.

If you make the pushbutton drive the transistor you could also do this:


simulate this circuit – Schematic created using CircuitLab

enter image description here

The 47kΩ resistor deals with any leakage in case the input is left open (for example if the ESP is unplugged or in a state where the GPIO is high-Z). It will probably work okay with it removed.

  • \$\begingroup\$ Yes I have the TVS diode in my real circuit, I just did not represent it here to simplify the schematics. I think I will use the simplest solution, I will connect the switch between Collector and Emitter because this way it pulls PWR pin low regardless of the GPIO state. With the switch placed before the transistor like on your schematic, GPIO pin needs to be high when I push the button to pull GPIO pin low \$\endgroup\$ Commented Jan 25 at 22:07
  • \$\begingroup\$ @ReickenBack As you can see in my simulation it works regardless of the state of the GPIO pin. The 10Hz GPIO continues for the whole simulation and the switch closes at 0.5 second and stays closed. It works like a NOR gate, either input high drives the output low. But the C-E connection is easier, so might as well go with that. \$\endgroup\$ Commented Jan 25 at 23:22

Your Answer

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

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