Rotary encoder is an electro-mechanical device that converts the angular motion of shaft in a digital or analog code which depends on the rotational movement. It is also known as…