# [tutorial] Setting up a DMD: Diffraction effects

I recently acquired a Digital Micromirror Device (DMD) and when I started setting up the experiment, I faced a problem I did not anticipate which is closely related to blazed gratings. Due to the fact that the surface of a DMD is not flat, diffraction orders are shifted compared to the optical axis. This shift depends on the pixel pitch, the wavelength and the incident angle. A close look at this diffraction phenomenon is important to configure an experimental setup properly. It is even relevant to consider this effect before choosing the appropriate DMD model to buy.

Figure 1. Representation of incident and reflected beams with a liquid crystal SLM (left) and a DMD (right).

In a standard diffracting device, such as a flat grating or a liquid crystal SLM, the reflection angle is the opposite of the incident one compared to the normal of the array plane. That implies that the path coming from each element of the device has the same optical path length (Figure 1 left). For a blazed grating, or a DMD with all the pixels in the same state, the elements are tilted with a given angle $$\theta$$. Two consecutive pixels or elements now have a phase difference (Figure 1 right). In the Fourier plane, where we commonly select the zeroth order, all the diffraction orders are shifted compared to the optical axis within the same envelope. In the worst scenario, we can end up with four diffraction orders with approximately the same intensity, each significantly shifted compared to the optical axis. An example is shown in Figure 6. This is almost exactly what I had the first time I set up my DMD while I expected something like in Figure 5.

Another way of seeing this effect is to consider that the diffraction orders (satisfying the grating equation) do not match anymore the angle of the reflected beam.

We first use a 1D model to evaluate the effect of the tilt angle on the diffraction pattern. We then use simple numerical calculations to estimate the profile of the diffraction pattern. The full Python code used in this post is available as an IPython Notebook on my GitHub account:

### A simple criterion

In a DMD, the axis of rotation of the mirrors is at 45 degrees compared to the axis of the square lattice of the pixels. We consider that we only excite the DMD with plane wave having a k-vector orthogonal to this axis. This makes sense because if one wants to compensate for the diffraction effect in both directions, he has to follow the symmetry of the system. Then, the problem is similar in the X and Y directions and we can just consider a 1D problem.
For a tilt angle $$\theta$$ in the direction of the diagonal of the pixels, in each direction, we consider a tilt angle of $$\theta'=\arctan\left(\tan\left(\theta\right)/\sqrt{2}\right)$$ and an incident angle of $$\alpha'=\arctan\left(\tan\left(\alpha\right)/\sqrt{2}\right)$$.

Ideally, we want to have most of the energy in a central order that corresponds to the optical axis of our system, i.e. that matches the reflection angle. That means that the incident and reflection angles $$\alpha'$$ and $$\beta'$$ have to satisfy the grating equation:

$$\sin\left(\alpha'\right)+\sin\left(\beta'\right)=\frac{m\lambda}{d}$$

with

$$\beta' = 2\theta'-\alpha'$$

In the general case we can calculate the value :

$$m = \frac{2d}{\lambda}\left(\sin(\alpha')+\sin(\beta')\right)$$

If $$m$$ is close to an integer, we are at the blazing condition as in the upper part of Figure 2. If $$m$$ is close to an integer plus 0.5, we are in the situation of the bottom part of Figure 2.

To better quantify if we are close to the blazing condition, we can estimate $$\mu = m \,\%\, 1 -0.5$$. It is equal to 0.5 at the blazing condition and to 0 in the opposite case. I show in Figure 2 $$\mu$$ for $$d = 10.8$$ and $$\lambda=633nm$$ as a function of the incident angle $$\alpha$$.

Figure 2. Representation of the blazing criterion as a function of the incident angle for $$\lambda = 633nm$$ and for a DMD pith of $$7.6 \mu m$$ (upper figure) and $$10.8 \mu m$$ (bottom figure). Red and green lines correspond to the classical situations with  $$\alpha = \theta$$, the so-called (Littrow configuration) $$\alpha = 0$$ or $$2\theta$$, where either the incident or reflected beam is oriented toward the normal of the DMD plane.

For a given wavelength and a given DMD, so with a fixed pixel pitch, it is possible to retrieve the blazing configuration by tuning the incident angle. However, it may require an inconveniently large angle. This is particularly true when the ratio $$\lambda / d$$ increases, which increases the diffraction angles. In Figure 3, I plotted $$\mu$$ as a function of $$\alpha$$ for $$d = 7.6 \mu m$$ and $$\lambda = 1.55 \mu m$$. We see that the number of oscillations of $$\mu$$ is reduced and since we are close to the worst case, we need to set a very high incident angle to achieve the blazing condition, which is experimentally inconvenient.

Figure 3. Representation of the blazing criterion as a function of the incident angle for $$d = 7.6 \mu m$$ and $$\lambda = 1.55 \mu m$$.

### 2D simulations

To take a look at the diffraction figure of the DMD, we represent the 2D shape of the pixel array. Two neighboring pixels have a phase shift of  $$\frac{2\pi}{\lambda}d\left[\sin(\alpha')+\sin(\beta')\right]$$.

Figure 4. Real part of the field contributions of the pixels of the DMD for $$\lambda = 632 nm$$ and $$d = 10.8 \mu m$$ (left) and $$d = 7.6 \mu m$$ (right). For $$d = 10.8 \mu m$$, we are close to the blazing condition and the phase of the pixel contributions is almost flat.

We then display the 2D Fourier transform. To better see the diffraction order, the square root of the intensity is plotted. The diffraction patterns for the configurations in study are displayed in Figure 5 and Figure 6.

Figure 5. Diffraction pattern of an "all-on" DMD array for $$\lambda = 632 nm$$ and $$d = 10.8 \mu m$$. To better see the higher orders, I represented the square root of the intensity. The yellow cross indicates the angle of the optical axis.

Figure 6. Diffraction pattern of an "all-on" DMD array for $$\lambda = 632 nm$$ and $$d = 7.6 \mu m$$. To better see the higher orders, I represented the square root of the intensity. The yellow cross indicates the angle of the optical axis.

The full IPython code is available here: blazing_angle_DMD.ipynb