Advanced control of pH