Logic circuit setup, help wanted.

Discussion in 'General Electronics Chat' started by HellTriX, Jul 12, 2008.

  1. HellTriX

    Thread Starter Active Member

    Apr 11, 2008
    83
    1
    I want to setup a logic circuit.

    I know the truth table I require as follows:

    IN1 | IN2 | Out
    high | low | high
    Low | low | low
    high |high | low
    Low |high | low

    This appears as though it will require 2 or 3 different logic circuit types to achieve the desired output.

    Any ideas to start with?

    Basicly as IN2 goes high I want all the outputs low. If IN2 stays low, I don't care if IN1 is high or low. I would like this to be stable past 20khz.
     
  2. HellTriX

    Thread Starter Active Member

    Apr 11, 2008
    83
    1
    Maybe I already figured it out.
    A NOR gate with one of the inputs having a NOT gate.
     
  3. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    A pair of NAND gates from a CD4093B could do it with two left over ;)

    See the attached.
    Oh, the "+" means "AND", not "OR".

    [eta]
    Oops, IN1 and IN2 should be swapped. Then it works. (I have the flu today, and not hitting on all cylinders :()
     
    Last edited: Jul 12, 2008
  4. HellTriX

    Thread Starter Active Member

    Apr 11, 2008
    83
    1
    Nice I think that is better than I had since I can do it with one IC instead of two.
     
  5. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    NAND gates, in particular the 4093 Schmitt-trigger input quad NAND, are extremely useful. You can emulate any other logic gate using NANDs in various combinations.

    The Schmitt-trigger input makes it far less likely to change states due to noise or borderline signal levels.
     
  6. HellTriX

    Thread Starter Active Member

    Apr 11, 2008
    83
    1
    I will try to find some. Hopefully the local radio shack carries them. Its too late to put them on my last component order.
     
  7. HellTriX

    Thread Starter Active Member

    Apr 11, 2008
    83
    1
    Question: Can the inputs of a 741 op amp be sorted to ground or positive without a resistor without causing damage?
     
  8. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    Do you have a specific circuit diagram that you can attach?

    It is not generally a problem to short either of the opamp inputs to ground.

    hgmjr
     
  9. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    If you damage a 741, who cares? :)
     
  10. Wendy

    Moderator

    Mar 24, 2008
    20,764
    2,534
    The printed circuit board?
     
  11. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Highly unlikely.
    RS stopped carrying all but a very few linear ICs a few years ago. They carried Parallax Basic Stamp starter kits for a while, but it looks like they've dropped it; they only list some fairly expensive add-on modules on their website. Probably the only way you could get a 4093 at RS is by buying it as a part of their Electronics Learning Lab (about $70)
     
  12. HellTriX

    Thread Starter Active Member

    Apr 11, 2008
    83
    1
    Unfortunate about the 4093s :( Doubt I can find any place that will let me buy just a couple of these and nothing else. I could spend 5-7 bucks in gas to drive to this electronics store in the next state over (30 miles or so through traffic). Anyway no big deal.

    My question about the opamp was in the attachment.
    Just wanted to know if they blow up if you short the inputs to pos/neg with no resistor. Since they say you can overload the output indefinitely, but not sure about the inputs. Nice to know these things since I don't have many parts in my junk box.
     
  13. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    No, you should be OK if you do that - but you shouldn't run the thing open-loop (no feedback from the output to the inverting input) as that causes the output transistors to run saturated, which generates heat due to the high current. If you want to run open-loop, use a comparator instead; they're designed to operate with the output saturated.

    I have no clue why you would want to do that to your opamp though.

    Mouser.com or Jameco.com or Electronic Goldmine will be happy to sell you just a couple of CD4093BxN's. Might as well order some LF353N's too, so you can finally get out of the early 1970's with that 741 op amp. The LF353N's are cheap; as little as $0.35/each at Mouser if you're buying just one.

    Make sure the part you order has an "N" in the suffix. That indicates a DIP package, or Dual Inline Pin where it'll plug into a board that's drilled at 0.1" spacing. That way you can use a generic pre-drilled PCB from RS or elsewhere. The other package designs can be a hassle for a hobbyist to work with; you wind up having to design and etch your own PCB's.
     
  14. HellTriX

    Thread Starter Active Member

    Apr 11, 2008
    83
    1
    Nice!

    I need to get my head out of the 70s :)

    I'm just designing a voltage comparator. I'm going to try to set it to go high when the thing I am monitoring exceeds .138 volts. I think this means I need a bias voltage as well as a reference voltage. TBH, not sure yet, I haven't gotten around to doing some simulations yet. But the output from this would goto the logic circuit with a second input from the timer to the logic. The final output goes to my mosfet driver.

    Tnx for all your help, you've made it enjoyable to check the forum often :cool:
     
  15. theamber

    Active Member

    Jun 13, 2008
    318
    0
    You could go down to the basics and do any type of gates with a combination of diodes or transistors or even relays.
     
  16. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    OK, you're going to need a comparator then.
    Neither the 741 nor the LF353 are rail-to-rail inputs. They're not able to deal with signals that are within about 0.7v from Vee or Vcc. If you're using a single supply, that means you can't really see levels that are near ground.

    However, if you use something like an LM393/LM2903 dual comparator, even LM339 quad comparators, they can compare inputs that are within a few mV of ground.

    You could use an opamp that had rail-to-rail inputs, but if your output is basically a switch (open loop gain), you will be running the output in saturation nearly all of the time, which will generate heat and shorten the opamps's life considerably. If you want a switch, use a comparator; they're designed to be run in open-loop mode. They will switch faster than an opamp used in open-loop mode as well. The caveat is that the outputs are generally open collector; that means it can only SINK current, and you need a suitably sized pull-up resistor or other method to source current.

    Look at the datasheet for the comparator you're considering for the sink current at your Vcc, then divide that number by two for Ipullup.
    Then, calculate: Rpullup = Vcc/Ipullup.

    Well, you can combine the two in your reference voltage. A little "English bias", if you please. ;) (think of using "English" in a game of pool/billiards)
    But anyway, since you're wanting to set the comparator to monitor for a 0.138 voltage level, let's see what we can do to make the setting of that level easier, and less "fiddly" (as those UK'ers frequently say when tinkering on their Jaguars, Bentleys and Rollers...)

    Let's give you an adjustment range from 0v to twice your threshold level, or 0.276v. A 500 Ohm linear pot should work fine; that will give you a current of I=E/R or 0.552mA=0.276/500. Connect one end of the pot to ground, wiper to the inverting or noninverting input (whatever logic you need for the output) along with a 10nF cap to ground (VERY important for noise elimination!).

    Then let's calculate what resistance you'll need from the high side of the pot to Vcc.
    R = E/I, so R = (Vcc-0.276) / 0.552mA.
    For example, if Vcc=5v, then:
    R = (5v-.276)/0.552mA = 4.724/0.000552 = 8558 Ohms.
    So, you could use an 8.2K and 360 Ohm resistors in series, or two 4.3k in series, or lots of other combinations.

    This online series/parallel resistance calculator is very handy:
    http://www.qsl.net/in3otd/parallr.html
     
  17. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Absolutely! But who wants to work that hard? :confused: :D
     
  18. HellTriX

    Thread Starter Active Member

    Apr 11, 2008
    83
    1
    Ok, this next schematic is far from working, but hopefully it illustrates what I'm attempting to do.

    R6 is just a metal plate that as current flows through it, it will create a voltage drop. I can size the metal depending on the voltage drop I need to some degree (poor mans shunt). I have only estimated the voltage drop to be 138mv, it could be up to 400-500mv but I'm aiming for below 300.

    I just wanted to switch the logic output low when the shunt voltage exceeds a certain amount. The main circuit that is not shown is over engineered to handle what I'm doing so the accuracy of this circuit is just a sort of short circuit protection. If the load exceeds 2-3 times what it is designed for hopefully a circuit that I'm trying to build here would shut the thing down temporary.
     
  19. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Let's see - with a 120V battery in that circuit, there will be a loud "BANG!" and a bright flash as the lid from the LM358 blasts it's way through your ceiling and into orbit! :eek:

    Did you mean 12V?
     
  20. HellTriX

    Thread Starter Active Member

    Apr 11, 2008
    83
    1
    No :)

    I was going to reference it on the high side with 5-12v. Then take the voltage drop of the shut with respect to that.
     
Loading...