I want to control the gate or base of a transistor by either a MCU gpio or push button. Can link gate to both the push button and MCU so I can choose which to use. What is best way to do this?

  • 1
    \$\begingroup\$ How is the transistor configured? Specifically, for the MCU? \$\endgroup\$ – Trevor_G Feb 13 '18 at 17:23
  • \$\begingroup\$ As a simple switch that turns on an led. But want to be able manually turn led on with push button or with MCU. Just wanted to know best way of connecting that will have no errors \$\endgroup\$ – JOHNDOE Feb 13 '18 at 17:26

You can or them into the base like this...


simulate this circuit – Schematic created using CircuitLab

Or simply put the switch in parallel with the transistor.


simulate this circuit

  • \$\begingroup\$ Thanks only thought of the first solution you gave. Never thought of the parallel setup. Is the diode required \$\endgroup\$ – JOHNDOE Feb 13 '18 at 17:40
  • \$\begingroup\$ @JOHNDOE yes and no, without the diode when the MCU is pulling low it will steel some of the current from the switch so the LED will not be so bright. Whether that matters to you I have no idea ;) If you are using a MOSFET the gate voltage would be half so it may not turn on at all. \$\endgroup\$ – Trevor_G Feb 13 '18 at 17:45
  • \$\begingroup\$ @JOHNDOE you would not need the diode if you configured the IO pin as open-source. That is.. pulls high when active, high-impedance when not. \$\endgroup\$ – Trevor_G Feb 13 '18 at 17:53
  • \$\begingroup\$ Ok. Is it better to use a bjt or a mosfet \$\endgroup\$ – JOHNDOE Feb 13 '18 at 17:57
  • \$\begingroup\$ @JOHNDOE mosfet wastes less current... \$\endgroup\$ – Trevor_G Feb 13 '18 at 17:58

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.