In a current sensor using the compensation principle, in particular for measuring direct and alternating currents, wherein the current sensor includes a magnet core having a primary winding and a secondary winding, with a current flowing through the primary winding producing a primary magnetic field and a compensation current flowing through the secondary winding producing a compensation magnetic field, at least one magnetic field sensor detecting a total magnetic flux produced by the primary magnetic field and the compensation magnetic field and producing a sensor signal, and an amplifier device controlling the compensation current in response to a switched drive signal,
- an evaluation circuit is connected between the magnetic field sensor and the amplifier device and producing the switched drive signal in response to the sensor signal, said evaluation circuit comprising
- a first oscillator with a predetermined frequency that excites the magnetic field sensor,
- at least one resistor located at a point traversed by the magnetic field sensor current and generating at least one potential dependent on a current flowing through the magnetic field sensor,
- at least one comparator that converts the at least one potential into at least one digital signal having a discrete value by comparing the at least one potential with at least one threshold value,
- at least one counter measuring characteristic time values of the at least one digital signal at discrete values and discrete times,
- a digital controller, in particular a PI controller, that controls the magnetic flux to zero by using at least one of the measured characteristic time values, and
- at least one of a second oscillator, in particular for pulse-width modulation, and a sigma-delta modulator operating in a first or higher order for deriving the pulsed drive signal for the amplifier device.