2
\$\begingroup\$

I am an aerospace engineer by trade, but currently working on a little side project that involves some basic electronics now. So go easy on my ignorance ;)

Here is a description of what I want to implement:

  • An analog voltage signal is converted to latch an output to high above a certain a threshold value.
  • The analog voltage may fall below the threshold then. The output stays high.
  • The next time the analog voltage signal exceeds the threshold, the output unlatches to low; and so on.
  • (I would prefer to avoid ICs in the implmenetation.)

The first part of converting the analog voltage to a distinct digital signal at the threshold I have done with a Schmitt trigger and this works fine. But I am struggling to come up with a way to "latch" and "unlatch" the output from a single trigger signal. I tried out this circuit on the breadboard but did not get the correct behaviour. Is there just a particular type of "flip-flop" circuit that I have overlooked that does this task?

Thanks for reading!

Edit: power supply voltage will be 5 VDC.

\$\endgroup\$
3
  • \$\begingroup\$ Hi, what voltage is the circuit running on, 3.3, 5, 12, or something else? How have you implemented the Schitt trigger, with discrete components or an IC such as a 74HC14? Please share your circuit diagram of what you have, it will provide much needed context. Cheers. \$\endgroup\$ Nov 5, 2023 at 13:22
  • \$\begingroup\$ Sounds like you want a toggling flip-flop, also known as a "divide by 2". This can be done by using a clocked D-type flip-flop: connect the \Q output to the D input, and connect the output of the Schmitt trigger to the clock. On each positive edge of the clk the D flip-flop will toggle. \$\endgroup\$ Nov 5, 2023 at 13:28
  • \$\begingroup\$ Hi, power supply will be 5V. I will add the basic circuit diagram I used for the Schmitt trigger now also. I breadboarded it with discrete components as I did not have any of these ICs on hand. \$\endgroup\$
    – radiolite
    Nov 6, 2023 at 13:02

3 Answers 3

2
\$\begingroup\$

Is there just a particular type of "flip-flop" circuit that I have overlooked that does this task?

Yes, the flip=flop you want is a toggle flip-flop, aka T-FF. The circuit you found is indeed suitable, but take care when selecting the various components. The image below is a complete circuit using discrete components (no ICs) based on the circuit you found. LTspice simulation shows that it works well, but I have not verified this on a breadboard. It will work OK up to a few kHz - what is the maximum frequency out of your Schmitt trigger?

enter image description here

Description
The circuit is in two parts, the upper part is the Schmitt-trigger buffer (non-inverting), and the lower is the T-FF. The output of the Schmitt feeds the input of the T-FF. Both circuits are based around a common structure: a differential pair followed by a logic inverter, the differences being how the feedback signals are routed.

Schmitt buffer:
A resistor voltage divider provides a reference signal Vref which is applied to the base of Q5; this sets up both the threshold voltage for the Schmitt action, and the bias conditions when there is no signal present (Vsig1 not connected). Feedback is taken from the output of the logic inverter and is applied to the base of Q4. The ratio of R15 (47k) to R19 (22k) sets the hysteresis. C5 speeds up the switching transitions. Diodes D9 and D10 are a precaution: they protect transistor bases from excessive reversed voltage - which is unlikely in a circuit supplied from 5V but may occur as the supply voltage increases. The logic inverter has some diodes that speed-up turn-off, this is commonly known as a "Baker's clamp" (old-school stuff dated from the 1950's).

T-FF:
Hopefully you can recognise within this the circuit you found, with some slight differences. The diff-pair emitter resistor R22 is a lower value (1k vs 4k7), since this circuit will be expecting the input voltage to be logic level about 0 to 5V. Q7 and Q8 collectors are cross-coupled to the base of the opposite transistor via a resistor with a parallel speed-up capacitor. The network shown to the left applies the input signal to the appropriate nodes to obtain the toggle action, as per the original circuit you found. The output of the logic inverter is not coupled to any inputs, so its input can come from either Q7 or Q8. The circuit changes state on the falling edge of the input. Note that the values of C1 & C2 are dependent upon the transition times of the logic edges applied at the input (Vout2); the slower the transition the larger these have to be. When driven by the Schmitt shown here the transition times were about 1us.

The image below shows the waveforms as the Schmitt output starts to toggle when the input signal comes into range of its thresholds. Vout3 toggles on each falling edge of Vout2.

enter image description here

References:
Adding here some useful resources, starting with oldest first:

Difference between latch and flip-flop?

What values / components do I need in this flip-flop circuit?

How to build a Schmitt trigger using transistors?

Latching Soft ON/OFF Button

How to make this T-flip-flop circuit

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Thanks, this looks really good! The max frequency is quite low, 1-10 Hz. \$\endgroup\$
    – radiolite
    Nov 17, 2023 at 14:18
  • \$\begingroup\$ No worries. This solution will handle 1-10Hz with no problems at all, can go as high as several kHz if required. Cheers. \$\endgroup\$ Nov 17, 2023 at 21:51
1
\$\begingroup\$

You could use an SR (set/reset)-flipflop and configure it to work as a T (toggle)-flipflop as in the following picture. You would need a seperate CLK for driving this.

Avoiding IC implementation could be done by rebuilding the IC internals, but that circuit could grow really big.

enter image description here

BTW, the 555 timer IC is the perfect choice for such types of tasks. And guess whats in the 555 timer IC? (=> A SR flipflop)

\$\endgroup\$
2
  • \$\begingroup\$ Ok I have a 555 on hand so I will try this method. I see now that I was a overly hopeful that there would be some simple solution with discrete components. \$\endgroup\$
    – radiolite
    Nov 6, 2023 at 13:31
  • \$\begingroup\$ I think the 4013 approach from the other answer is the better/easier approach. \$\endgroup\$ Nov 6, 2023 at 17:37
1
\$\begingroup\$

The system must be aware of its own current state, holding it until a trigger signal arrives to change that state. The "holding", as you have discovered, can be performed with a bistable multivibrator, but that transistor implementation is difficult to adapt here, because it relies heavily on the trigger pulse persisting long enough to switch states. The behaviour of that solution is hard to predict, and will depend very heavily on resistor and capacitor values.

Ideally, the solution would employ a flip-flop that switches states upon a signal transition (an "edge"), not a sustained level. It's a job for an edge-triggered JK- or D-type flip flop, many models of which are available.

You didn't tell us about power supply requirements, so I'll suggest the good old 4013, which contains two such flip-flops, and can be powered from anything between 3V and 15V (or 20V for some devices). You configure such a flip-flop like this:

schematic

simulate this circuit – Schematic created using CircuitLab

Every positive transition (low to high) of CLK1 (node IN) will cause the digital state on D1 to be transferred (latched) to Q1 (OUT). By tying D1 to the inverse of the current state (NQ1), this results in the state Q1 changing at each positive edge at IN.

Don't forget to tie unused inputs of the other flip-flop in the package (D2, CLK2, RESET2 and SET2) to ground, or Vdd, so that they don't flap around uncontrolled.

\$\endgroup\$
3
  • \$\begingroup\$ The question mentions comparing an analog voltage signal against a threshold to change the latch. Guess this means: a) Need a comparator to compare against the threshold voltage. b) To cope with a potentially slowly changing analog voltage the comparator might need some hysteresis to avoid unwanted changes to the latch state if the analog voltage hovers around the threshold voltage. \$\endgroup\$ Nov 5, 2023 at 15:09
  • 1
    \$\begingroup\$ @ChesterGillon I read "The first part of converting the analog voltage to a distinct digital signal at the threshold I have done with a Schmitt trigger and this works fine", and understood that the trigger signal is done and dusted. \$\endgroup\$ Nov 5, 2023 at 15:20
  • \$\begingroup\$ Thanks for clarifying, now realise that omitted to fully read the question. \$\endgroup\$ Nov 5, 2023 at 15:23

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.