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 meant for low-voltage DC projects are quite delicate. That makes them unsuitable for applications that need to withstand heavy-handed 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 that you can steal, which repurposes plumbing valves as analog inputs.
Plumbing valves like the kind shown in the video contain either knobs or levers that gradually open interior gates to increase water flow. Like a variable resistor, they allow for many “values” (water flow rates) between LOW and HIGH (closed and open). One could measure the water flow rate through a valve connected to the type to get a value, but that is complicated and messy. Alistair’s method is far more elegant: measure light intensity through the valve.
This setup 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 the light that reaches the photoresistor increases as the valve opens. By measuring the resistance of the photoresistor with your Arduino’s analog pin, you get a value proportional to the valve’s openness. 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 inputs 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.
Read more about this on: Arduino Blog