LM339 Output & Toggle = Issue / Why?

Discussion in 'The Projects Forum' started by SiO, Sep 12, 2011.

  1. SiO

    Thread Starter New Member

    Sep 12, 2011
    22
    0
    Hello everyone,

    I'm currently working on a project, and I am having the following problem.
    (see joint circuit image)

    Ive set up these to similar circuits. One at the top using a push button and comparator LM339, the one at the bottom a simple push button. (no deboucing, I know, this is for now only a concept lab)

    Using my CMOS probe/pen and Multimeter, here are the results I dont understand:

    -=On the Bottom circuit, Working circuit without LM339=-

    1) No Button pushed = 0V (low) at the CLK (4013).
    2) So, normally, Flip-Flop not toggeling. Good.
    3) Pressing the push button = 11.8V (hi) at the 4013 CLK input.
    4) Flip-Flop Clock hit by 11.8v square wave = Toggleling Fine, all the time.


    -=On the Top, Non-Working circuit with LM339=-

    1) No Button pushed = 0V (low) at the Output of LM339 & 4013 CLK
    2) So, normally, Flip-Flop not toggeling. Good.
    3) Pressing the push button = 11.8V (hi) at the Output of LM339 & 4013 CLK
    4) Flip-Flop Clock hit by 11.8v square wave = Not Flipping!

    I tried replacing the 4013 with a Toggle Circuit made up with a 555, same issue.

    I do believe the is something wrong with the LM339 output square wave, but I can't find why.

    Thank to anyone who has suggestions.
    Your help is welcome.

    have a nie day!
     
  2. praondevou

    AAC Fanatic!

    Jul 9, 2011
    2,936
    488
    Could it be that the comparator output rise time is too long? There is a parameter in the 4013's datasheet called maximum clock rise time which is a few microseconds, I believe the rise time at the clock input has to be shorter than this...(not sure about this, though)
    What's the resistor value from 12V to comparator output?
     
  3. SiO

    Thread Starter New Member

    Sep 12, 2011
    22
    0
    Hi.
    Your theory makes alot of sence!
    I'm pretty sure you are right about this, but tell me, how can I fix this issue?

    To answer your question, ive tried a few values between 87k and 220ohlm with same results. If no pull-up at all, can't get even close to 12v output.

    Thx alot for your inputs. I now need to fix this some way.

    (Merci praondevou!)
     
    Last edited: Sep 12, 2011
  4. praondevou

    AAC Fanatic!

    Jul 9, 2011
    2,936
    488
    1. Does it have to be the LM339?
    2. Is the second FF in the 4013 still available ? If so maybe it could be used as a signal former...
    3. Can you use any other component or are you limited to those in the schematic?

    did you mean 220k? If you tried values between 87k and 220k, you could make a test with e.g. 10k. (just to see if it makes a difference)
     
  5. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Don't expect the LM339 output to sink more than about 6mA. Size your resistor to pass 3-4mA. With Vcc=12v, that's 3k to 4k Ohms.
     
  6. SiO

    Thread Starter New Member

    Sep 12, 2011
    22
    0
    Thx for the quick reply.

    I really meant between 200ohlm and 87K. Didn't try anything higher tought. Always the same results.

    To answer your questions:

    1) It might not have to be a comparator... but for my project, I figured thats what I needed. I'm using the LM339 to compare a low voltage (that a IR receiver is sending to Vref+) to a lower voltage on Vref- that can be ajusted using a Pot for "sensitivity". (see part two of my circuit as joined pix). To be honest, I works great. But any other suggestions are welcomed!

    2) Yep, my second FF is free. Any URL to circuits on how to create this "signal former" ?

    3) I can use anything available. One again, any better ideas are welcomed. I did manage to make it work tought, with a Relay between the LM339 and the FF. LM339 would drive the relay no problem, and the N.O from the relay was set between the 12V and the FF CLK input. Worked great. But, to my eyes, this seemed to be a little bit of overkill... there had to be a better way. (are my explanation clear enough?)

    Thx! / Merci!
     
  7. SiO

    Thread Starter New Member

    Sep 12, 2011
    22
    0
    Hi,

    I don't really need to sync much.
    All I need is a clean, fast Rising Edge to hit my FF clock.

    Speed seems to me my issue has mentionned earlier.
     
  8. praondevou

    AAC Fanatic!

    Jul 9, 2011
    2,936
    488
    I tried a 4013 in simulation, CLK/DATA connected to GND and RESET to VCC, with the SET input to the comparator output, but the simulator seems to expect a reset pulse to reset the FF.
    I don't have a 4013 here to test it, but you could try it anyway. Q should follow the SET input.

    If this doesn't work, you can use a pnp transistor in emitter follower configuration at the comp output as a buffer.

    I just read again through the 339 datasheet, it is quite fast, they are actually made to be interfaced with logic circuits...
    Maybe you should first measure the actual rise time at the clock input before starting to modify your circuit.
     
  9. wayneh

    Expert

    Sep 9, 2010
    12,150
    3,058
    How sure are you that it's actually passing a square wave at all?
     
  10. t_n_k

    AAC Fanatic!

    Mar 6, 2009
    5,448
    782
    I've just prototyped up a 4013 [I have a few at hand] configured as you show in your schematic with a 555 timer (astable mode) as the clock input. Works fine - output frequency is half the clock frequency - i.e. works as a divide-by-two.

    Looks like it's your setup. What are you using for the power supply? Is it properly decoupled.
     
    Last edited: Sep 13, 2011
  11. t_n_k

    AAC Fanatic!

    Mar 6, 2009
    5,448
    782
    Since my last post I've also tried interposing an LM339 [I had some of those as well] between the astable 555 and the 4013. Everything works fine as expected. So there is no issue with interfacing the LM339 with the 4013.
     
  12. SiO

    Thread Starter New Member

    Sep 12, 2011
    22
    0
    Hi.
    In fact its not a 555, but a Comparator, the LM339.

    I've joined the complete setup now.
    Basically: IR receiver (RX) receives IR light boucing off a passing object.
    This produces aroung 2-3V at in 5 (Vref +) of my LM339 comparator.
    This is compared to the Vref - pin, witch I set at aroung 1-1.5V with Pot. This ajusts my sensibility. So when an object is detected, LM339 pin 2 (output) send a brief 12V pulse (at least, I do see my multimeter go up to 12V... I dont own an oscilloscope to officially confirm my Square Wave, but it does get to 12V pretty quickly.) Once this 12V pulse enters the CLK from my 4013, I expected it to FLIP-Flop. But it dosent. So that is my problem.

    I use as a Power Source a "Regulated DC Power-Supply (DPS-712M).

    I will try the latest suggestions I got here ASAP and come back with results.
    That would be the NPN buffer and the other 4013 setup I never used before.

    Meanwhile, any alternatives suggestions are welcomed.

    Thx!
     
  13. praondevou

    AAC Fanatic!

    Jul 9, 2011
    2,936
    488
    I don't think it has something to do with your problem, but do you have bypass capacitors on the two IC's?
    Is this mounted on a breadboard? Maybe you could post a picture in case you don't get it to work. The only thing I see is the rise time, but since t_n_k tested it with 555 --> 339 --> 4013 it doesn't seem to be the issue...:confused:

    In figure 6 of THIS app note it says something about improving switching time, but I guess it's more for a relatively slowly changing input signal because it introduces a hysteresis. You may give it a try. t_n_k tested it with a fast slope input signal from a 555, maybe that's the difference.
     
    Last edited: Sep 13, 2011
  14. praondevou

    AAC Fanatic!

    Jul 9, 2011
    2,936
    488
    From the same app note as in my previous post:

    "The circuit shown in Figure 5 suffers from one basic draw-
    back in that if the input signal is a slowly varying low level
    signal, the comparator may be forced to stay within its linear
    region between the output high and low states for an unde-
    sireable length of time...."

    So introducing a hysteresis would be something I'd definitely give a try, even though your input is not slowly changing, but it's not a digital signal neither.
     
    Last edited: Sep 13, 2011
  15. t_n_k

    AAC Fanatic!

    Mar 6, 2009
    5,448
    782
    I had probably misunderstood your comment regarding your use of a 555 in your original post.

    That's why (as praondevou re-iterated) I thought it best to interpose the LM339 between the 555 clock and the 4013 - the point of my post #11 in which I report doing this.

    The 555 astable simply provides a reliable clock source which one can adjust [my clock frequency was set to about 1Hz] to watch what happens in the circuit.

    Other than a circuit wiring error, component fault, poor power supply decoupling, unterminated / floating logic or comparator inputs [on unused logic or comparators] or a switch de-bouncing issue, it's hard to imagine why the circuit doesn't operate as intended.
     
  16. SiO

    Thread Starter New Member

    Sep 12, 2011
    22
    0

    Ok.
    For the Unsused Logic, didn't know I had to avoid floting, since they were "unsued". Thx.
    But that is not the issue since it works fine with push button (for testing purposes)

    But for the rest, tell me, are you looking at my third pix? Other were only test circuit.
    So about my 3rd pix, tell me:

    - What wiring error?
    - What Component fault?
    - What do you mean by poor power supply decoupling?
    - Switch deboucing issus? (there is no switch on my 3rd circuit, the switch on the other circuit is only for testing purposes, and boucing was negligable for this test)

    Thx for your help, all.
     
  17. praondevou

    AAC Fanatic!

    Jul 9, 2011
    2,936
    488
    Infinite possibilities. Can you post a picture?

    Do you have bypass caps on your IC's power supply mounted near the IC's? e.g. 100nF ceramic.

    Did you try out the hysteresis resistor to improve output switching slope, in case your input is not rising fast enough?
     
  18. SiO

    Thread Starter New Member

    Sep 12, 2011
    22
    0
    HI again.
    I missed that earlier post of yours. Thats great news in fact.
    Could you send pic or schematic so I can compare with mine?

    Mean while, as suggested by praondevou, I will send you a picture of the circuit.
    Ill just clean-up my mess first cause I tried allot of things leaving a few wires behind...

    I will then try praondevou's suggestions:

    - Add bypass caps on your IC's power supply mounted near the IC's
    &
    - Try out the hysteresis resistor to improve output switching slope (ill need to get my books out for this one, it's been a while)


    Again, thx everyone for you patience.
    Ill try to make it up to the forum in your Computing and Networks forum :)

    Ill be back soon with pix.
     
  19. praondevou

    AAC Fanatic!

    Jul 9, 2011
    2,936
    488
    Hysteresis: without making it too complicated just try it out with e.g. 1M from pin 2 to pin 5 and see if that changes anything. Or read the app note I had posted.

    Good luck.

    (I appreciate help in Computing and Networks ;))
     
  20. SiO

    Thread Starter New Member

    Sep 12, 2011
    22
    0
    Alright, I did add the Hysteresis 1M, but what I get is that even tought my Vref + is Higher then the Vref -, nothing happends at pin 2 anymore. Ill do some further testing tomorrow, but here's a pic from my circuit until then!

    Note: the Output wire is usually connected to my probe or multimeter or DEL, and not hanging like that...

    Thx all.
     
Loading...