Guide A reference guide for simple logic devices

DRKV

Wall of Flesh
I have compiled a little guide that demonstrates the function of various simple logic gate devices. You can combine these in different ways to create all sorts of mechanisms. I constructed the guide in a “logical” order, first walking you through the most basic concepts, and then building up more complicated setups.

Before reading this, you should be familiar with how logic gates and wiring works in general. If you're in doubt, I recommend you read: [Guide] Logic Gates: Order of Operations, Smoke and how to prevent it

I have 3 images for each device. A gif demonstrating usage in real time, a picture with the wires shown, and a step-through I did using MechScope.

As a side note: all of the gates I used here are AND gates. You really don’t need the others too often…

sm0z34g.png

Signal manipulation
sm0z34g.png
Diodes


Single lamp diodes are often used for purposes such as:
  • Transferring a signal to a different wire color
  • “Delaying” a signal by one logic gate execution step to change to order in which other gates get triggered
  • Controlling the direction of signals, acting as a diode
  • Limiting the number of signals that pass through (more on this later)
lAPptr4.gif
uTnGB10.png
ygzFlUV.gif

Timer delay

This setup lets you delay a signal by up to 5 seconds. You generally can’t make a timer just turn itself off, so here we trigger a logic gate, which in turn will switch the timer off.

To create longer delays you can create a timer cascade or use some form of counter. More information about this is available in this thread: Guide - Timer Cascades with Logic Gate Control

KTZ5hlj.gif
eKKLrac.png
rhnnbXR.gif


The doubler

Logic gates will only trigger once per wiring iteration. If their output value is change again, they will just emit a puff of smoke and nothing else will happen. This can be abused to make all sorts of logic possible. Here, we use them to immediately generate a second signal if the red wire gets triggered. Two consecutive signals like can be very useful to get other logic gates to do what you want them to.

g9zc8eL.gif
ZhCJK4V.png
zc0xjdD.gif


Limiting signals

Running a doubled signal (or pretty much any number of signals) through a diode will only let the first one through, turning it back into a single signal.

WQ5Wp0W.gif
Rnpng6B.png
CsHtJuk.gif


Tripler


You can combine signals from different logic gates to get more triggers. This setup will triple the input.

NP73Sgx.gif
BQOWMYP.png
spHePe2.gif



sm0z34g.png

Transistors
sm0z34g.png

In terraria’s signal based wiring, Boolean AND gates are not necessarily very useful. What we really want, is the ability to kind of “gate” a signal. Let it through at certain times and stop it at others. You can’t achieve this in terraria with just a simple AND gate. For instance, if your “gate” and your “trigger” lamps are both ON, switching the gate OFF will create an output, which we don’t want.

rl618eV.gif


Faulty transistor

Faulty gates, when their faulty lamp is triggered, will generate a signal with a probability determined by the ration of ON gates to OFF gates. If the lamp here is ON, we get an output with a 1/1 chance, when it’s OFF we get it with a 0/1 chance. This effectively acts as a transistor. The state of the lamp (the base) determines whether the signal can pass from the faulty lamp (the collector) to the gate’s output (the emitter).

BjML24L.gif
URjkeJt.png
DGoEh8i.gif


LggFSfE.gif


Smoky transistor

There is another way to create transistors. The problem with using just AND gates, is that the state of the collector lamp will affect its behavior. When the lamp is OFF things are fine, but once you turn it ON, toggling the base can cause problems… So let’s just keep the collector OFF… By doubling the input signal before sending it to the collector, we immediately switch the collector lamp OFF after it turns ON. We don’t get a second output signal by doing this, because the two triggers both happened in the same iteration. The second one will only emit a puff of smoke.

ln9Hygv.gif
JEowtWC.png
nDxKfTN.gif


The big advantage of smoky gates, is that you can add multiple lamps to it, to AND them together. With faulty transistors you need to add an additional AND gate for that.

4f3hY5q.png
TGoI6ou.png


sm0z34g.png

Simple devices
sm0z34g.png
Reset switch

This device can be used to reset a toggleable device to a certain state. Once the transistor is triggered, it will turn its own lamp OFF and whatever is attached to it as well.

drTXOuT.gif
DvRkHLq.png
TjkJEp0.gif


Reset switches can be easily stacked next to each other to create compact designs.

1NkpcJb.gif
uSuT6Vx.png
fNxJIes.gif

Inline reset switch

This is a different reset switch that relies on smoky logic instead of faulty gates. Their big advantage, is that you can run a wire straight across them vertically. This allows this setup to have the switches above the gates instead of having them on the bottom.

gAJ3n6I.gif
mE9dt4E.png
MGMJyvh.gif


Signal based NOT gate

So, a traditional NOT gate makes pretty much no sense in terraria. Wires don’t have a state, so there is nothing to negate. This little thing is what I would call a signal negator. It creates an output, if the top input is triggered without triggering the input on the side first. You can make something happen, if something has NOT happened before triggering it.

YwlCvVA.gif
mrvpGJq.png
OkmPmxe.gif


Flip-Flop

Again, this is not really a flip-flop in a traditional sense. It will switch the input to two different outputs. First to the left, and then to the right.

5p8c3VH.gif
O2n4kGN.png
0mHyRnl.gif


Reset-Set

Triggering one of the inputs will toggle the output. Hitting that same input again will do nothing, you have to use the other one instead, which will then also block and you need to hit the first one again. This can be used set up something to only happen once, like a pitfall trap, but you can also add a reset switch to them.

t3Sivc3.gif
J7Fr9Va.png
N8XYCKL.gif


You can also hook up two different outputs to this one, like with the flip-flop.

sm0z34g.png

Binary counter
sm0z34g.png

Just like the name suggests, these devices will gradually increment a number in base two. This can be useful if you want to wait until something, like a timer for instance, has triggered some number of times.

Divide by two

The main idea behind these, is to make a gate, that will only output once for every second signal it receives.

LC6VjWa.gif
NdFio36.png
OaYkJid.gif


The counter

Once you can divide a signal by two, you can also divide it by 4, 8, 16 and so on. You can just chain these dividers together, to translate the number of pulses the devices received, into a binary number.

oAk3TVK.gif
Go05zlR.png
DRCw7ss.gif



sm0z34g.png

Shift register based counters
sm0z34g.png

Quite often you want to send a signal from a wire to different devices, one after the other. You can use this to do all sorts of things, like to make scrolling light displays, wait for some number of inputs, or to “move” a light or selection left or right.

The shift register

All you need to do, is link up a bunch of self-resetting transistors to each other’s enable lamps, and common the triggers together.

a4XQaKJ.gif
9Xn3ASE.png
hmcxh55.gif


You’ll notice, that the lights hooked up to the output of the device don’t really seem to “shift”. (It kind of looks like the output of a Johnson counter.) That is because we are only sending one signal to each of them. We also want to turn them OFF, once the next output is triggered. So all we have to do, is hook up the output of two consecutive segments to each torch.
You can also connect the end of the counter to the beginning to create a circular counter.

AjrKHtk.gif
qveIZWi.png
e99w5f9.gif


If you want to connect this up to something more complicated, you should switch the torches for some diodes, and then you only have to run one wire per stage to your output.

Sequencer

If you hook up different inputs to all of the segments on the shift register, you can use it to check if something happened in a certain order. You can use this to make a simple password lock mechanisms.

HMRtQzt.gif
j0vaFuV.png
KxXKP73.gif


Compact resettable counter

You can skootch the segment of the counter closer, but then you need to use three different wire colors. This also makes wiring anything useful to it quite difficult, but you can still use it for a timer. We can however easily connect a reset array to it, thanks to the inline reset switch.

tnsGkcs.gif
za6eg5P.png
55xkRq5.gif


(As a side note, using these counting and signal doubling techniques, it is possible to shove multiple signals down a single wire. I think this is a very interesting idea, that is worth checking out: PC - Serializing data - save wire, space and nerves)

sm0z34g.png

Conclusion
sm0z34g.png
Now you can just put a bunch of these devices together to create some more interesting things. For instance, here is a simple little password lock. (As you can probably tell, I kinda like password locks…)

DkQW1I4.gif
WcBxAAA.png

ABYuqzo.gif
atucChy.png


You can then, instead of hard wiring the code, add in some extra transistors to check if the right digit was entered. Then have a way to reprogram those transistors to change code. Then maybe add a more elegant reset mechanism and some kind of different way of entering the code, and you get something like my Reprogrammable rotary lock: PC - [Showcase] Reprogrammable rotary lock Same idea, jut scaled up.
 
Last edited:
https://imgflip.u/i/36x57o
Really great contraptions. It seems like teal pressure pads can do quite a few of them, but they each have things not done by the other. Of course, they seem to use each other quite a bit. Tp put it briefly, well played, Logic gate person. I hope you figure out something fancy.
 
https://imgflip.u/i/36x57o
Really great contraptions. It seems like teal pressure pads can do quite a few of them, but they each have things not done by the other. Of course, they seem to use each other quite a bit. Tp put it briefly, well played, Logic gate person. I hope you figure out something fancy.
I'm not a huge fan of the whole teal-pad-dart-trap thing, mostly just because of the cooldowns, and how slow they are in general. Though, stuff like this, is pretty difficult to beat: PC - [Question] Weird Mechanics of Dart Traps and Teal Pressure Plates ;)
 
Hey, I got a little issue with something i'm trying to do here, and I thought you could help me out: I'm trying to synchronize the fireplace and chimney so when I turn the fireplace on, the chimney turns on. The problem is that the fireplace has 2 states (on/off) and the chimney has 3 (off/no smoke particles/yes smoke particles). It looks like the devices you made here are the right thing for the job, but I don't know how to put them together. Can you maybe send me a screenshot of a wiring mechanism that could help me? Thanks. ;)
 
From the on state, fireplace and smoke(no particles):
Capture 2019-11-24 08_47_18.png

Flick the switch, both should be off now and lamp in the on state:
Capture 2019-11-24 08_47_28.png

Pickaxe the on lamp to remove it and the faulty lamp above it:
Capture 2019-11-24 08_47_47.png

Flick the switch, state should be fireplace and smoke(no particles) again:
Capture 2019-11-24 08_47_58.png

Place the lamps back on, state should become fireplace and smoke(particles):
Capture 2019-11-24 08_48_16.png

Should be done now.

This is turned out into a kind of an interesting lesson/example for me on why you don't make changes to electrical circuits with the power still on. Changing this would have been so much easier with adding more temporary switches to change states and cutting wires so changes to circuit don't affect the operated devices, but I figured that'd be more annoying to step by step
 
From the on state, fireplace and smoke(no particles):
View attachment 230373
Flick the switch, both should be off now and lamp in the on state:
View attachment 230374
Pickaxe the on lamp to remove it and the faulty lamp above it:
View attachment 230375
Flick the switch, state should be fireplace and smoke(no particles) again:
View attachment 230376
Place the lamps back on, state should become fireplace and smoke(particles):
View attachment 230377
Should be done now.

This is turned out into a kind of an interesting lesson/example for me on why you don't make changes to electrical circuits with the power still on. Changing this would have been so much easier with adding more temporary switches to change states and cutting wires so changes to circuit don't affect the operated devices, but I figured that'd be more annoying to step by step
Wow, thanks! Terraria electrical mechanics seem a lot more complicated to me compared to minecraft redstone. I wish I understood how this stuff worked. :p
 
Back
Top Bottom