Function
The main function of an optical grating is to disperse any light that is shone on it, much like a prism. Dispersion is a scientific phenomenon in which a beam of light is separated into different wavelengths that travel in different directions, so each wavelength of the light beam can be seen as a separate color, as they are seen in a rainbow.
Types
Several different types of optical gratings exist, but they can all be classified as either reflection gratings or transmission gratings. The key difference between the two is the way in which they disperse the light beam into individual wavelengths. Reflection gratings are typically coated in metal, like a mirror, to reflect the light beam back at its source. Transmission gratings, on the other hand, work more like a lens, allowing the light beam to pass through the grating.
How Optical Gratings Work
Optical gratings can be thought of as a collection of small openings, much like a sewer grating but a hundred times smaller. Shining a beam of light into an optical grating causes each of the tiny openings, or corrugations, to act like a wedge between the individual color wavelengths. These "wedges" cause the wavelengths to split apart from each other and travel off in different directions.
Uses
Optical gratings have a variety of uses in both scientific instruments and everyday electronics. Scientifically, you can use them in many light-measuring instruments, particularly spectrometers that analyze very short light wavelengths like ultraviolet light and x-rays. You can also use them in many household optical devices, such as CD players and DVD players. In fact, the surface of a CD is a perfect example of a reflective optical grating, as seen when used to reflect sunlight onto a nearby surface.