Magnetic Encoder : Working, Interfacing, Advantages, Disadvantages & Its Applications

Encoder is an electromechanical device used to give feedback to control systems regarding the object’s motion. So this feedback simply allows the control system to set up whether the object being checked is being properly positioned or moved or not and proper actions to be taken depending on the position & movement of the object. Generally, encoders play a key role in measuring single or more particular object parameters like; position, direction, speed, object count, etc. Encoders are available in different types like optical, incremental, absolute, capacitive, magnetic, increment, and linear encoder. This article provides brief information on one of the types of encoder; magnetic encoder which provides a basic working, and its applications.

Magnetic Encoder Definition

A rotary encoder that uses a signal detection system depending on the magnetic flux variation produced by a magnet located in the rotation before a sensor, generally fixed to the shaft of the encoder is known as the magnetic encoder. The magnetic field variation can be sampled through the sensor & changed into an electric pulse, to determine the position. This encoder is designed mainly to provide consistent digital feedback within the most demanding application environments. These encoders use magnetic field changes as the detection method to make them much more consistent within polluted environments.

Magnetic Encoder Working
Magnetic Encoder Working

A magnetic encoder has a permanent magnet & a magnetic sensor where the permanent magnet is connected to the motor shaft & the magnetic sensor is connected in a state where it gets the magnetic field produced by the permanent magnet. Whenever the magnet connected to the motor shaft turns, then the detected magnetic field by the magnetic sensor will be changed, thus the encoder will detect the rotating position as well as the motor shaft’s speed.

Magnetic Encoder Working Principle

A magnetic encoder works by using a sensor to recognize changes within the magnetic field from a rotary magnetized ring or wheel. A magnetic encoder includes three main components like sensing circuit, a rotating wheel, and a series of magnetic poles approximately the boundary of the wheel.

Whenever the wheel rotates past the magnetic sensor, the poles can cause an expected reply within the sensor depending on the magnetic field’s strength. The magnetic response can be fed throughout a signal conditioning circuit & provides a digital signal as an output to the controlling device.

To determine the magnetic encoder’s resolution, all the magnetized pole pairs above the wheel pole, the kind of electrical circuit, and the number of sensors work together. The key to utilizing magnetism as the element to generate a signal is that it is not affected by extremely demanding environments like; moisture, extreme temperatures, shock & dust.


Magnetic Encoder IC

KMA36 is a universal contactless magnetic encoder IC used for reliable & precise measurements. This IC provides a sleep-reduced power mode over I²C. Additionally, programmable parameters provide users access to a broad range of design options to give the maximum freedom & functionalities. This IC is used as both a rotary and a linear position sensor, so it has a huge air gap tolerance.

Generally, the KMA36 IC is mainly designed for magnetic field angle measurement. This characteristic is normally used for rotating measurements, but linear measurements are also achievable. This results from the fact that over the length of the magnet, the magnetic field rotates by 180°. So, when the magnet is moved linearly, the KMA36 recognizes this magnetic field rotation. The sensor signal can be received as an I²C or PWM signal.


The main benefits of KMA36 magnetic encoder IC include; it is available in a small TSSOP package, I²C Interface, digital output, up to 0.01° high resolution, AMR technology, and rotational/linear measurement mode.

The applications of KMA36 magnetic encoder IC mainly include; industrial motors, robotic surgery, industrial automation, industrial robotics, vending machines, agricultural machines, robotic dialysis equipment, radiotherapy equipment, and industrial process control.

Magnetic Encoder Arduino

The magnetic encoder interfacing with the Arduino board is shown below. This interfacing helps in measuring angles with no contact. Here the magnetic encoder IC used is AS5600. This is a 12-bit non-contact angle measurement IC that depends on magnets with 0.3 to 8 millimeters distances. The main features of this encoder IC are;

Magnetic Encoder Interfacing with Arduino
Magnetic Encoder Interfacing with Arduino
  • 12-bit resolution with 2.54mm pitch
  • It has a neodymium magnet.
  • The power supply voltage is 3.3V/5V.
  • This allows non-contact angle measurement and outstanding reliability & durability.
  • Its sampling time is 150μs.
  • It reads the values even whenever the center of the AS5600 axis & neodymium magnet is off through about 1mm.
  • This board size is W20 x D13.5 mm and the magnet size is φ6 x 2.5 mm.
  • Magnetization is diametric.

The required components to make this interfacing mainly include; Arduino UNO R3, AS5600 magnetic encoder, breadboard, and jumper cable. The connections of this interfacing follow as;

The VCC pin of AS5600 is connected to the 5V pin of Arduino UNO R3.
The GND pin of AS5600 is connected to the GND pin of Arduino UNO R3.
The DIR pin of AS5600 is connected to pin 2 pins of Arduino UNO R3.
The SDA pin of AS5600 is connected to the A4 pin of Arduino UNO R3.
The SCL pin of AS5600 is connected to the A5 pin of Arduino UNO R3.


#include <Wire.h>

#define AS5600_ADDRESS 0x36 // AS5600 I2C address

void setup() {




void loop() {

  // Request 2 bytes of data from AS5600 (angle register)

  Wire.requestFrom(AS5600_ADDRESS, 2);

  // Read the received data

  if (Wire.available() == 2) {

    int highByte =;

    int lowByte =;

    // Combine the high and low bytes to get the 12-bit angle value

    int angle = (highByte << 8) | lowByte;

    // Map the 12-bit angle value to a full 360 degrees

    float degrees = map(angle, 0, 0xFFF, 0, 360);

    // Print the angle to the Serial Monitor

    Serial.print(“Angle: “);


    delay(500); // Add a delay for readability



Once the above code is uploaded, it will show the value of the angle on the serial monitor. Whenever the magnet revolves the angle value will be changed.

Advantages & Disadvantages

The magnetic encoder advantages are discussed below.

  • The main benefit of magnetic technology is the absence of contact in the detection system, which helps prevent wear and it’s therefore quite convenient in terms of costs since it doesn’t require maintenance and has a potentially infinite durability.
  • This encoder size is compact.
  • These are extremely reliable because of their simple electronic design that eliminates the requirement of batteries or mechanical gearing found in earlier generation absolute encoders.
  • Magnetic encoders need less maintenance & their lifespan is longer.
  • These are more cost-effective.
  • These encoders do not break and their installation is simple.

The magnetic encoder disadvantages are discussed below.

  • Magnetic encoders are vulnerable to magnetic interference caused by electric motors.
  • These encoders have a limited operating range of temperature.
  • These types of encoders usually deliver lower accuracy & resolution as compared to capacitive & optical encoders.


The applications of magnetic encoders include the following.

  • Magnetic encoders are used in applications that need high shock, vibration resistance, broad temperature specifications, contaminant protection & robust sealing while providing downtime reduction & output signal reliability.
  • Magnetic encoders are used for providing position & velocity feedback in pulp, steel, lumber & paper mills.
  • These encoders are suitable particularly for heavy-duty applications that need high speed, robustness, a wide variety of operating temperatures, and outstanding reliability in signal generation.
  • These types of encoders are used frequently in robotics as well as printing applications.
  • These encoders are suitable to utilize in environments with lots of oil, water & dust like industrial sewing machines & machine tools.

How accurate are magnetic encoders?

Magnetic encoder with the AK7455 14-bit angular rotation sensor achieves 0.5° accuracy within a shaft-end configuration.

What is a magnetic shaft encoder?

The magnetic shaft encoder detects the information of the rotating position when the magnetic field changes and converts them into electrical signals as an output.

Thus, this is an overview of a magnetic encoder that detects rotating position data when the magnetic field changes & converts them into electrical signals. Here is a question for you, what is the optical sensor?