This paper focuses on a novel control algorithm and its implementation method for providing voltage compensation to the coil of an AC electromagnetic contactor during voltage sags. Firstly, a new diagnosis algorithm is designed for correctly and timely detecting the voltage-sag event. When this new algorithm is embedded in the voltage compensation circuit and in series with the AC core of the contactor, the abnormal disengagement of the contactor contacts during voltage sag event could be eliminated through several experimental results. Another one designing point is that the dynamic position of armature can only be determined by a simple estimation method. In addition, the estimated position of armature and the applied voltage and coil current are taken as inputs by a single-chip based controller and provide the compensation voltage as output if voltage-sag event occurs. The above-mentioned new algorithm has been implemented in the laboratory.