2

I recently developed an interest building circuitry systems. It started in Minecraft and then grew when I picked up a micro controller from Radio shack to build an RC car with.

Obviously I'm most familiar with Minecraft mechanics. So in an effort to educate myself I downloaded Logisim. The learning curve has proven steep. The thing I'm stumped on currently is how I can go about wiring my own logic gates, rather than relying on the ones available. So I started with the simplest, the OR gate.

In Minecraft you set two buttons a few blocks apart from each other and connected to a single line of redstone running to a lamp. Bam... OR gate.

In Logisim they have a special icon with 5 input nodes and 1 output node. As many buttons as there are INs may be attached as INs, and any combination of them may be pressed simultaneously to produce a signal.

GREAT! But try the Minecraft method in Logisim and the wire turns red and produces an E, presumably for Error, in the LED.

So my questions are:

Why do two IN devices on one line produce an error in Logisim?

What does the error represent in real life?

(priority question) How can I go about building my OWN logic gates from fundamental pieces like wires, nodes, capacitors, resisters and etc?

enter image description here

2 Answers2

1

The first circuit you have drawn is simply short circuited. Electrically you can't drive a line both low (zero volt) and high at the same time on the same wire. The current would just flow straight from the high line down to the zero voltage.

There are lots of examples on how to build logic gates. Like >this<. But usually it is much simpler to buy a ready made logic gate from the 7400 series.

Dejvid_no1
  • 3,568
  • 17
  • 24
1

Normal logic levels (at least nowadays) are usually zero volts for zero and some positive voltage for "1". The positive voltage depends on the used chip etc and can be 12V or 5V or 3.3V or something else.

Connecting two inputs together is bad because if one input is "1" and the other is "0", current will be flowing from one to the other, this can cause big problems (if the inputs are connected to powerful sources) or just not work right (for current limited sources the output voltage would the be somewhere between "1" and "0".

While you can buy chips that contain logic gates, you should try to understand how they work electrically. The simplest to understand (for someone without electronics knowledge) would probably be relay logic. A relay is an electromechanical switch:

schematic

simulate this circuit – Schematic created using CircuitLab

Here are some example relays. They all work the same. If you connect an appropriate power source to the coil of the relay (two leftmost pins in the schematic), the coil gets a magnetic field around it and pulls the armature towards it. When the current is disconnected, a spring pushes the armature back. This is exactly like a switch, except it is controlled by an electric current.

RLY1 has two switched contacts - they are disconnected until the coil is energized at which point they connect. This is called a Single Pole (one moving part) Normally open (disconnected until energized). There are relays opposite of that - connected until the coil pushes the connection apart. Those are called normally Closed.

RLY2 has three switched contacts - two are connected when the coil is not energized and energizing the coil connects the "middle" contact (the moving bar) to the previously unconnected contact, while disconnecting the previously connected one. This one is the one I'll be using for logic later. This is a change-over relay. It has a central contact, a normally open contact and a normally closed one.

RLY3 and RLY4 are the same as RLY1 and RLY2 but they have been doubled - one coil moves two "switches" at the same time.

Now, onto logic. Lets state that our "1" will be represented by 12V and "0" by 0V. I know that some of the arrangements can be simplified to reduce the relay count, but for the sake of clarity and compatibility with transistors/chips I did not do it.

The simplest gate - an inverter:

schematic

simulate this circuit

When switch A is connected to ground, the coil is not energized and the relay contacts are connected like show in the schematic. Positive voltage goes to the output and the lightbulb is on. Connecting the switch to "1" energizes the coil and changes the contacts - now the lightbulb has 0V on both ends and is off. Input "1", get "0" out. Input "0" get "1" out.

AND gate:

schematic

simulate this circuit

Here, both switches A "AND" B have to be switched to "1" for the lightbulb to turn on.

OR gate:

schematic

simulate this circuit

It is very similar to an AND gate. Where AND gate produces "1" if both of its inputs are "1", an or gate produces "0" if both of its inputs are "0". Switching one or both switches to "1" turns on the lightbulb.

Let's cascade some gates and build a NAND gate (an AND gate, followed by a NOT gate):

schematic

simulate this circuit

Here, the output of the AND gate is an input to the NOT gate, so the lightbulb is off when both A and B are "1" and on otherwise.

Hopefully this gave you some understanding how logic works.

Pentium100
  • 6,550
  • 3
  • 32
  • 39
  • Thank you for your detailed post. The electro-mechanical switch makes sense and I can follow these circuits pretty easily. After thinking about it for a few hours I wonder if this is what Logisims transistors basically amount to --where the input pins represent the A and B switches in your diagrams, and the transistors represent the RLYs – Musixauce3000 Mar 25 '16 at 11:41
  • 1
    Transistor works a bit more complicated, this is why I chose relays for my examples. The logic "gate" symbols (like the bottom one in your post) actually represent the gates, no matter the underlying technology. So, the relay OR gate in my answer is the same as the OR gate in your question, just that it only has two inputs. – Pentium100 Mar 25 '16 at 12:19
  • Okay, thank you. I think I have everything I need. – Musixauce3000 Mar 25 '16 at 12:42
  • @Musixauce3000 Logisim's transistors seem weird. I'd just use the gates. If I want realistic transistors there are programs designed to do that properly. – user253751 Nov 24 '17 at 06:57