Tri-State-In/Tri-State-Out Buffer? - Page 1
Forum section: electronics / general

author: rediv
author_rank: Newbie
timestamp: August 24, 2021, 06:56:17 pm
content: A buddy is playing with Charlie-Plexing using a small PIC (5 GPIO pins) to drive 20 LEDs. Each pin can source or sink up to 25mA per the datasheet.He added 5 BJTs to power each "rail" when the pin output goes high. This shifts the high-state LED current from the PIC to the BJTs but the low-state pins still sink the LED current. I tried to find a _minimalist_ circuit to move both sourcing and sinking LED current off of the PIC without requiring additional GPIO pins. Google was not my friend. So I'm giving it a shot.Aside from power rails, my circuit has an input from a tri-state GPIO and mirrors the state (with increased current capacity) at the output. Or, at least, that's the goal.Here's what I have at the moment:The Zeners are 3V.LT Spice suggests that this works but I don't have the Zeners on hand at the moment to prototype/test. I'm but a simple hobbyist and likely missing something. Any thoughts?TIA

author: magic
author_rank: Super Contributor
timestamp: August 24, 2021, 07:29:19 pm
content: The absolute minimum is two emitter followers, but then the output can only get to ~0.65V away from each rail.This may work, but low voltage zeners are a bit leaky (still conduct some current at less than 3V). Reducing 100kΩ will solve the problem, if it ever arises.It may also work with appropriately sized resistors instead of the zeners. Maybe a stack: 1k/4k7/4k7/1k.editZeners are probably better. With Rs it's a compromise between high enough base voltage to really turn it on when needed and low enough base voltage to really turn it off when not. But it's something you could whack together and test right now, most likely.

author: DavidAlfa
author_rank: Super Contributor
timestamp: August 24, 2021, 09:02:37 pm
content: How are the BJT drawing current at low level input? That shouldn't be happening.If there's no current at the base, the collector will be in high impedance mode.

author: DavidAlfa
author_rank: Super Contributor
timestamp: August 24, 2021, 10:24:05 pm
content: It would much easier if he could live with 20mA limitation, which is the max the PIC pin can output.To tristate, simply set the pin as input, no external parts needed.If still wanting to use transistors, this circuit is a lot simpler, yet allowing tri-stating the output by setting the GPIO as input.The output will be limited to (Vin-0.7) and 0.7V, and you have high side + low side drop, so the leds would get VDD-1.4v.Shouldn't be a problem for driving leds at 5V unless they're blue or white (they usually require ~3.5V so you'll be very close).Also remember each led have 2 resistors in series, so adjust them properly.At least in simulation, it works perfectly.Edit: Nevermind, this is what magic already suggested!

author: rediv
author_rank: Newbie
timestamp: August 26, 2021, 06:19:50 pm
content: Quote from: DavidAlfa on August 24, 2021, 09:02:37 pmIf I understand your question, when the input (GPIO) goes low, it pulls the D1 anode low through R11. We have a 700mV drop from +5V to Q1 base, another 3V drop through D1. Ignoring R2 current, we have 1.3V across R11 for roughly 1.3mA into the GPIO from Q1 base. For a minimum beta of 100, we should be able to sink up to 130mA from the Q1 collector before falling out of saturation.At least, that's what I think should happen and simulation appears to confirm that. Did I miss something?

author: DavidAlfa
author_rank: Super Contributor
timestamp: August 26, 2021, 07:39:24 pm
content: I thought I had removed that message!I read wrong the message at first, I understood that the bjts where still drawing current when turned off.That's why I asked that

author: rediv
author_rank: Newbie
timestamp: August 26, 2021, 10:29:23 pm
content: No worries.