Tag Archives: optics

Diffraction Grating Orders Calculator

Diffraction gratings are used in optics to split light into multiple paths. The number of diffracted orders and the angles they are seen at vary depending on the angle at which light hits the grating, the spacing of the grooves in the grating and the wavelength of the light used. I wrote this Javascript app to save me time while performing some calculations for an experiment for my PhD, I had to find the best angle to set the grating at for several wavelengths of light so that I could use the reflected orders.

I wanted an app that didn’t just tell me what orders were present and what angles they were at, I wanted to be able to more easily visualise them. I needed to be able to easily select the grating properties as well as the wavelength of light used, since for my application I was using several light sources all of different wavelengths.

Diffraction Grating Order Calculator. It’s on a separate page so that there’s more space available than in my main website’s layout.

Diffraction Grating Order CalculatorThe app was written with Javascript and a Javascript vector graphics library called Raphael.js. It was my first time using either of them, Raphael was excellent, the demos are really impressive.

The Raphael parts were fairly straight forward. The hardest bit was getting the HTML to play nice with all browsers. Time to start my next app now, I’m hooked! Email with any suggestions for others, be they educational, time saving or commercial, I’d be interested to hear.