The present disclosure generally pertains to a digital controller for surgical handpieces. The controller is programmable and configurable by software which may be used with a variety of types of handpieces. The controller is equipped with environmental sensors that detect pressure, humidity and temperature, and operational sensors that detect the angle and placement of the rotor of a motor. These sensors provide data used for testing and evaluating the function of the handpiece. A filter program is provided which removes electronic noise from collected data. The controller includes an electronic memory writer and reader to download firmware, control parameters for handpiece operation and read logged data from sensors to determine motor function. The sensor includes a hermetic enclosure constructed from a heat conducting material and that is non-ferromagnetic to allow communication between the trigger and controller.