Most of your Arduino projects will require inputs and buttons are always the obvious choice. But most of the buttons and switches on the market for low voltage DC projects are quite tricky. This makes them unsuitable for applications that must withstand heavy use. YouTuber Alistair Aitchison of Playful Technology designs interactive puzzles for escape rooms and knows a thing or two about building robust interfaces. He came up with an interesting technique you can steal that reuses plumbing valves as analog inputs.
Plumbing valves like the ones shown in the video contain knobs or levers that gradually open interior doors to increase water flow. Like a variable resistor, they allow many “values” (water flows) between LOW and HIGH (closed and open). One could measure the water flow through a valve connected to the type to get a value, but that’s complicated and messy. Alistair’s method is much more elegant: measure the light intensity through the valve.
This configuration is very simple: place an LED at one end of the valve and a photoresistor at the other end, with the openings sealed to prevent the intrusion of ambient light. The intensity of light reaching the photoresistor increases as the valve opens. By measuring the resistance of the photoresistor with the analog pin of your Arduino, you get a value proportional to the opening of the valve. If you only need a basic on/off switch, you can set a threshold value somewhere in that range. How you choose to use these plumbing valve inlets is up to you, but they have many applications even outside of escape rooms. They would work for everything from stereo volume control to very cool smart light dimmers, so your imagination is the only limit.