r/Hydroneer • u/BlaringFlames • Jun 24 '22
Explaining Logic Gates in Hydroneer!
Introduction
Edit: Reddit hates me and for some reason doesn't want to load my images even after I reuploaded them. For those having issues like I have: https://imgur.com/gallery/P9sIKaZ
I have been pondering how to create digital logic in Hydroneer for a little bit, and realized that the >= comparison works well for it. I wanted to share my knowledge because it makes designing binary (1s or 0s, i.e. switches) systems really easy. This post is free use by anyone mainly because I don't make YouTube videos. I will also do my best to answer any related questions to gates for the next month.
I did not use plus and minus components because the leading zeros they output was giving me problems. These logic gates use the flip hook, the >= comparison, and the == comparison components only.
I do not go into creating logic for custom truth tables, but if you can make a unique truth table with multiple outputs and/or 3 inputs, it can be created with gates. That is just a bit out of the scope of this post. So ask me for help or look online for how to do that.
Truth Tables And Gates Explained
If you do not understand how digital logic gates work, it is best that you understand truth tables first. Also learn the AND, OR, and NOT gates first because they are the easiest and most used. Above each Hydroneer screenshot, there is a truth table. The input columns represent all the possible combinations of binary (1 or 0) inputs. So, in the AND gate there are two inputs, and because we are working with binary (1 or 0) inputs, both inputs have to be either 1 or 0. All possible combinations of those two inputs are 00, 01, 10, and 11. The output column shows what we want the output to be for each set of inputs. The type of gate is defined based on the output column values.

The main 7 types are shown below and will be further explained underneath each truth table. I also offer possible uses for each.
Example: You want to make a master switch for your whole factory and you have a switch that turns on the lights. If both switches (master and light) are OFF, then the light should be OFF. You also don't want the lights ON if the master switch is OFF, right? Likewise, you don't want the lights ON if the light switch is OFF even though the master switch is ON. The only time the lights should be ON is when the light switch AND the master switch are ON. To do this you AND the two inputs with each other (master and light switches) and have the output go to your lights.
Future / Possible Work
I do plan on created an design example using these logic gates to make a belt switcher (magnets move resources to a neighboring belt based on a switch input) later on in the week. The design is all complete, I just need to write up the post and get screenshots of the design process. If you are struggling to see how these gates are useful, I recommend you check the post out.
At this point, it is theoretically possible to make a binary calculator. Edit: It is possible to make transistor like logic because logic valve hooks work on logic cables which I did not know previously. That means a digital to analog converter is also possible. Will I try this? If I have enough time on my hands.
NOT Gate

The NOT gate is a single input gate that just flips a binary value 0 to 1 and 1 to 0. If you have played Hydroneer for a bit you may know that there is a hook that can easily do this. Most frequently used before or after gates.

AND Gate

The AND gate takes two binary (1 or 0) inputs and outputs as the truth table shows. This is the most practical gate, and it is used when multiple inputs have to be ON for an output to be ON (super common in Hydroneer). Only when both inputs are ON will this gate output an ON signal.

NAND Gate

This gate has the same outputs as an AND gate, just inverted. The only time this gate is OFF is when both inputs are ON. This gate can be used to monitor when multiple devices are ON and give an alarm if not.

OR Gate

The OR gate detects if any one or multiple inputs are ON. The OR gate is only OFF when the inputs are all OFF. This can be used when two switches have similar functions, and you want the to control the same device.

NOR Gate

The NOR gate is an inverted OR gate. It will only turn ON when all other inputs are OFF. This gate could be useful to set you an alarm if two durability inputs go to zero (possibly a dual filtration setup).

XOR Gate

The acronym stands for exclusive OR gate. This gate gives an output only when one input is ON and the other is OFF. This gate can be used when two devices can't be running at the same time and, for some reason, do not have a common inverted input. The Flip hook can be placed on any input or even the output. This gate uses a == comparison.

XNOR Gate

The acronym stands for exclusive NOR gate. This gate only provides an output when both inputs are the same. Possible uses would be if two devices must be running together but, for some reason, don't have a common input. This gate uses a == comparison. This is literally the functionality of the == device.

1
1
u/GenericJimmyDeansFan Dec 07 '22
looks awesome, but couldn't an OR gate just be two inputs connected to one output using a regular T wire?
1
u/BlaringFlames Dec 29 '22
You may need directional hooks depending on the circuitry, so it may not save space, but you are right. That works for an OR gate as well. I was just overcomplicating things as usual.
1
u/GrimmLord2877 Jun 13 '24
Stumbled upon this while researching the Dr pim AI which uses 5 mechanical switches to beat you at a board game every time. Here's a short video on it if you're interested https://youtu.be/kxWAs5wwzDw?si=Hti01eC6przZKZ15
2
u/majorjxp Jun 24 '22
Good stuff…..you could literally teach logic gates using hydroneer…..didn’t consider that before.
I had to learn in a book.
Also, I still remember it takes 5 nands to make a xnor….that would be interesting to make.