Thursday, October 13, 2011

Demo 2: The Idiot Trap

If you're wondering what you could use latches for, here's an example...
The set-up I'll show will do this: if someone goes into the left room and presses the S input button, the iron door closes and the redstone torch in the right room comes on. Someone pressing the R input will then shut the alert torch off and open the door again, releasing the person in the left room.

As with the previous demo, clay blocks are where full walls or floors would go, and white wool is mainly there so the redstone shows up nicely. In this demo, the blue wool represents where another wall would go, so I could show the boundary of the rooms without obscuring the wiring.

I labeled the images this time, so they should hopefully be fairly self-explanatory.
(No errors here, nope...)
A better view of some of the wiring.
There's a mistake here: The vertical "steps" that bring the R input line to ground level will cause a loop if you add in the blocks for the floor, rendering the input nonfunctional. The second step should be one to the right instead of one in front. I might fix the image eventually but not tonight.

And here's the back of the wiring that transfers the signal from the S input.
(If you're wondering why I went with the relatively complicated two-torches set-up here, the answer is that I was working on this way too late at night. It would work just as well with a set-up similar to the wiring from the R input, but with the second wool block one to the left instead of to the right.)
And this is just another alternative view of the wiring. The redstone torch placed along the middle of the inverse output line is placed pretty arbitrarily - it just needs to be somewhere along the line there in order to balance out the torch that's powering the iron door.

The title for this one is pretty much all in how you present it, of course...


For extra credit: add some pistons in the ceiling of the sucker room that are also connected to the inverse output, acting as floodgates and holding back flowing lava until someone presses the button.

Wednesday, October 12, 2011

RS NOR Latch: An Intro to Latches

I'll just be covering one latch in this post, and the next post should be a demonstration of one possible use for a RS NOR latch.

A latch or a flip-flop is a redstone circuit that effectively carries a single bit of memory - that is, it can hold an "on" or "off" state and hold it, instead of relying only on input at the moment it's given.
Latches typically have two inputs, one "reset" input and one "set" input - that is, one R and one S input.
Flip-flops add more complicated logic to a latch in order to change the way it behaves. I'll go into them at a later time.

All of these circuits are, at their core, built around the RS NOR Latch:
In this image, the top left lever is the "set" or S input, and the bottom right lever is the "reset" or R input. The top output - on the blue block - is the inverse output, and the green output is the uninverted output.
(Just for the record, you may not want to use levers - because they can both be set to "on" at the same time, they can cause some issues. Something like a button will work with less chance of error.)
In the state pictured, you can sit there pulling the R lever as much as you like and nothing will happen, the inverse output will stay on, and the uninverted output will stay off.
Flick the S lever on and then off, though, and the opposite is true - the uninverted output will remain on, and the inverted input will be off, no matter how many times you pull the S lever (or push the S button, walk over the pressure pad, whatever input you use...)
(This is why I really should've used buttons, by the way - if you pull the S lever and leave it on, then pull the R lever, it will mess the whole thing up. I used them mostly so that they're visible, but keep this in mind if you use this circuit!)

So there you go - this is the simplest latch. There's a variety of designs for it, as there are with most of the circuits we've covered so far, but for the moment I'll be sticking with this for the sake of consistency.
You can also have an RS NAND Latch, which would just be an RS NOR latch with inverters applied to the inputs and outputs.

Sunday, October 9, 2011

XOR Gates And Basic Clocks

Another gate this time, and an intro to clocks.

First off, the XOR gate! XOR is short for "exclusive OR". It has two inputs. If one of the two inputs is triggered, the output is triggered, but if both inputs are triggered at once, the output is off. You can think of it as "one thing or the other, but not both at once."

Then, of course, we have the inverse version of the XOR gate: the XNOR gate. As always, it functions the same way as the XOR gate, but the "on" and "off" states for the output are reversed.




Moving on, let's go over clocks! A clock (or clock generator) is, at its simplest, a circuit that constantly toggles between an on/off state. They can be very fast or slow, depending on the design used. They can be based on torches, pistons, redstone repeaters, among other things.
I'll just be going over a couple of simple designs to start with.

The rapid pulser (or possibly pulsar - I'm afraid the info is a bit inconsistent on this one) or 1-clock is very fast. It's so fast that the redstone torches burn out, but the redundancy allows the clock to remain functional.
It's fast enough that trying to use it for something like pushing a column of sand or gravel will result in some of the blocks "popping" and dropping on the ground.
Here's a video illustration of just how quickly it goes!


The 5-Clock is a slower, stabler design. It still goes at a decent pace, but it's slow enough that the torches don't burn out.

Clocks can be made faster or slower by adding more or less pairs of torches.

I'll come back to clocks at a later date - they can apparently be made much simpler using repeaters, but I think these illustrate the ideas better. (And I'm having trouble getting repeaters to actually function right now.)

Saturday, October 1, 2011

Demo 1: 2-Lever Door

Here's a demo of a use for an AND gate.
Clay blocks - excluding that one on the floor that I missed - are visible wall or floor blocks. White wool would not be visible in a finished set-up, but supports redstone wiring.

I was thinking vaguely of an adventure map when I set this up.
The two chambers on the left each have a one-way pressure plate triggered iron door as their entries and exits. As it is there's not much point to that, but if it were a real map you could set it up in a more interesting way. Each chamber contains one of the inputs for the AND gate.

When both input levers are switched on, the door to the right chamber opens. There's a path of redstone and torches leading to it to power the door - in order to power it properly in a way that's concealable, they have to end with a torch directly underneath the block that the door is on.

Here's an alternate view of the torch/wire trail to the door, in the off position.

And for good measure, an alternate angle of the two chambers with the levers, so you can see all the pressure plates.
All of the redstone in this set up is either between rooms or below floor level, so it's concealable.

(Updated this 10/03/11 to fix an error in the wiring leading to the door.)

Friday, September 30, 2011

More Simple Gates

Now that we've covered the basics, here are some more simple gates.

First is the OR gate. This is just like the basic I/O gate, but with more than one input. If at least one of its inputs is on, then the output is also on.

It doesn't matter how many inputs are in the on position for the OR gate: if at least one is on, then the output is triggered.

Next we have the NOR gate - this is the inverse version of the OR gate, like the NOT gate is to the basic I/O gate. Yes, this is going to be a pattern, and from here on out I'll just be referring to gates like this as the inverse version of whichever gate. You can always skip back to the first post if you forget what that means!
The NOR gate's output is powered off if one or more of the input switches is switched on.

Then we have the AND gate: its output is triggered only if both inputs are switched on.
If only one input for the AND gate is triggered, the output won't be triggered, but when both switches are pulled the output activates.

You're probably expecting it by now, but next is the inverse version of the AND gate: the NAND gate. It starts with the output in the on position.
And when both inputs are triggered, the output switches off.

Next up, even more logic gates!

An Intro - Input/Output Gates, NOT Gates

I'm going to assume that since you're here, you've played Minecraft and you want an explanation of how to use Redstone. I know there are other tutorials for this, but to be honest, I'm confused by them at this point. My goal here is to write a guide simple enough that even I can understand it.

So what is redstone, exactly?

Well, it's an in-game material and a terrible lighting source, but what we'll be using it for is designing circuits. I'll get into that in a moment, but first, some technical info on redstone:
Redstone wire (or powder if you prefer) can carry power, for a distance of up to 15 blocks. Powered redstone wire lights up, and as it approaches the 15-block limit it will grow dimmer, but will still be powered.
Redstone wire can be powered by levers, buttons, pressure plates, detector rails, and redstone torches.

So, more on circuits! A circuit is just the path that a charge takes through our redstone. Here are two very simple circuits, to illustrate.

This is an Input/Output (or I/O) gate. This is the simplest you can get. In this case, the input is a lever, and the output is a piston. When the lever is in the off position, the piston is also in the off position...
... And when the lever is switched to the on position, the piston is also in the on position. There are no delays.

You could also easily reverse the on and off positions of the output. To do this, you make a NOT gate: that is, a gate where the input being in a given position means the output is not in that position. In other words, an on input has an off output, and an off input has an on output.

I've illustrated this with the same lever/piston setup as before.

The addition of a second power source - the redstone torch on the other side of the block that our lever is on - changes things so that the output is powered when the lever is off...
... And when the lever is on, the redstone torch switches off and removes power from the piston.

(Notice that the redstone torch is placed on a side of the block that the lever is on? I'm pretty sure that's not meant to be necessary, but it didn't work when I tried this set-up with the redstone torch on the ground of the block it's occupying. I'm chalking it up to a bug for now since it doesn't seem to be that way in every tutorial I've checked.)

I think that covers the basics. My next post will cover some more simple gates. Once I've worked through the basics of redstone circuits, I'll be covering some projects that you can make using them - my current goal is an automated sugar cane farm.