This Lamp Emulates a Touch Sensor with a Microphone
Double tap to change color, triple tap to turn it on/off, and quadruple tap to enter Hue mode.
YouTube hacker “peterbiglab” wanted a color-changing desk lamp, but didn’t want to use something as primitive as buttons, or even clap sensing as an interface. Instead, he decided to make it detect light taps on the diffuser surface.
Upon first glance, a capacitive sensor seems like the obvious choice, but that would restrict the tapping surface, and he wanted the electronics to be relatively simple. Rather, he chose to use an inexpensive electret microphone that hears the tapping noises, thus acting as an improvised touch sensor.
While the mic by itself can produce electrical signals from the input tap noises, the actual voltage produced initially was very low. This was fixed with an op-amp to pull the signal up to a single volt or so, which was fed into an Arduino Nano’s analog input. Perhaps not as simple as he’d first imagined, but certainly a very useful input option to consider.
Of course, the caveat here is that the device can also sense music or movements, so ‘biglab implemented a recursive function that's able to filter out anything where there’s no discreet tap-pause-tap pattern. As seen in the video, it appears to work well — cycling through colors via its WS2812B LEDs with two taps, switching off with three, and entering Hue mode with four.