Transistor toggle flip flop modification question - Page 1
Forum section: electronics / beginners

author: belzrebuth
author_rank: Frequent Contributor
timestamp: February 22, 2021, 08:42:34 pm
content: Hi all,I'm playing around with the attached circuit which is essentially a discrete toggle flip flop which is of the push-on push-off type.The circuit outputs around 5V when latched to 'ON' and 0V when latched to 'OFF'.It works great on breadboard but I'd like to use it along with a CD4053 in order to switch some bipolar signals and I've found out that the CD4053 in order to switch a bipolar signal needs something less than zero volts for the switch to toggle.So I need it to output a postive voltage when 'ON' (as it's already doing) and at 'OFF' instead of 0V I'd like something slightly negative. Even -1V or so would be fine.Can I modify this circuit to output a negative voltage instead of 0V when it's 'OFF'.I thought about "mixing" its output with an offset of say -2V so I would essentially get +3V at 'on' and around -2V at 'off'.Can I do that without an opamp?Maybe another solution would be more appropriate?

author: belzrebuth
author_rank: Frequent Contributor
timestamp: February 22, 2021, 09:02:49 pm
content: Here's what I thought about doing and it works (on multisim at least) but I thought I may need to buffer the output somehow?I guess the CD4053's control pin is probably high impedance so this may work okay but if there's any other alternative I'm all ears.Also, why would the 4053 require a negative control voltage for a bipolar signal?I've tried multiple times on the breadboard and if VEE is connected the chip seems to switch only when the control signal passes thru zero.When VEE is absent I can switch between the two inputs with a unipolar signal. When it's low it's outputting to one out and when it's high it switches to the other.

author: belzrebuth
author_rank: Frequent Contributor
timestamp: February 22, 2021, 09:31:42 pm
content: 1. You were right it works. I didn't think that at all!Just powered it from Vcc to Vee and I get about 4V when 'ON' and almost -10V when 'OFF'.So I must actually add a positive offset instead of a negative one in order to not fry the 4053.So no easy way to get symmetrical output as it seems.A +-3V output between states would be ideal.Or even +-5 but -10V is a bit too much.Maybe playing around with a voltage divider at the output will get it as centered as it gets.2. Yes, I connected VSS as well as VEE.I thought it was strange as well.But I've tried multiple times and it's always the same.Needs a little offset below or above zero to switch states (outputs).It switches near the zero crossing point.A +-1V signal or less will toggle one bipolar signal to 2 outs just fine.That's strange though because I thought that it's 0 or positive never noticed it.Haven't read the datasheet though so I may be wrong..

author: Ian.M
author_rank: Super Contributor
timestamp: February 22, 2021, 09:56:38 pm
content: Quote from: edavid on February 22, 2021, 09:16:16 pm+1. A 4053 and similar 4000 series analog switches with three supply pins: Vee<=Vss<Vdd, accept control input logic levels between Vss (Low) and Vdd (High), with the usual CMOS 70%:30% thresholds and analog signals between Vee and Vdd. Usually you only need a level shifter when Vss is grounded if your logic '1' level doesn't reach 75% of Vdd (with respect to ground).Read the %DEITY% <blaspheming> <expletive> datasheet!If you don't meet the min. logic high and max. logic low input thresholds, operation is *NOT* guaranteed.Symmetrical +/- 4.5V to 6.5V Vdd and Vee above and below Vss ground, or asymmetric Vdd and Vee, with Vdd between 4.5V and 6.5V, will be fine driven by 5V CMOS logic (including HCT/ACT), or driven by TTL with a stiff pullup to Vcc to get near 5V logic high. For Vdd above that, you need to drive it from an open collector or true open drain output that can tolerate Vdd, with a pullup to Vdd, or if you need to save power, with a 4504 or similar level shifter.

author: belzrebuth
author_rank: Frequent Contributor
timestamp: February 22, 2021, 10:33:01 pm
content: Thanks for the valuable info IanM.So you're basically saying that the 4053 will only "see" low and high control signals, right?So with zero volts and a high enough positive voltage it should switch states correct?I don't really need a negative control signal..I'll check the breadboard circuit again but I think I was correctly providing VEE, VSS and VDD to the chip.Namely +-8V for VEE and VDD.I think the CD4053 has a +-10V max rating.What I want to do basically is switch a +-5V square wave between two outputs with a momentary press of a push button.This square might exceed 5V maybe even get to 7V or so that's why I'm powering the 4053 with 8V.There is no 4053 chip in multisim so I attached an eagle schematic of the circuit.

author: Ian.M
author_rank: Super Contributor
timestamp: February 22, 2021, 10:37:14 pm
content: Tie 4053 Vss to GND or it *WON'T* work!Your schematic has Vss open circuit . . .Abs. Max Vdd - Vee is 20V. I wouldn't run it much over 18V. How you split that either side of Vss is up to you. N.B: for correct operation, VDD – 3.0V ≥ VSS ≥ VEE.

author: belzrebuth
author_rank: Frequent Contributor
timestamp: February 22, 2021, 10:45:25 pm
content: Yes yes I forgot it in the schematic I drew just now; not in the actual circuit though..I'll recheck my breadboard circuit in a bit.Also pin6 should be GND as well.Didn't know about the -3 thing.So I could just feed it -6V from my -12 rail divided by two for the VEE rail.It will chop anything higher than +-6V but higher voltage spdt switches are a lot harder to find so I'm stuck with 4053 I guess.

author: belzrebuth
author_rank: Frequent Contributor
timestamp: February 22, 2021, 11:07:28 pm
content: Okay now I've tested it and it worksNo idea why I thought I needed a negative offset to drive it really, I did nothing to the circuit just powered it up.0v has me the signal on one out and around 5V gets the signal to the other output.Weird..Another question..If I would try to switch say a positive 0 to 10V signal and I didn't have the diodes would it really damage the 4053?Should the signal to be switched follow the max rating of the chip itself?Are the protection diodes I put there kind of useless ?

author: gnuarm
author_rank: Super Contributor
timestamp: February 23, 2021, 12:20:49 am
content: It can be hard to read threads where information comes out in dribs and drabs, not criticizing. I'm just saying I may have missed something you've said.In general no input to a CMOS device should exceed the power rails. For analog switches or muxes there needs to be two voltage domains. The digital inputs use ground and Vdd. The analog signals use Vee and Vdd. That's why the Vdd rail has to be at least 3V above ground, to allow the digital electronics to work. Then the analog part can live within where ever you put Vdd and Vee. This device is a bit more lenient than others, giving you ±0.5V rather than 0.3V outside the power rails.The logic switching level is not tightly controlled. It is a portion of the Vdd to ground voltage, 30% to 70% being a no man's zone and above being a high and below being a low. So running with a high Vdd means you need to drive the inputs with a higher voltage, that means your transistor FF has to be run from the same voltage or close to it.

author: belzrebuth
author_rank: Frequent Contributor
timestamp: February 23, 2021, 12:58:18 am
content: Thanks.The final circuit will have a 8V regulator so I can drive both the 4053 and FF from the 8V rail.No need to run the FF with higher voltage anyways as the output signal will be more than enough to control the mux.I will be making the negative rail with a voltage divider of my primary -12V VEE rail.I guess -6 or so volts will suffice to accomodate the signal to be switched..I could also switch to a 10V regulator now that I learnt about the 3V difference that the rails need to have.Maybe I can have my negative set to -8 and use a 10V regulator to have better headroom and still be within the chip's specs.

author: gnuarm
author_rank: Super Contributor
timestamp: February 23, 2021, 03:24:16 am
content: So you need a negative voltage on Vee? It can just be grounded if the signals on the analog pins don't go negative.BTW, why the transistor FF? That circuit uses two transistors and ten passives. You can do the same thing with a pair of inverters, nor or nand gates with two resistors and a capacitor.https://electronics.stackexchange.com/questions/4060/make-a-momentary-switch-control-a-toggleSee the illustration a short way down the page with the two inverters. This circuit should start up with the capacitor leg of the inverters low and the other leg high (the output on the right inverter). If you want to assure start up in this state even a short time after powering off, add a very large resistor, 1 M or more, in parallel with the cap. That will make sure the cap voltage is drained on power down. Otherwise the CMOS devices may take some time to drain it.Another circuit a bit further down the page uses two capacitors. I would make the lower resistor in the drawing a smaller value to make sure nothing odd changes if you hold the button pressed.Both of these circuits have the switch not tied to ground and one end connected directly to a gate input. Sometimes it is convenient to be able to use ground and a switch on the end of a wire can pick up noise which is not good on a high impedance input like a CMOS gate.I don't know if you have any other use for logic gates, but the FF can use any inverting gate like NAND or NOR.

author: perieanuo
author_rank: Frequent Contributor
timestamp: February 23, 2021, 07:34:08 am
content: hi,i really don't get itcd4053 is 1.79 ronATTINY5-TSHR is 1.49 ronif you add resistors, transistors etc, you get almost the same pricejust use a micro, 10 lines of code, you're doneanalog is ok for really analog requirements that are expensive in digital, but crashing my head for making a flip flop when the cost gain is zero...and in digital, if the client tells you his initial 1.5 seconds is no good in production, he need 1.7 seconds, you upload the new fw, you're donewith the 4053....retire the boards, modify, resend the boards after 1 weeklet's get real and talk serious

author: Ian.M
author_rank: Super Contributor
timestamp: February 23, 2021, 10:22:05 am
content: Belzrebuth is only using one channel of the 4053 triple SPDT switch. The other two channels can be used as inverters to implement Gnuarm's toggle lach suggestion. He's already been shown how to three months ago!https://www.eevblog.com/forum/beginners/single-momentary-push-button-for-on-off-(toggling)-a-signal-connection/If toggling a logic signal with a ground referenced switch + good noise immunity are essential requirements, I favor the use of a dual D type flip-flop with non-inverted Set and Reset inputs.Its a characteristic of SR flip-flops(and asynchronous S & R inputs to single stage clocked flip-flops)that they enter a state with both Q and /Q asserted if *BOTH* S and R are asserted. If *ONE* of S and R is de-asserted, the state collapses to either Set or Reset with the usual complimentary Q and /Q levels, depending on which of S and R remains asserted. If both S and R are de-asserted simultaneously it enters a metastable state and the result is unpredictable. *DON'T* do that!This means that you can use half of a dual flip-flop with async. S and R inputs as a buffer. Simply tie its clock and D (or J,K) inputs high or low to deactivate them and tie *ONE* of either S or R to its active state. The other becomes the buffer input. Take the output from whichever of Q or /Q changes#when you assert the input. 74xx74 type flip-flops have active low /S and /R inputs and active high outputs so form an inverting buffer. 4013 flipflops have active high inputs and outputs so form a non-inverting buffer. Add two resistors, Rin and Rfeedback of 5 to 20 times Rin and you've got a Schmidt trigger buffer suitable for RC input debouncing*. Wire the other half of the 4013 /Q to D so it toggles when clocked, and clock it with your debounced switch signal.One 4013 IC, four resistors and a capacitor + whatever its output controls - it doesn't get any simpler unless you resort to a factory programmed low pin count MCU!@Perieanuo,Its only simpler to cope with customer requirements changes with a MCU if you *CAN* reasonably reprogram it in circuit. ICSP headers cost money, even as an unpopulated footprint that's extra board area. You can get a test clip onto SOICs etc. but your rework techs will curse you. Otherwise lets hope you brought out the required pads from the 'bed of nails' at your ATE station, and can afford the reprogramming cycle time. If you used a $0.03 OTP Padauk MCU, vs having to rework a RC circuit to change its time constant, your pooch is equally screwed!# See the bottom thre lines of Table 1 on page 10 of theCD4013Bdatasheet.* See part 2 ofhttp://www.ganssle.com/debouncing.htmThe rest of the article is also worth reading.

author: belzrebuth
author_rank: Frequent Contributor
timestamp: February 23, 2021, 11:15:54 am
content: Τhe circuit which IanM helped me with 3 months ago has been implemented and works like a charmThe signals to be switched are again bipolar and quite large for logic level that's why I want to use the VEE.So the concept is similar as it was in the old thread but with spdtandspst requirements instead of spst only (this toggle thing is a part of a much bigger circuit) and I needed to do it differently.Since I actually need 2* spst switches as well as 2* spdt switches I couldn't use a 4066 hence the need for the 4053.There are two signals that need to be switched to 4 outputs , so 2/3 of the 4053 are being used.There also 2 other signals that need to be on or off and I'm just toggling a bjt as an "audio" switch for those.I initially wanted to implement 4 toggle flip flops - 2 to control the 4053 and 2 for the transistor audio switches.This requires 4 fully featured d-flip flops (separate clk and ~q out for each).I did a quick search and couldn't find any quad d-flip flop ICs with clkand~q outputs (74c175 comes close but has a single clk input) so I thought about going discrete instead of using more ICs, and that what I came up with.I know it now seems like a waste of space, maybe I could have gone with 2 * 4013 and be done with it, but I've certainly learned something new in the process.BTW is there a quad D flip flop with clk and ~q that I can use to implement 4 toggle flip flops in one package?

author: Ian.M
author_rank: Super Contributor
timestamp: February 23, 2021, 12:14:00 pm
content: The need for three independently controlled channels tends to favor an inverter toggle latch solution, as suitable Hex inverters are readily available in most logic families. e.g use a 40106 running from the same Vdd and Vss as the 4053. If you need downwards logic level translation for any digital outputs, use spare channels on the 4053 with output from switch common and switch X and Y terminals tied to the required high and low voltage levels.OTOH if you don't mind a bit of programming, and can run the analog switch's Vdd and Vss rails at suitable voltages for logic level compatibility a low pin-count AVR MCU*will lead to vastly simplified hardware - given suitable supply rails, maybe as simple as the buttons, MCU, analog switch, and to gild the lilly, a couple of decoupling caps. It rapidly becomes less attractive if 5V logic high isn't good enough.* ... or PIC or other 8 bit MCU you've already got a hardware toolchain and C compiler for. ATtiny AVR is merely the lowest cost/effort of entry as one can use the Arduino IDE with a third party ATtiny core, and a $3 USBasp clone or Arduino Nano clone running AVrduinoISP as the programmer.

author: belzrebuth
author_rank: Frequent Contributor
timestamp: February 23, 2021, 01:18:01 pm
content: There's actually 4 control signals so maybe I could use the 40106 and maybe the spare channel of the CD4053 to make the 4 toggle circuits.That should be the most low part count solution..I'll look into and post a schematic later.edit: No need for a schematic actually.The attached hex inverter latch works fine controlling the 4053.So 3 out of 4 control signals will come from the 40106.The 2 will control the 4053 and one of them can control the base of a BJT audio switch.The BJT will need to mute/unmute a 10Vpp square wave so I need to experiment with this as well.I could use a DG212 or similar switch to avoid the mess of a bjt circuit.So now I need a fourth latch but I'm not sure if the 4053 can do that on its own...

author: gnuarm
author_rank: Super Contributor
timestamp: February 23, 2021, 02:40:43 pm
content: Quote from: Ian.M on February 23, 2021, 10:22:05 amThis is not strictly correct. It depends on the details of design of the FF. There are multiple ways of designing a FF and some set both outputs high, in others one of the FF async controls dominates. Each type and brand of FF does have a defined value on each output.QuoteThis will work as long as the part used is limited to not just a base part number, but the full part number including the brand. Some of the older, smaller logic companies were bought by the larger ones so they now sell two versions of the same part with different async characteristics. So the prefix letters will make a difference even if sold by the same company.Essentially, you need to read the data sheet to see the behavior and then only use the parts covered by that data sheet.QuotePlan to spend some time with it. This is as much prose as it is engineering and so takes some time to get through.

author: belzrebuth
author_rank: Frequent Contributor
timestamp: February 23, 2021, 06:25:25 pm
content: For the mute/unmute switches I was hoping to use this circuit here:https://electronics.stackexchange.com/questions/186862/how-to-switch-an-ac-signal-on-and-off-with-a-bjtbut when I breadboarded it I get the full minus rail when the pulse from the 40106 is low which is logical since I'm effectively shorting my output (C) to the emitter which is tied to -V.I'm trying to switch a 10Vpp pulse...Can I somehow get 0 when the control pulse is '0' and the full 10Vpp when the pulse is '1'?This is the final part of the circuit btw!

author: gnuarm
author_rank: Super Contributor
timestamp: February 23, 2021, 07:37:24 pm
content: Quote from: belzrebuth on February 23, 2021, 06:25:25 pmI don't know which of the three circuits you mean, but they all look poor for your purposes. What's wrong with the analog switch circuit? It isolates your signal from the mute control. Seems perfect to me. You just need to use a Vdd that is a bit higher than 10 V. Tie Vee to ground.

author: belzrebuth
author_rank: Frequent Contributor
timestamp: February 23, 2021, 07:57:11 pm
content: I have 4 signals that I want to switch.The two of them will be switched with the 4053 (they're bipolar squares around+/-5V so a nice fit for the analog mux)I will use the 40106 to generate the control signals and may use the analog flip flop for the remaining (fourth) control signal.So I'm covered for the control part of the circuit and half of the switching.Now I need to find a proper way to switch the other two signals.These two signals are 10Vpp squares that need an spst kind of circuit.They need to either pass or not pass so mute/unmute controlled with the 40106 pulse.I will look into a jfet solution or a bjt solution and use whatever's smaller.The bjt solution that I posted above does not do what I want so I'm now searching if a jfet circuit can do that as they typically require negative voltages.I need to control it with 0_5V from the cd40106.So if anyone has any ideas please let me know.

author: Ian.M
author_rank: Super Contributor
timestamp: February 23, 2021, 09:58:15 pm
content: 10V Pk-Pk 'squares' with what DC offset? Do you need to preserve the exact input signal levels or just its timing?Probably another 4053 would be an easy option. Its a go-to choice for SPST or SPDT switching of up to 18V Pk-Pk signals that will fit in any 19V or smaller 'window' within the range -16V to +19V. You've got one spare channel in the first 4053, and another in the new one which could *probably* be configured as inverters to implement the fourth toggle latch (subject to Vss to Vdd level compatibility).

author: belzrebuth
author_rank: Frequent Contributor
timestamp: February 23, 2021, 10:08:32 pm
content: No DC offset just a zero-centered 10Vpp square.Isn't it beyond the power supply rails of the 4053 ?I wouldn't mind using another CD4053 to make the fourth latch and the spst switches but I need to preserve the 10Vpp level so I don't think it should be used as input to the CD4053.The mute switches are more troublesome than I thought.I can't seem to properly bias a j112 or j108 and I don't have any other fets around.I wouldn't use other jfets anyway as I have plenty of those and I'm sure they can get the job doneif you know what you're doing at leastI've looked around for similar circuits and most jfets seem to need a tiny positive voltage for on (0.2 or so) and -8 or greater for off.I added some negative offset to the 40106 pulse to bring it to these levels but it doesn't work. I get almost the full input to the output either way..If the jfet is a one-part solution (actually more if you count the gate diode and a couple of resistors) and I only need to properly bias it I would very much like to know how to do so as it would prove useful to other things as well..

author: Ian.M
author_rank: Super Contributor
timestamp: February 23, 2021, 10:20:18 pm
content: JFETS as pass elements are only any good for switching *SMALL* signals. Even at consumer 'line level' (-10dBV, 0.447V peak), you'll get significant distortion. Even quasi-symmetrical NPN switching/muting transistors like the discontinuedToshiba 2SC2878were preferable, as they were current controlled, so if the base was driven by a PNP current mirror could support large signal swings

author: belzrebuth
author_rank: Frequent Contributor
timestamp: February 23, 2021, 10:25:29 pm
content: What would you propose in this case?An analog switch IC and be done with it?It's the easiest solution but two of the four switches will go to waste..I was hoping for an easy circuit involving one jfet or 2n700 mosfet or whatever but if it can't be done properly I can always use an IC.

author: Ian.M
author_rank: Super Contributor
timestamp: February 23, 2021, 10:55:16 pm
content: You *can* use a MOSFET, but only if its a four lead one, so you can bias the substrate so the body diode never conducts, and if you can tolerate the charge injection into the signal channel required to get it to switch, and the high and nonlinear capacitance from the channel to the gate.Also consider PhotoMOSFET optocouplers. e.g:H11F1Mwhich can stand-off up to 30V in its off state so can handle analog sgnals of up to 60V pk-pk!

author: Terry Bites
author_rank: Super Contributor
timestamp: February 23, 2021, 11:14:08 pm
content: CMOS inputs are very high Z. A short time constant RC coupling will usually suffice. The input diodes on the IC will clip the ouput at the rails. You might want to go mad and add a series reisistor on the input pin to protect the IC from over current.

author: jmelson
author_rank: Super Contributor
timestamp: February 24, 2021, 12:27:27 am
content: The collector resistors are VERY high value, only sending 200 uA through when the transistors are on. This will lead to very slow rise times when they turn off.Jon

author: belzrebuth
author_rank: Frequent Contributor
timestamp: February 24, 2021, 12:34:49 am
content: Quote from: jmelson on February 24, 2021, 12:27:27 amAre you talking about the bjt flip flop 56k ones?I didn't notice any lag on the circuit but I could try lowering them to see how it responds.