My delvings for a hands-free midi controller have been using infrared detectors. Whilst they work fine, the shape of them (rectangular) requires the ability to cut similarly shaped holes in the aluminium casing. Sadly, it seems almost impossible to do this easily and neatly.
So I’m now trying an ultrasonic detector, namely the HS-SR04 model, cheap as chips from China and more importantly, with round detectors, for which a drill bit can rout a suitable hole. The arduino code is essentially the same as the IR, except that there is one extra cable required. It’s working as before and I’ve added a switch to alternate between latching on/off and variable CC messages. The next step is to add a “freeze” button to hold the CC at a given value (like the airFX has).