0
\$\begingroup\$

I am trying to design a circuit that has 2 LEDs and using one pin from a microcontroller "toggle" which one is on. The LEDs themselves are part of another circuit driven by the same microcontroller, and I want to be able to toggle specific LEDs to a different color. I have some experience with electronics, but extremely basic hobby level.

After testing different designs in tinkercad, I was able to get the following circuts that worked using a combination of npn/pnp transistors, and a logical inverter. I have a pretty basic understanding of how they all function, at least enough to create something that wokred.

Left: 2 inverters, Right: single inverter and diode

However, I havent managed to think up a way to make this work without the inverter. Is it possible to make this circut work by connecting the npn and pnp bases directly to the microcontroller, or do I have to pull them up using the inverter?

\$\endgroup\$
5
  • 1
    \$\begingroup\$ When the microcontroller pin is high you have an effective short circuit from ^ through the PNP emitter->base through the NPN collector->emitter to _ . Both types of transistors will allow practically unlimited current to flow through the emitter and base - beware. This is one reason why transistor circuits have so many resistors \$\endgroup\$ Commented Apr 8, 2022 at 18:29
  • \$\begingroup\$ Anton, yes. You can arrange things with just two BJTs (given my very surface-like skim over your text.) It's two resistors, two BJTs, and then your LEDs+current limit resistors. That is, if you are using a single voltage rail for everything. \$\endgroup\$ Commented Apr 8, 2022 at 19:28
  • \$\begingroup\$ in order to correct the short circuit, would it be best to add a resistor between the pnp's base and the inverter npn's collector? \$\endgroup\$ Commented Apr 8, 2022 at 19:34
  • \$\begingroup\$ @AntonYukovitch Something like this is where my mind is at. You can see the schematic and the output results. There is always one LED on, no matter what. The current required from the IO pin is low, about \$100\:\mu\text{A}\$, which most MCUs can readily handle. \$\endgroup\$ Commented Apr 9, 2022 at 5:29
  • \$\begingroup\$ in bjt-world, you need an npn to control the pnp with an MCU, except at vcc voltages. otherwise the high PNP base voltage when off will damage the GPIO. Pull down the PNP base with an NPN... \$\endgroup\$ Commented Apr 9, 2022 at 6:16

0

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.