a controller for controlling the pump unit of an oil well includes a sensor having a first and second probe for placement in the flow of oil from the well bore . each of the probes contains a heater . a constant power source is selectively connected to one of the heaters . each of the probes also include a linear rtd at each of their tips respectively for generating a signal indicative of the temperature measured at each of the first and second probes . a control unit receives signals from the rtd &# 39 ; s and determines a flow rate therefrom . a pump control signal is generated in response to the flow rate , wherein pump control signal continuously varies a predetermined parameter of a pumping unit during operation of the pumping unit .