Encoder for a fluid dispensing system, the encoder comprising: a magnetic sensor for detecting a rotational angle (ω) of a rotary member around an axis of rotation; a magnet for generating a magnetic field (H 0), the magnet being arranged on the rotary member so that the magnetic poles (312, 314) generate a magnetic field perpendicular to the axis at the magnetic sensor about which the rotary member rotates; wherein the magnetic sensor comprises at least a first and a second magnetic sensing element (210, 220), the first magnetic sensing element configured to generate at least a first output signal, and the second magnetic sensing element configured to generate at least one second output signal, wherein the output signals are indicative of a sensed magnetic field associated at least in part with the magnet, wherein the magnetic sensing elements (210, 220) and the magnet are arranged at predetermined distances from one another centered on the axis of rotation; a controller responsive to the first and second output signals and configured to generate an encoder signal indicative of the rotational angle (ω); wherein the controller is further configured to compare at least one of the first and second output signals to a first and second predetermined threshold value (limit 1, Iimit 2), respectively, associated with the predetermined distances, respectively, and to calculate field angles of the first and second output signals wherein the controller is further configured to calculate a difference of the field angles sensed by the first and second magnetic field sensing elements, and to compare the difference with a third predetermined threshold value (limit 3), and wherein the first and second predetermined threshold values (limit 1, limit 2) correspond to a minimal strength of the magnetic field sensed by the first and the second magnetic sensing elements, respectively, and wherein the third predetermined threshold value (limits) is indicative of a maximum admissible external disturbing magnetic field acting on the first and the second magnetic sensing elements; wherein the controller is further configured to generate an error signal if a result of at least one of the comparisons to one of the predetermined threshold values (limit 1, limit 2, limit 3) indicates a tamper attempt. a magnetic sensor for detecting a rotational angle (ω) of a rotary member around an axis of rotation; a magnet for generating a magnetic field (H 0), the magnet being arranged on the rotary member so that the magnetic poles (312, 314) generate a magnetic field perpendicular to the axis at the magnetic sensor about which the rotary member rotates; wherein the magnetic sensor comprises at least a first and a second magnetic sensing element (210, 220), the first magnetic sensing element configured to generate at least a first output signal, and the second magnetic sensing element configured to generate at least one second output signal, wherein the output signals are indicative of a sensed magnetic field associated at least in part with the magnet, wherein the magnetic sensing elements (210, 220) and the magnet are arranged at predetermined distances from one another centered on the axis of rotation; a controller responsive to the first and second output signals and configured to generate an encoder signal indicative of the rotational angle (ω); wherein the controller is further configured to compare at least one of the first and second output signals to a first and second predetermined threshold value (limit 1, Iimit 2), respectively, associated with the predetermined distances, respectively, and to calculate field angles of the first and second output signals wherein the controller is further configured to calculate a difference of the field angles sensed by the first and second magnetic field sensing elements, and to compare the difference with a third predetermined threshold value (limit 3), and wherein the first and second predetermined threshold values (limit 1, limit 2) correspond to a minimal strength of the magnetic field sensed by the first and the second magnetic sensing elements, respectively, and wherein the third predetermined threshold value (limits) is indicative of a maximum admissible external disturbing magnetic field acting on the first and the second magnetic sensing elements; wherein the controller is further configured to generate an error signal if a result of at least one of the comparisons to one of the predetermined threshold values (limit 1, limit 2, limit 3) indicates a tamper attempt.