Control 3 transistor switches from two µCU pins - Page 1
Forum section: electronics / beginners

author: alexanderbrevig
author_rank: Frequent Contributor
timestamp: September 01, 2015, 11:10:15 am
content: Hi again everyone.I'm doing a project (one of those word clocks) and I amonepin short from not having to use a shift register.So I sat down, and made it a challenge to try and design something without looking at google. The next part of the challenge is to ask you guys and take the criticism and errors like a newbie should; with a smile!Here it is:Given correct transistor and resistor matching, will this work?A and B is controlled from a micro controller and it can handle about 25mA at 3v3 on it's GPIO.

author: PA0PBZ
author_rank: Super Contributor
timestamp: September 01, 2015, 11:18:12 am
content: So what are you going to connect to the XYZ outputs? Can you see a problem when there are inputs to another circuit that need to be pulled up? Or when they need to be pulled down?

author: alexanderbrevig
author_rank: Frequent Contributor
timestamp: September 01, 2015, 11:38:26 am
content: X Y Z will be a resistive load with LEDs in parallel. This is something I should've said of courseEDIT: changed original title somewhat

author: filssavi
author_rank: Frequent Contributor
timestamp: September 01, 2015, 11:46:35 am
content: I can suggest 74HC4051, it's a 8 bit mux (you can use it as a 2 input by putting to gnd/vcc the most significant selection bitif wou really want to do it the really old way (discrete transistors) I suggest using MOS instead of BJT's they massively simplify the biasing (well if you don't care about floating pins at MCU startup with the transistors potentially on due to leakage to the high impedance floating gate node, you can just skip biasing), they also won't load the MCU outputs as the gate is isolated (ok you may have some pA/fA leakage but that's not the point)

author: alexanderbrevig
author_rank: Frequent Contributor
timestamp: September 01, 2015, 12:16:16 pm
content: I want to try to use passives, as shift registers are something I've used before and decided that I wanted to avoid for this project.I don't care about bias as long as I am able to shut them on/of hard. They will PWM the attached load (current limiting resistor + LEDs in parallel).I guess I could simulate this in SPICE? *Downloading LT Spice*

author: PSR B1257
author_rank: Frequent Contributor
timestamp: September 01, 2015, 03:02:37 pm
content: QuoteLEDs are not resistive. And they should not be connected in parallel.You know, that your Vcc to the LEDs has to be the same as the µC Vcc, don't you?Apart from that I don't get the point of trying to solve this problem with discrete transistors.And no, your circuit doesn't work.

author: alexanderbrevig
author_rank: Frequent Contributor
timestamp: September 01, 2015, 04:16:27 pm
content: Thanks for your answers guysQuote from: PSR B1257 on September 01, 2015, 03:02:37 pmLEDs are not ohmic, but surely they are resistive?They will be wired in parallel with a separate current limiting resistor per diode.I have never heard that this is a no-no before...Quote from: PSR B1257 on September 01, 2015, 03:02:37 pmThe point is to not draw/sink the current. The voltage will be the same.Quote from: PSR B1257 on September 01, 2015, 03:02:37 pmIt was a challenge and as such it does not really matter if you get whyThough if it does not work then that is something I do care about. My results in LT Spice seems promising (though may be my lack of experience with the program, just tried it today). Why does it not work?

author: alexanderbrevig
author_rank: Frequent Contributor
timestamp: September 01, 2015, 05:39:31 pm
content: I'll use some chips in my design and experiment with this at some point. Will update thenThanks for pushing me in the right direction : ]

author: PSR B1257
author_rank: Frequent Contributor
timestamp: September 01, 2015, 06:38:03 pm
content: QuoteIf each LED has its own resistor, they are not longer "in parallel" as an electrician defines parallelQuoteWith !A&!B you turn on both Q_Y and Q_Z. Well, you could mask this condition by software, but if you have silicon diodes in the circuit, Q_X is possibly slightly forward biased and therefore not blocking appropriate.With Schottky diodes you don't get this issue.

author: LukeW
author_rank: Frequent Contributor
timestamp: September 01, 2015, 07:47:21 pm
content: You could muck around with a big pile of discrete-transistor logic and in theory do what you want, but maybe something like ahttp://www.ti.com/lit/ds/symlink/sn74lvc1g139.pdfwould be simpler and neater.It's late and I'm tired and this might be rubbish, but this sort of thing is possibly what you're sort of thinking of in terms of discrete transistor logic.There probably does need to be a couple of diodes in there somewhere to keep everything in the right state when it's supposed to be.A proper decoder IC would be much neater.

author: Redcat
author_rank: Regular Contributor
timestamp: September 01, 2015, 10:18:27 pm
content: I don't know if it helps, i'm not experienced with circuit design, but i have done some work in the simulator for you.I'm not sure, if it works in real world, but you could try it.You can have following states (A=top switch,B=bottom switch,LED 2=top LED, 3=bottom LED):!A&!B -> LED 1(most right one)A&!B -> LED 2!A&B -> LED 3When you have A&B -> LED 2+3 are on both.I hope it helps you at least a little to get a basic idea. Current is pulled away from the transistor base to switch off the LED you have no switch for left when the other transistors are on...I have also tried this 4th state were you have no LED lighting.This one i'm pretty sure is not a good solution, but at least in the simulator it works.With A&B all LEDs are off.No, i've deleted that...it looked.You can download the simulator (google) and try yourself.Have fun, Tom

author: Mechatrommer
author_rank: Super Contributor
timestamp: September 02, 2015, 02:49:17 am
content: output at collectors?X = (!A | !B)Y = !AZ = !BCode:A 0 0 1 1B 0 1 0 1X 1 1 1 0Y 1 1 0 0Z 1 0 1 0

author: PSR B1257
author_rank: Frequent Contributor
timestamp: September 02, 2015, 04:24:28 am
content: QuoteQuoteThan you can't mask this condition in software, since you are inevitable toggling between different states if you are applying a PWM signal to the inputs.

author: alexanderbrevig
author_rank: Frequent Contributor
timestamp: September 02, 2015, 06:46:11 am
content: Thanks all.Quote from: Redcat on September 01, 2015, 10:18:27 pmThanks! I will definitely do that. In addition to try it on the breadboardHowever I have changed my thinking and will try to go a more tried and true path.That is 74HC164 serial-in/parallel-out shift register into a 74HC07 buffer which drives an IRF511 N-channel PFET to turn on and off LED loads.With my 12V supply I'll drive strings of max three (Vf = 3v, Iled = 60mA) in 'parallel' and calculate the resistor fornLEDs withR = (12 - (n * Vf)) / (n * 60mA). Then figure out worst case current draw and design the power supply with headroom.When the project is a bit further along I'll post it in projects section.Thanks again, I will do someI was mistaken when I said I would PWM it. I won't. It will change states at most ever five minutes

author: PSR B1257
author_rank: Frequent Contributor
timestamp: September 02, 2015, 02:45:27 pm
content: QuoteThis MOSFET is a heap of crap, even for this (presumably, since 'n' remains unknown) low currents. Why are you biasing it to stay on?A way better choice is a logic-level MOSFET, like IRF3708. Do not bias this one from the 12V rail, but add a 1k gate resistor.QuoteNo, each string requires a resistor.QuoteO.k. Then you need no additional gate driver, just the gate resistor mentioned above.

author: alexanderbrevig
author_rank: Frequent Contributor
timestamp: September 02, 2015, 03:15:24 pm
content: After some time to think I've scrapped the DIY approach. I'll use aconstant current LED driverIC with PWM.Thanks for the input (as for the each string needs a resistor then I completely agree, it's what I implied). Lesson learned: Use ICs where applicable for projects and keep 'experiments' to the breadboard

author: alexanderbrevig
author_rank: Frequent Contributor
timestamp: September 03, 2015, 10:51:14 am
content: I'll let this thread die now but I just wanted to link to thishttp://alexanderbrevig.github.io/projects/2015/09/03/Norwegian-word-clock-project/which is a log of the steps I went through to get from the discrete transistor hackery to a string ofAPA102CRGB LEDsStill on a custom PCB with a custom aluminum front plate though : )