Under strong sunlight, plants avoid photooxidation by quenching the excess absorbed energy. Quenching is triggered by PsbS, a membrane protein that is activated and deactivated by the light-dependent pH changes in the thylakoid lumen. The mechanism of action of this protein is unknown, but it was suggested that several glutamates act as pH sensors. However, the pK a of glutamate is several pH units below the physiological values in the lumen. Thus, how can PsbS sense the pH of the lumen, and how does it respond to it? By applying a nonstandard molecular dynamics method that treats pH explicitly, we show that the lumen-exposed glutamates of PsbS have strongly shifted pK a values and that such shifts are crucial for the pH sensitivity in physiological conditions. We also demonstrate that protonation drives a systematic unfolding of a region key for protein-protein interactions, indicating that PsbS response to pH is a functional conformational switch.