How do I make a rain detector on Minecraft?

You don't need one. There's this beautiful command called /weather clear. You can even specify for how long you want the weather to be clear. You can just run /weather clear 999999 each in-game day (employing a simple daylight sensor), and you will have no rain.


You can do more than that. You can disable the rain completely.

In Options -> Video you can disable rain particles (so it will rain, only you won't see it), AFAIK it is in Animations or Particles submenu.

Or you can use daylight sensor, because rain means drop in light -> weaker redstone signal, what you can make to start your redstone circuitry.

An active daylight sensor: powers adjacent redstone dust, including below it, and redstone comparators facing away from the daylight sensor, to a power level that depends on the time of day, the weather, and the daylight sensor's sky light level (see tables below) http://minecraft.gamepedia.com/Daylight_Detector

Rain means drop in light by 3.

And remember that you can rather use /weather clear [seconds] , so the nice weather will be long enough.


For a true rain detector, I've seen a few designs that use snow golems (which die in rain) on pressure plates. But for a more reusable design, I like this one, which uses fire:

EDIT According to @Mystery, this works in the following way: "The two comparators are used as a countdown. If the fire extinguishes, the countdown starts. If it extinguishes a second time before the countdown is over, the light will turn on. The time, the fire naturally stays on is larger than the countdown time. Only rain will cause it to go out that frequently." (Thanks, Mystery, for explaining!)

EDIT2 Now that I understand it, let me see if I can go into a bit more detail.

The piston and its adjacent redstone block/circuit are a BUD switch, which toggles between on and off whenever a block update happens near it (such as a fire being lit or extinguished). Every time it toggles on, it sends a signal into the line above the two opposite-facing, side-by-side comparators. Because the comparators keep the signal strength coming out of them the same, the redstone will naturally decay by 1 per cycle around that loop (because the ledge has 2 blocks to travel, but the comparator will only maintain strength for 1). This creates a "cooldown timer", by which the torch on the side of the ledge will stay off a bit longer than the pulse; whenever the BUD trips, it resets the circuit, keeping the torch off even longer.

The comparators on the left side are similar in that they create a fade-out timer. The only difference is that the signal from it is controlled by the torch on the ledge, and it's maintained one block longer with the second comparator. So when the torch is off, the lamp will stay on for a short while until that circuit dies out. The key is that the first circuit in the middle naturally decays at the same rate as the one on the left. That means after a single pulse of the BUD, as soon as the light would turn off, it's reset by the torch and kept on. However, if the torch keeps getting held off--say, by many BUD trips occurring in a short timespan because the fire keeps going out and getting re-lit by the dispenser--it'll give the left circuit time to fade out, and the light will turn off. As soon as the rain stops, the fire lasts longer between BUD triggers, giving the first circuit time to turn off, which turns the left circuit back on and lights the lamp again.

I hope that helps! (Of course, in your case, just replace the lamp with command blocks to turn off the rain.)