Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

AND-OR Gate


  • Please log in to reply
26 replies to this topic

#1 pjnowak

pjnowak

    Advanced Member

  • Members
  • PipPipPip
  • 32 posts

Posted 19 June 2012 - 02:01 PM

I am trying to find an IC that does an AND gate followed by an OR gate. See they attached image. What I am looking to try to do is create a manual switch to turn my devices On, Off or Auto, which auto would be controlled by the Netduino. The larger inputs it can handle the better. The end result would need to handle at least 16 outputs to control pumps or valves. Does anyone know of anything that I could use?

#2 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 19 June 2012 - 02:08 PM

See they attached image.

There is no image attached (?)

#3 pjnowak

pjnowak

    Advanced Member

  • Members
  • PipPipPip
  • 32 posts

Posted 19 June 2012 - 02:25 PM

Sorry, here you go. Not sure if I drew it right, but hopefully you get the idea.

Attached Files



#4 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 19 June 2012 - 02:39 PM

Sorry, here you go. Not sure if I drew it right, but hopefully you get the idea.

I think I got the idea, although the circuit will not work as shown (there is nothing connected to the gate inputs which are wired together). You'd probably want to select some of the numerous 74xx series logic ICs, there are AND+OR and NAND+NOR gates with different number of inputs, which can be combined together, add inverter if needed (for example, NAND or NOR gate with all inputs wired together is inverter too).

To control the pumps or valves, you'd probably need some kind of power switch, if you need to control them directly - you could use a relay, solid state relay, power MOSFETs etc. It depends on the device characteristics - voltage, current, etc.

#5 nakchak

nakchak

    Advanced Member

  • Members
  • PipPipPip
  • 404 posts
  • LocationBristol, UK

Posted 19 June 2012 - 03:05 PM

I would just use a nand gate for all the functions

Apply De Morgan's theorem and you can create a logically equivalent circuit using just one sort of gate.

Nak.

#6 baxter

baxter

    Advanced Member

  • Members
  • PipPipPip
  • 415 posts

Posted 19 June 2012 - 05:59 PM

TI has a configurable gate part, SN74LVC1G97, http://www.ti.com/li...sn74lvc1g97.pdf among others, http://focus.ti.com/...mplateId=SZVI_T Baxter

#7 pjnowak

pjnowak

    Advanced Member

  • Members
  • PipPipPip
  • 32 posts

Posted 19 June 2012 - 06:07 PM

So this is all good stuff but not being a hardware guy, I am not sure how how I am supposed to get "( A and B ) or C" out of this. Can I link to NAND gates together?

#8 pjnowak

pjnowak

    Advanced Member

  • Members
  • PipPipPip
  • 32 posts

Posted 19 June 2012 - 06:15 PM

Is there any reason why this chip would not work?

http://www.ti.com/li...74lvc1g0832.pdf

#9 nakchak

nakchak

    Advanced Member

  • Members
  • PipPipPip
  • 404 posts
  • LocationBristol, UK

Posted 19 June 2012 - 06:59 PM

So this is all good stuff but not being a hardware guy, I am not sure how how I am supposed to get "( A and B ) or C" out of this. Can I link to NAND gates together?


Yes you would effectivly link the output of a nand to the input of another nand until you built the boolean expression you wanted. Or you could use the device suggested below, or just order a and gate and an or gate, you typically get 4 devices per chip so would have no problems creating your circuit.

Nak.

#10 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 19 June 2012 - 07:38 PM

Hi pjnowak

You can make anything from NAND gates, and as Nak said, the nice thing is they come in fours.

I am attaching a badly drawn diagram of connecting up an AND - OR circuit using NAND gates. It needs three out of the four that come in a 74xxx00.

The logic is as follows:
Normal AND-OR

D = A and B
E = C         (E is just in the table to make H a bit clearer)
H = D or E

A B C  D E  H
0 0 0  0 0  0
0 0 1  0 1  1
0 1 0  0 0  0
0 1 1  0 1  1
1 0 0  0 0  0 
1 0 1  0 1  1
1 1 0  1 0  1
1 1 1  1 1  1

NAND version

F = A nand B
G = 1 nand C
H = F nand G

A B C 1  F G  H
0 0 0 1  1 1  0
0 0 1 1  1 0  1
0 1 0 1  1 1  0
0 1 1 1  1 0  1
1 0 0 1  1 1  0
1 0 1 1  1 0  1
1 1 0 1  0 1  1
1 1 1 1  0 0  1

In the diagram, I have shown the two logic diagrams, how the insides of the 74xxx00 are laid out, and how to connect it up.
Note that the inputs to the unused gate (pins 1 and 2) and tied high, this stops the gate floating.

Hope this makes sense - Paul

Attached Files



#11 pjnowak

pjnowak

    Advanced Member

  • Members
  • PipPipPip
  • 32 posts

Posted 01 July 2012 - 02:39 PM

I went out a bought a NAND gate and set it up, how ever my Led seems to always stay on, did I do something wrong?

#12 pjnowak

pjnowak

    Advanced Member

  • Members
  • PipPipPip
  • 32 posts

Posted 01 July 2012 - 02:41 PM

Here is a image of my setup.

Attached Files



#13 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 01 July 2012 - 04:04 PM

Hi pjnowak, First, thanks for having faith in me! I can't quite make out all the connections from the thumb nail, so these are guesses: 1/ Are the + and - buses on either side of the board connected together? They are not normally joined on a bread board, hence you have to join them with wires from one side to the other. (minus to minus and plus to plus) 2/ Have you connected anything to pins 4, 5 and 12? (The A, B and C inputs in my diagram.) I can't see any wires on those pins. Try connecting them all to ground (-), then if the LED goes off, try connecting them one at a time to Vcc (+) to check the logic. Hope this helps - Paul

#14 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 01 July 2012 - 07:08 PM

Using Fritzing, I have drawn the circuit I think you have, I have added a resistor (about 150 ohms) on the LED, and the extra power wires (from guess 1 above). The A and B (AND) inputs are in white, and the C (OR) input is orange. Try connecting them all to Gnd (-) and the LED should go off. If the orange is connected to Vcc (+ / 5V) then the LED should come on. OR If both of the white wires are connected to Vcc (5V / +), then the LED should come on. Paul

Attached Files



#15 pjnowak

pjnowak

    Advanced Member

  • Members
  • PipPipPip
  • 32 posts

Posted 01 July 2012 - 07:28 PM

I am know able to get the led to turn off if they all are negative, If C is positive and A and B are negative the led turns on, however if A and B are positive and C is negative the LED is off.

#16 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 01 July 2012 - 08:44 PM

There is definitely something wrong. You said before it would not turn off "how ever my Led seems to always stay on", did you change anything so that it goes off now? What is the part number of the chip you have, I can only read the start CD74... Is there a notch at the top left of the picture? (Notch is at the Pin 1 end of the chip) Might be worth driving the LED from pin 6 instead of pin 8 so you can test the AB inputs are being NAND'd correctly. (Column F in the table a posted a while back.)

#17 pjnowak

pjnowak

    Advanced Member

  • Members
  • PipPipPip
  • 32 posts

Posted 03 July 2012 - 12:01 PM

There is definitely something wrong.

You said before it would not turn off "how ever my Led seems to always stay on", did you change anything so that it goes off now?

What is the part number of the chip you have, I can only read the start CD74...

Is there a notch at the top left of the picture? (Notch is at the Pin 1 end of the chip)

Might be worth driving the LED from pin 6 instead of pin 8 so you can test the AB inputs are being NAND'd correctly. (Column F in the table a posted a while back.)


I am using chip CD74AC00E.

If I drive the LED from pin 6, it is off when I have both pins positive.

#18 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 03 July 2012 - 04:45 PM

So the signal at pin 6 is correct. (A NAND B output is LOW when both A and B are HIGH).

Maybe there is a problem with the last NAND gate's input from pin 6.
Instead of taking the output from pin 6 to pin 9, can you try using a wire on pin 9 and taking that high and low to see what happens when C is also low. If it does not behave, the gate at pins 8,9,10 maybe damaged, try using the gate at pins 1,2,3 instead.

This is the datasheet, I can't see anything obviously wrong. The gates are all laid out as in the HC(T) part.

Don't give up, and remember its supposed to be fun!

Paul

#19 pjnowak

pjnowak

    Advanced Member

  • Members
  • PipPipPip
  • 32 posts

Posted 03 July 2012 - 04:57 PM

Ha, I don't plan on giving up, I am guessing also that I am going to need to invert the inputs at some point? I will give that a try tonight if I get a chance.

#20 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 03 July 2012 - 05:35 PM

You should not have to invert the inputs. The three Nand gates give the same logic as the And-Or circuit. Paul




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.