The widespread use of power converters and nonlinear loads connected to the grid have caused the emergence of problems regarding the power quality. Among different kind of non-linear distortion, there is the issue of the DC current component. In fact, a DC current component flowing in the grid transformers has various detrimental effects, i.e. increased harmonic distortion, increased power losses, and possible damage due to consequent overheating. This paper proposes a non-linear sensor and a compensator system that act as an active filter to remove the DC current component flowing in the power lines. In the first part, the strategy is outlined and then the stability issue is addressed by means of a simplified model. Simulation results confirmed that the simplified model closely approximates the real system. An approximated analysis of stability is also presented. Finally we present some experimental results that shows the effectiveness of the proposed solution.