How does an optical mouse work?

A `mouse' is a computer user interface device used to point out objects or items shown on a graphical user interface (GUI) or display.

It is called a mouse primarily because the cord on early models resembled the rodent's tail, and also because the motion of the pointer on the screen can be mouse-like. The main goal of any mouse is to translate the motion of our hand into signals that the computer can use.
The mechanical mouse contains a ball which partially protrudes from the bottom surface, so that the ball rotates as the device is moved, internally actuating two pick-up elements which convert the motion to its `x' and `y' components and sends impulses to the computer that causes a mouse-responsive program to reposition a cursor on the display screen.

In principle, an optical mouse does not differ from a mechanical mouse, even though the functional principle differs. Ituses camera technology and digital processing to compare and track the position of the mouse.

It has a camera installed in the bottom. Pictures counting about 1500 per second are taken by bouncing light from a small, red light-emitting diode (LED) off the surface under the mouse, and onto a complimentary metal-oxide semiconductor (CMOS) sensor. The sensor sends each image to a digital signal processor (DSP) for analysis. DSP compares the pictures and determines the speed and direction of movement and sends the corresponding coordinates to the computer.
Optical mouse has several benefits over wheeled mouse. It has less wear due to elimination of moving parts. Grime accumulation on ball and rollers is thus eliminated.
It does not require a mouse pad and can be used on many surfaces, including those that are not entirely flat. But they cannot be used on glass or reflective surfaces without a mouse pad.
Sensing is more precise. The increase in tracking resolution results in a smoother response. They may even reduce repetitive stress injury.

A wireless mechanical mouse may draw an electrical current of 5mA or less, whereas an optical mouse typically draws 25mA to power an LED.