Connect with us

Noob Help... LED Flip Flop Help

Discussion in 'Electronic Basics' started by [email protected], Mar 28, 2007.

Scroll to continue with content
  1. Guest

    Greeting!!

    I made a little circuit for class that needs a modification.
    I was hoping I could get some helps here.

    Current circuit:

    A momentary switch toggles a LED on and off every time it is pushed
    and released.

    Switch is debounced by a schmitt trigger 4093, goes to clk of a 4013
    flip flop and the Q goes to a 2n7000 to activate/deactivate the LED.

    The mod I have to add is another LED that is in the opposite state of
    the first...... when you push the momentary switch LED1 should turn
    on, LED2 should turn off...... when you push the momentary switch
    again, LED1 should turn off, and LED2 should turn on.

    I'm new at this. Do I just add a inverter tied to the Q output of
    that 4013, and use the output to control another 2n7000?


    Thanks very much.
     
  2. You did all this.......

    ......but you don't know how to do this?

    You need to try harder for school work before asking for help. The answer
    is on the cover page:
    http://my.ece.ucsb.edu/bobsclass/2B/Labs/Datasheets/cd4013.pdf
    Here's another one:
    http://www.fairchildsemi.com/ds/CD/CD4013BC.pdf
     
  3. Lionel

    Lionel Guest

    No! Your flip-flop has two outputs that are always in the opposite
    state to each other.
    Connect the second LED to the Q- output in *exactly* the same way you
    connected the first LED to the Q output. ie; transistor, resistor,
    LED.
    (And in fact, if you use a high brightness LED, you should be able to
    get plenty of light from each of the flip-flop outputs without even
    needing a transistor. 5mA on a high brightness LED is easily as bright
    as 20mA on an old style LED.)
    Any time. :^)
     
  4. That's not exactly true. Pulling Set and Reset high at the same time will
    drive both outputs high, no clock needed.
     
  5. Guest


    So it is ok to have the second LED circuit run off Qbar even though
    Qbar is connected back to D input?

    Thanks again, I'll give it a try!
     
  6. Guest

  7. Lionel

    Lionel Guest

    Yeah, okay, but it's an illegal state, & couldn't happen in the
    circuit he described to us anyway. Yes, you're correct, but that kind
    of pedantry is just going to confuse the OP.
     
  8. Lionel

    Lionel Guest

    Um. I didn't think of that. If you use a transistor to drive the LED,
    & use a resistor between Q- & the base of the transistor, it
    shouldn't be a problem. Depending on the beta (gain or sensitivity) of
    the transistor, you might start with 10K or 4K7 for your base
    resistor.
    Glad I could help. Best of luck with your project.
     
  9. Guest

    or does it make more sense to use the extra flip............ both flip
    flops with the Clk inputs tied together.
    i have a power on reset on the first one to set it on.

    can i use the same power on reset(simple diode&rc) tied to the the Set
    of FF1 and also to the RS of FF2?

    That way each one should power on in the right state. The debounced
    input switch should work for both with the clks tied together... no?

    thanks everyone so far.
     
  10. I'm just saying..... If I was a college professor, it's exactly the kind of
    trivia I'd expect the student to learn from this venture. If the professor
    said to make sure that the two outputs are _never_ the same, then the OP
    should do what he was originally thinking and use an inverter. At any rate,
    this assignment was for the OP to complete, I think you should not have
    simply handed him an answer. No offense intended, just saying.... :)
     
  11. Ah, the datasheet should even tell you that too. :) After rereading what
    I wrote, I may have come off kinda harsh. I didn't mean to sound like a
    parent. ;-)
     
  12. Guest


    Tough love is great. It was a correspondence course and nobody knows
    anything around here locale. This mod is not part of the course,
    just some thing I wanted to add for my own. Project is over, I just
    wanted to add to it and maybe learn something, and maybe even learn
    form other people on the information highway.

    I'm very thankful that anyone even responded.

    Thanks
     
  13. Lionel

    Lionel Guest

    Well, I didn't get that "do my homework assignment" vibe from him that
    we see so often in here. I figured he was someone just playing around
    for fun, so I didn't mind spoonfeeding him. But yeah, if I'd guessed
    wrong, it would've been the wrong response.
     
  14. Lionel

    Lionel Guest

    *Urgle!*

    I can't think of any obvious reason why it wouldn't work, but that's
    quite possibly because my brain's refusing to visualise such an ugly
    setup. ;^)

    Now, we're talking about 4013 D or JK dual flipflop right?
    *grumble* I suppose I'd better look the thing up instead of relying on
    my memory. <rummages>
    <http://my.ece.ucsb.edu/bobsclass/2B/Labs/Datasheets/cd4013.pdf>

    Okay, yes it is a pair of D flipflops, with S & R inputs. And I'd
    forgotten how wimpy the output stages were on those old CMOS parts,
    because the data sheet's saying that the maximum output current at 5V
    is less than a milliamp! So yes, it's going to need some buffering to
    drive LEDs. One tip if you're expecting to do much experimenting with
    logic circuits in future is to make yourself up a little display
    module with a bunch of LEDs, resistors, driver transistors or a buffer
    chip, & pins or a cable so you can plug logic signals into it to light
    the LEDs. (Back in the days, I used a 74LS245 with 8 LEDs & resistors
    on a tiny piece of stripboard, but that was when 5V was king &
    everything I was 74LS/F TTL, so these days, you'd likely want to use
    the 74HC or 74HCT version of the same part.)
    Once you've got something like that, you can (mostly) ignore loading
    effects from the LEDs, so you can setup an experient like this one in
    a matter of minutes.
     
  15. John Fields

    John Fields Guest

    ---
    No, it isn't. It's a perfectly valid set of outputs for that set of
    inputs and serves to define those input states as both being high.
    ---
    ---
    So what? you said "always" and Fremont said "not exactly", which
    nicely trumped you.
    ---
    ---
    I see. The newsgroup should never have anything posted to it above
    the level of understanding of the lowest common denominator in order
    to avoid embarrassing you?

    No offense intended, OP, it just seems that Lionel wants to shield
    you from anything which might cause you to think that he was wrong.

    Which he was. Because of the limited drive capability of the 4013,
    driving even a high intensity LED from Qbar could cause its Voh to
    fall below Vih, with the result that the FF wouldn't toggle.

    Later on in the thread you proposed using the second half of the
    4013 as the driver for the second LED, which Lionel pooh-poohed, but
    I think it's a good idea since if you've got it spared you can get
    rid of a couple of transistors and resistors by doing it this way:

    (View in Courier)

    +---------+
    | +-----+ | +-----+
    +-|D Q|-|-----|S Q|--[R]--[LED>]-+
    CLK>-----|> _| | | _| |
    | Q|-+-----|R Q|--[R]--[LED.]-+
    +-----+ +-----+ |
    U1A U1B GND

    Use the SET/RESET inputs of U1A to get U1B to come up the way you
    want it to on power-on, and tie U1B D and CLK to Vcc or GND.

    Use high-efficiency 2mA LEDs and calculate the values for R keeping
    in mind Voh at that current, and you should be OK.

    Post back if it doesn't work. ;)
     
  16. John Fields

    John Fields Guest

    ---
    Geez, you've been posting here a little over a month and all of a
    sudden it's "... that we see so often in here." Almost like you've
    been around forever...
    ---
    ---
    With bad data, just because you thought he was playing around?

    I guess you condone misleading the ignorant in order to keep them
    down.
    ---
     
  17. Lionel

    Lionel Guest

    I've been posting to this & other electronics newsgroups
    intermittantly for nearly a decade. It's only recently that I've been
    using this email address.
    So yes, I'm pretty good at spotting homework posts.

    And hey John, what's got you so bitter? It can't be good for you to be
    spraying all that bile. ;^)
     
  18. ehsjr

    ehsjr Guest

    One extra thing (for learning & fun) you can
    do, that wasn't mentioned in the thread:
    add a discrete component inverter, just so you
    can learn how to make one. And one practical
    tip - make your LEDs two different colors
    so you know which is which at a glance.

    Ed
     
  19. John Fields

    John Fields Guest

    ---
    Not at all bitter; I just like to prick pretentious balloons and let
    the hot air out.

    For example, your: "Yes, you're correct, but that kind of pedantry
    is just going to confuse the OP."

    Seems designed to trivialize your error (thus keeping you on top of
    it all) by insulting Fremont (calling him a pedant somehow doesn't
    seem to follow your professed philosophy of following your
    "Platinum" rule) and making it seem that it would be better if the
    OP were deliberately kept ignorant.
     
  20. Lionel

    Lionel Guest

    Oh yeah, I'd forgotten that you were one of the political nutbags.
    I can see why my post would've gotten you gunning for me. ;^)

    Here's your Flame Warrior card, Mr tough guy:

    ---
    IDEOLOGUE
    "The most common variants of Ideologue are conservative and liberal.
    Smug and self satisfied in their certitudes, Ideologue's opinions are
    merely a loose collection of intellectual conceits, and he is
    genuinely astonished, bewildered and and indignant that his views are
    not universally embraced as the Truth. He regards the opposing point
    of view as a form of cognitive dissonance whose only cure is
    relentless propagandizing and browbeating. The conservative iteration
    of Ideologue parades himself as a logical, clear thinker, while the
    liberal version trumpets his higher level of mental, spiritual and
    social awareness. Troglodyte is the natural ally of conservative
    Ideologue, and for liberal Ideologue it is Weenie. Ideologue is a
    fierce, but very predictable Warrior."
    http://redwing.hutman.net/~mreed/warriorshtm/ideologue.htm
    ---

    And no, I wasn't trying to insult Mr Fremont. His correction to my
    post was 100% correct. He perceived the OP as being a homework poster,
    I perceived him as being a noob experimenter. Both of us provided what
    we believed to be the most appropriate advice. Oh, & just for the
    record, I certainly don't consider it 'insulting' to call someone a
    pedant.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-