Close
0%
0%

Single Comparator Toggle-Flip-Flop

Imagining a pen-clicker, had to test my analogish-skills...

Similar projects worth following
A 5V logic coompatible falling-edge-triggered Toggle-Flip-Flop using a single active component (a comparator). The idea was derived from a pen-clicker... and, it works!

I needed a T-Flip-Flop for my project #Floppy-bird , and didn't have any TTL components on-hand, so I thought I'd see if it was possible with comparators...

A fellow 'round here has done some interesting stuff with diodes as transistors, and such-like that seems otherwise uncommon, if not "impossible", so inspired by @Ted Yapo, I ventured into the realm of doing-so with only a single comparator. The idea, then, was maybe it'd eventually be possible with a single Transistor...

And, lo-and-behold, roelh's One Transistor FlipFlop. Glad to see it's possible!

  • VID

    esot.eric04/16/2018 at 00:49 7 comments

    Here it is, in all its glory!

    First, the audio is converted to PWM.

    Then both PWM edges are converted to falling-edge pulses.

    This, then, could be fed directly into a floppy drive's "write data" input, storing the PWM on-disk.

    When read-back from the disk, the floppy drive will give these same falling-edge pulses to indicate each edge of the recorded PWM.

    That, then, gets fed into my single-comparator T-Flip-Flop, to convert those falling-edges back into PWM, then directly drives a speaker.

    ----------

    Ahh, right... So, this video was recorded months ago... long before I ran the 500KHz simulations. I can't recall the frequency this is running at, but it's surely slower than 500KHz, otherwise, as my conclusions, after running the sims... concluded... This system probably won't run at 500KHz, with the LM311's I used.

    I do have faster (2ns!) comparators in the ol' storage-unit... but haven't really decided to go that route, much easier to use a 7474... and, realistically, I only need 500KHz for the *image* portion of #Floppy-bird, which wouldn't benefit from a T-FF at all, being that it'd still have to go into the uC for processing...

    However, (wee, look at this link go!) it would be an interesting thing to try, some day, maybe... 500KHz...

  • 500khz components, explanation

    esot.eric01/27/2018 at 02:39 2 comments

    here's the components determined in the sims....

    R1-4 are two voltage-dividers to bias Vi+ at 4V and Vi- at 3V. Thus, when the comparator is off and no toggling occurs at the input, the comparator's output is high (well, the LM311 is open-collector/Hi-Z... and, confusingly, I've the habit of calling it "off" when Vi+ > Vi-, and "on" when the output is low).

    So... it remains "off" as-biased... 4V > 3V.

    A pull-up resistor is not shown on the output... but it's unnecessary for this circuit, only for those following,

    D1 and D2 isolate the output's feedback-paths to Vi+ and Vi-, so's we don't have to consider each's present voltage on the other (especially when the output is Hi-Z).

    R7 and the Zener diode form a crude voltage-regulator. Thus, when the comparator output is low, Vi+ will be pulled to ~1V.

    When the comparator is on, the zener also prevents the next falling-edge input from dropping Vi+ lower than Vi-. It essentially keeps Vi+ from seeing that falling edge.

    (I imagine the zener could be replaced with cleverer resistor usage, but... Math! I'm not so great with analog circuits, it always seems every 'building-block' thrown in has a dramatic effect on all the others. Here, I'm attempting to reduce that effect. Thus diodes, and AC-coupling.)

    So, now, Vi+ has two steady-states; 3V and 1V.

    The feedback-path for Vi- is slightly more complicated. R9 and C3 limit the rate that Vi- is affected by the comparator's turning on (and off). Similarly, R8 and, again, C3 cause input-edges to be smoothed slightly before entering Vi-. 

    Thus, the comparator turns on, latching Vi+ low when the present value of Vi+ is lower than the *previous* value of Vi-.

    (But wait! That's wrong! So it *does* still function as I originally planned, the spike on Vi+ is larger than that on Vi-, but still simultaneous, so they cross... huh. No.. wait, these don't even look the same. Sheeit. Now I remember why a short lab-report always took HOURS longer than seemingly anyone else's took them.)


    But, again, Vi+ essentially doesn't see the next falling-edge, so that slight delay from C3 doesn't stop that edge from bringing Vi- below the steady Vi+, turning the comparator off, again.

    Now, as for the rising-edges on the input...

    If the two paths were identical, both inputs would rise, briefly, together, and so wouldn't cross-over. Thus, there'd be no change as far as the comparator is concerned...

    But of course, the two paths differ (otherwise the same would be true for falling edges, and nothing would happen, ever). So... I didn't really put a huge amount of thought into the rising edge... Instead, some early values for R8 and 9 led to the "on" steady-state voltages for Vi+ and Vi- to be "too close for comfort", so I tweaked those values so that Vi- would be dramatically lower, in that state... nearly half a volt. R6 was initially chosen to be higher than R5 so that the spikes on Vi- would be smaller than those on Vi+, but this is where the progression led me, during simulation.

    (BTW, when I was in school, running a simulation meant setting up the circuit, clicking 'run' and waiting several minutes. Now it's possible to do sims in 'real-time', wherein you can change component values while simulating. Very handy.)

    Here were my original proof-of-concept component choices:

    And, again, those after experimenting:

    (It may be possible to remove the feedback path to Vi-, altogether. The...

    Read more »

  • Sims

    esot.eric01/26/2018 at 03:51 0 comments

    i've done 'em before, but not at my desired speeds...  I'm planning roughly 500khz for another project. Also, I didn't look closely at the edges,

    I usually use Paul Falstad's online simulator, but it doesn't work so well on this phone, so branched out for a (woo, 24-hour...) trial of EveryCircuit. Seems pretty good, but not in my budget.

    So, new component values. But looks like it should work great!

    Then... I remembered that the LM311 I plan to use has a delay of 200ns.... erm.

    So tried to simulate that... and it *dramatically* slows the toggle-frequency. Nevermind my source guarantees low-pulses down to 0.1us.

    Also, not certain it'd still function with more real-world slew-rates at the input.

    But, I'm still pretty content with this /wonky idea's functioning at all!

View all 3 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates