A method for determining the alkalinity of an aqueous sample using an alkalinity sensor and performing electrochemical titration, comprising: providing an electrochemical cell comprising two compartments (13, 14), wherein a first compartment contains a first boron-doped diamond electrode and a second boron-doped diamond electrode for measuring pH, whereby an electrical current is applied to the first and second electrodes to generate hydronium ions and measuring pH, and wherein a second compartment comprises a reservoir containing a reference electrode and a noble metal counter electrode, the reservoir being connected by solution via a restricted path conduit to the first compartment, whereby the aqueous sample is introduced into the first compartment by means of a peristaltic pump and is transferred to the second compartment through the conduit; monitoring the pH of the aqueous sample introduced into the first compartment; generating hydronium ions, in the aqueous sample in the electrochemical cell, through the hydronium-generating first boron-doped diamond electrode; changing the pH of the aqueous sample through generating an amount of hydronium ions in the aqueous sample; quantifying and converting a current or charge to the number of hydronium ions produced to an end point of the electrochemical titration, the end point correlating to the alkalinity of the sample; and analyzing the alkalinity of the aqueous sample based on the generated amount of hydronium ions and the resulting change in pH monitored by the pH measuring electrode, wherein the pH measuring electrode, the hydronium-generating electrode and a controller are part of a bipotentiostat wherein the pH measuring electrode is a first working electrode of the bipotentiostat and the hydronium-generating electrode is a second working electrode of the bipotentiostat. providing an electrochemical cell comprising two compartments (13, 14), wherein a first compartment contains a first boron-doped diamond electrode and a second boron-doped diamond electrode for measuring pH, whereby an electrical current is applied to the first and second electrodes to generate hydronium ions and measuring pH, and wherein a second compartment comprises a reservoir containing a reference electrode and a noble metal counter electrode, the reservoir being connected by solution via a restricted path conduit to the first compartment, whereby the aqueous sample is introduced into the first compartment by means of a peristaltic pump and is transferred to the second compartment through the conduit; monitoring the pH of the aqueous sample introduced into the first compartment; generating hydronium ions, in the aqueous sample in the electrochemical cell, through the hydronium-generating first boron-doped diamond electrode; changing the pH of the aqueous sample through generating an amount of hydronium ions in the aqueous sample; quantifying and converting a current or charge to the number of hydronium ions produced to an end point of the electrochemical titration, the end point correlating to the alkalinity of the sample; and analyzing the alkalinity of the aqueous sample based on the generated amount of hydronium ions and the resulting change in pH monitored by the pH measuring electrode, wherein the pH measuring electrode, the hydronium-generating electrode and a controller are part of a bipotentiostat wherein the pH measuring electrode is a first working electrode of the bipotentiostat and the hydronium-generating electrode is a second working electrode of the bipotentiostat.