Geek Pocket Minecraft - Web Site Smaller Banner    Redstone Latches

Inverters are the building blocks of more complicated redstone circuits, as you learned in my page on inverters when we used an odd number of them in a loop to create a "clock" (pulser). What happens if we use an EVEN number of them in a loop? There is no imbalance, the signal stays still, and it's worthless, right?

Not quite. Which inverter is ON, the first one or the second one? There's actually two possible stable states. Because of this, the loop functions as a "memory" cell, or a "latch" as it is called in the electronics world.

Latch, Version 1: Observe the circuit below and the strategic placement of the "set" and "reset" buttons. When "set" is pressed, the connected redstone duct functions as an alternate sucker line for the lower-right inverter. This forces the redstone torch off, which then forces the other one on, which sends the loop into the alternate state, EVEN IF power to the "set" button is removed (which happens with the pushbutton). The reverse happens with the "reset" button.

Torch-only redstone latch version 1, off state Torch-only redstone latch version 1, on state Torch-only redstone latch version 1, simplified schematic

Latch, Version 2: Below is a more compact version of the same latch. Note that in order to make it work, some extra redstone dust is required on top of the anchor blocks (denoted by the extra red line on top of the inverter in the schematic). The reason is because the sucker line will align itself to point to the adjacent inverter's torch and thus NOT send the power to the anchor. The extra redstone sends the power both ways and on top of the anchor as well.

Torch-only redstone latch version 2, on state Torch-only redstone latch version 2, simplified schematic

Latch, Version 3: This latch below is my favorite, only because the SET and RESET lines are next to each other rather than on opposite sides, which is a lot more convenient when hooking up the latch to other things. In order to get this desired configuration, I used one of the special B-BT inverters. To make the T-B inverter work correctly, once again we need extra redstone dust on top of the anchor for proper alignment. Also interesting about this latch is that the B-BT inverter's torch is mostly hidden so we only see the "non inverse" latch state when looking at it.

Torch-only redstone latch version 3, on state Torch-only redstone latch version 3, off state Torch-only redstone latch version 3, simplified schematic

The Quest For a Toggle Latch: The reset/set (RS) latches above are cool, but sometimes the separate reset/set lines are awkward. There is another kind of latch called the toggle (T) latch. It only has one input. When it goes from OFF-to-ON, the memorized latch state is toggled - i.e., if it was OFF, it goes ON, and if it was ON, it goes OFF. Nothing happens when it goes from ON-to-OFF. There are lots of uses for a toggle latch. One use is for a light switch operated by a pushbutton. Press it once, and the light goes on. Press it again, and the light goes off. Another use is a counter. Each time the input changes twice (OFF to ON then ON to OFF), the toggle latch changes only once. So it can "count" the number of OFF-to-ON pulses. You can chain multiple T latches together to count longer cycles. Or you can use one or more T latches to create much slower clocks.

All this sounds REALLY cool, but the problem is that it's difficult to make a T latch in Minecraft Pocket Edition. At least it is without data latches which were added in 0.14.0. In the interest of studying circuits, I'm going to try to do it with inverters only first. This means that the circuits are going to start to get really large, and Minecraft PE will become less of a survival game and more of a Minecraft-themed circuit emulator. Some people enjoy this, though (that is, the ability to create complicated gadgets and watch them work automatically). If you're one of those, read on!

Demultiplexer: In order to create our toggle (T) latch, we first need a demultiplexer. This is a circuit with two inputs and two outputs. One input is the signal you want to pass on (OFF or ON), and the other is what side you want the signal to go to (LEFT or RIGHT).

If you look at the circuit diagram below, the trick is the extra inverter in the middle. Take it away, and you simply have two repeaters. But the extra inverter provides an alternate signal source for the T-B inverters. If the extra inverter's output is ON, then it FORCES both T-B inverters OFF. Otherwise, there will be one ON output based on the state of the LEFT/RIGHT input.

But an even better, equivalent way of thinking of it is like this: The middle input is the ON/OFF, and it goes to either the LEFT or RIGHT side based on the state of the other input.

Torch-only demultiplexer, right + off setting Torch-only demultiplexer, right + on setting Torch-only demultiplexer, simplified schematic

Torch-only demultiplexer, left + off setting Torch-only demultiplexer, left + on setting

Imperfect Toggle Latch: The demultiplexer can be hooked up to the RS latch to auto-switch between the reset and set lines. Then we can take the output of the RS latch and loop it around to the LEFT/RIGHT selector of the demultiplexer. In this way, if the latch is ON, we can turn it OFF next time, and if it's OFF, we can turn it ON next time.

Redstone toggle latch that works with momentary pulse, OFF state Redstone toggle latch that works with momentary pulse, OFF state Redstone torch-only toggle latch that works with momentary pulse, schematic

There is a FLAW with this design, though. If the trigger input is left ON too long, the revised RS latch output comes back to the demultiplexer and forces the RS latch to change state again... and this will continue until the trigger is turned off. So the trigger has to be left on for only a very short period of time, like with a momentary pushbutton or with a clock pulse on a very short cycle.

A better toggle latch would be one where the trigger could be left on an arbitrary amount of time, short or long, and still work perfectly. To see a perfect toggle latch, check out my counter project page.

This page last updated 02/19/2016. Web site content (C) 2015,16 Kevin Jay North. Free for personal use; do not copy to other websites without permission.
The Minecraft Pocket Edition game itself is owned, sold and distributed by Mojang. Builder Buddies is owned, sold and distributed by Robledo Software, LLC. This web site is not affiliated with Mojang or Robledo.