Design of an automatic drilling fluid measurement setup and closed-loop pH control