An optical pH sensor