0

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?

  • 1
    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 – user253751 Apr 08 '22 at 18:29
  • 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. – jonk Apr 08 '22 at 19:28
  • 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? – Anton Yukovitch Apr 08 '22 at 19:34
  • @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. – jonk Apr 09 '22 at 05:29
  • 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... – dandavis Apr 09 '22 at 06:16

0 Answers0