Digital micromirror devices have gained popularity in wavefront shaping, offering a high frame rate alternative to liquid crystal spatial light modulators. They are relatively inexpensive, offer high resolution, are easy to operate, and a single device can be used in a broad optical bandwidth. However, some technical drawbacks must be considered to achieve optimal performance. These issues, often undocumented by manufacturers, mostly stem from the device's original design for video projection applications. Herein, we present a guide to characterize and mitigate these effects. Our focus is on providing simple and practical solutions that can be easily incorporated into a typical wavefront shaping setup.

^{1} Institut Langevin, ESPCI Paris, PSL University, CNRS, Paris, France

^{2} Racah Institute of Physics, The Hebrew University of Jerusalem, Jerusalem, Israel

Since the advent of adaptive optics, various technologies have been employed to modulate the amplitude and/or phase of light. Early adaptive optics devices, utilized in fields like microscopy and astronomy, offer rapid modulation capable of compensating for the aberrations of optical systems in real time. However, these devices are constrained by a limited number of actuators, restricting their utility in complex media where a large number of degrees of freedom is essential. Liquid Crystal Spatial Light Modulators (LC-SLMs), which allow for the control of light phase across typically more than a million pixels, have emerged as powerful tools for wavefront shaping in complex media since the seminal work of A. Most and I. Vellekoop in the mid-2000s [1]. Nonetheless, LC-SLMs are hampered by their slow response time, permitting only a modulation speed ranging from a few Hz to a few hundred Hz.

Digital Micromirror Devices (DMDs) have emerged as a technology bridging the gap between these two types of systems; they offer a large number of pixels (similar to LC-SLMs) and fast modulation speeds (typically up to several tens of kHz). Their high-speed capabilities made them attractive for real-time applications, in particular for high-resolution imaging microscopy requiring fast scanning or illumination shaping [2,3], biolithography [4], and optical tweezers [5]. However, DMDs are restricted to hardware binary amplitude modulation and are not optimized for coherent light applications. Utilizing DMDs for coherent control of light in complex media is therefore non-trivial and necessitates specific adaptations for efficient use.

To comprehend both the capabilities and limitations of DMD technology for coherent wavefront shaping, it is crucial to understand the device’s operating principles and its original design intentions. Investigated and developed by Texas Instruments since the 1980s, DMDs gained prominence in the 1990s for video projection applications since the 1990s under the commercial name of Digital Light Processing (DLP) [6,7]. The technology enables high-resolution, high-speed, and high-contrast-ratio modulation of light. DMDs operate by toggling the state of small mirrors between two distinct angles, denoted as ±*θ*_{DMD}. The device is originally engineered for amplitude modulation in video projection applications. In this configuration, one mirror angle directs light into the projection lens, while the alternate angle results in the light path being blocked (see Fig. 1). Given that projectors utilize incoherent light and that the DMD plane is optically conjugated with the projection screen, aberrations within the DMD plane are generally not problematic. Similarly, phase fluctuations induced by temperature variations, as well as minor vibrations from the cooling hardware, are inconsequential in this context. The DMD is designed to produce binary on/off modulation, which is then leveraged to generate grayscale images via pulse-width modulation. Color modulation is accomplished through the use of a color wheel in conjunction with a bright white light source.

Third-party companies have developed kits tailored for research applications, which include a DMD, a control board, and a software interface. Specifically, Vialux devices [8] offer an FPGA board that enables high-speed modulation by allowing frames to be stored in the device’s memory [9]. However, standard Texas Instruments video projector evaluation modules can also be repurposed into wavefront shaping devices [10], though at a compromised modulation speed. These systems can further be converted into phase or complex field modulators. This is typically achieved by encoding the optical phase into the spatial displacement of binary spatial fringes displayed on the DMD, followed by filtering the high spatial frequencies in the Fourier plane [11]. Such a configuration permits multi-level complex modulation but sacrifices spatial resolution. The implementation and performance of such systems are explored in a separate tutorial [12] and will not be elaborated upon here. For the remainder of this paper, it will be assumed that the DMD is used for complex modulation via such a method.

While other articles exist describing the various aspects of DMDs [10, 13-15], this tutorial aims to provide a guide for easily setting up a DMD for wavefront shaping applications in complex media. In particular, we provide characterization and validation procedures that require minimal changes compared to typical wavefront shaping setups. More specifically, we place ourselves in a standard experiment where the goal is to shape the complex wavefront impinging on a complex medium and control or measure its output response. This is typically the case for a focusing experiment [1] or for measuring the transmission matrix of a complex medium [16].

We first introduce the diffraction properties of a DMD and elaborate on how these could impact the system’s efficiency. We also furnish a straightforward criterion for selecting the appropriate DMD parameters for a specified excitation wavelength. In the next section, we delve into the aberration impacts brought about by the non-flatness of the DMD surface. We demonstrate a simple process to characterize this effect and provide compensation solutions. In the third segment, we detail the influence of mechanical vibrations that are induced by the DMD’s cooling system. Lastly, we discuss how the thermalization of the DMD chip can potentially result in variations in the DMD response over time.

**Figure1. Principle of operation of a DMD in a digital projector.** Left, incident light can be reflected towards the projection lens (state *on*), or onto a beam dump (state *off*). Right, zoom on the pixels. Image adapted from [17].

A significant distinction between liquid crystal modulators and DMDs lies in the geometry of the pixel surface. This difference gives rise to diffraction effects that can adversely affect both the modulation quality and system efficiency. The impact of these diffraction effects is highly contingent on several factors: the wavelength of the illumination, the pixel pitch, and both the incident and outgoing angles. Therefore, alongside selecting an appropriate anti-reflection coating, it is crucial to ensure that the pixel pitch is compatible with the specific configuration being used. Texas Instruments offers chips with a variety of pixel pitches *d*, ranging approximately from 5 toâ€„∼â€„25 \(\mu m\) [18].

To achieve a qualitative understanding of this issue, we consider a 1D array of pixels as illustrated in Fig. 2. Initially, let’s assume that all pixels are in the same state and are illuminated by a plane wave originating from the far field. Under these conditions, the pixelated modulator essentially functions as a grating, with a period *d* that is equivalent to the pixel pitch. It is important to underscore that these modulators possess a hardware-limited fill factor, typically around 90%. This translates to an effective active pixel size of *d*′â€„<â€„*d*.

In general, a grating gives rise to various diffraction orders with differing intensities and angles *θ*_{p}, as dictated by the grating equation: sin(*θ*_{p})â€„=â€„*p**λ*/*d*â€„=â€„*p*â€†sin(*θ*_{D}), where *λ* is the wavelength of the light, *θ*_{D} is the angle of the first-order diffraction, and *p* is an integer value denoting the orders of diffraction. The intensity of the individual diffraction orders is influenced by the response of a single pixel, constituting the unit cell of the grating, and that is governed by *d*, *d*′, and its rotation angle in the case of a DMD. Importantly, we can decouple the effects of the grating’s periodicity, which influences the angles of the diffraction orders, from the effects of the response of a single pixel, which shapes the envelope of the angular response.

**Figure 2. 1D grating geometry.** Schematic representation of the geometry of two types of modulators: (a) the liquid crystal modulator, equivalent to a flat grating, and (b) the DMD geometry, equivalent to a blazed grating. *α* denotes the incident angle relative to the normal of the array plane, *θ*_{0} refers to the angle of the zeroth diffraction order, and *θ*_{B} is the tilt angle of the mirrors.

For a case of normal incidence with an LC-SLM (Liquid Crystal Spatial Light Modulator), we can assume that the response of a single pixel is uniform over its surface. Similarly, in the scenario of a blazed grating, such as a DMD, a linear phase slope is present on each pixel. This is due to the tilt angle *θ*_{B} of the mirrors. For an arbitrarily selected incidence angle *α*, a global phase slope is introduced. This results in a trivial shift of the angular diffraction pattern by an angle *α*. In essence, the incident angle *α* serves to shift the entire angular diffraction pattern relative to the case of normal incidence, while the blazed angle *θ*_{B} —the tilt angle of the mirror in the DMD projected onto the axis we consider— only shifts the envelope by an angle of 2*θ*_{B}. Whenever the fill factor approaches 100%, i.e. when *d*â€„≈â€„*d*′, the envelope for a flat grating achieves its maximum at *θ*_{0}â€„=â€„−*α*; this corresponds to the angle of the zeroth-order diffraction, and the intensity nears zero for all other orders. In these specific conditions, a singular diffraction order is visually perceived, corresponding to the optimum scenario. The addition of a blazed angle *θ*_{B} results in both a shift in the envelope and in the position of its maximum, now indicated by *θ*_{0}â€„=â€„2*θ*_{B}â€…−â€…*α*. In the general case, this position may not align with a diffraction order anymore [13]. A more accurate computation of the far field can be found in [15].

**1D calculation of the DMD diffraction effect:**

Assuming the effect of the device’s finite size and illumination to be negligible, and situating ourselves within the context of the small-angle approximation, we can represent the field reflected from the device under the influence of plane wave illumination across two systems as follows:

$$\begin{aligned} R_\text{flat}(x) & \propto \left[\Pi\left(x/d'\right) \otimes_x \sum_k \delta(x-k d)\right]e^{-j\frac{2\pi}{\lambda}\text{sin}(\alpha) x} \\ R_\text{blazed}(x) & \propto \underbrace{ \left( \underbrace{\Pi\left(x/d'\right)}_\text{pixel size} \times \underbrace{e^{j\frac{2\pi}{\lambda}2\text{sin}(\theta_B-\alpha) x}}_{\substack{\text{blazed angle} \\ \text{+ angle of incidence}}} \right) }_\text{pixel response} \otimes_x \left[ \underbrace{\sum_k \delta(x-k d) }_\text{periodicitiy} . \underbrace{ e^{-j\frac{2\pi}{\lambda}\text{sin}(\alpha) kd} }_\text{angle of incidence} \right] \, , \end{aligned} \label{eq:grating_response}$$

with Π(x) the rectangular function, representing the finite size of the pixel, defined as:

\begin{equation}

\Pi(x) = \begin{cases} 1, & \text{if } -\frac{1}{2} < x < \frac{1}{2}, \\ 0, & \text{otherwise}. \end{cases}

\end{equation}

The intensity as a function of the angle in the far-field is given, up to a homotetic transformation, by the absolute value squared of

The Fourier transform of Eq.\eqref{eq:grating_response} can be written as:

$$\begin{aligned} I_\text{flat}(\theta) \propto \sum_p \delta(\text{sin}(\theta)+\text{sin}(\alpha)) \times \text{sinc}^2\left( \left[\text{sin}(\theta)+\text{sin}(\alpha)\right] \frac{\lambda}{d'}\right) \\ I_\text{blazed}(\theta) \propto \underbrace{ \sum_p \delta(\text{sin}(\theta)+\text{sin}(\alpha)-p\,\theta_D) }_\text{orders of diffraction} \times \underbrace{ \text{sinc}^2\left( \left[\text{sin}(\theta)+\text{sin}(\alpha)\right] \frac{\lambda}{d'}\right) }_\text{envelope} \, . \end{aligned}$$

We observe that the envelope (right-hand term) is maximal for sin(θmax) = sin(α − 2θB) while the effect of the periodicity (left-hand term) is maximal for sin(θp) + sin(α) = pλ/d, representing the orders of diffraction.

We represent in Fig. 3 the angular response of a flat grating and a blazed grating for a 1D filling fraction of 95% (corresponding to a 2D filling fraction of â€„≈â€„90%). For a flat grating, the zeroth order contains most of the intensity, the other orders being negligible in comparison. For the blazed grating example shown, we are in a situation close to the worst-case scenario: Two diffraction orders have a significant and comparable intensity, and other orders also have non-negligible contributions. In the optimal scenario, where the peak of the envelope corresponds to a diffraction order, it results in a single diffraction order carrying the majority of the energy. This state is achieved when the conditions of the blazed grating equation are fulfilled [19]:

\begin{equation}

\text{sin}(2\theta_B-\alpha) + \text{sin}(\alpha) = 2 \,\text{sin}(\theta_B) \,\text{cos}(\theta_B-\alpha) = p\frac{\lambda}{d} \, .

\label{eq:blazed}

\end{equation}

We note that the incident angle *α* also affects the diffraction efficiency.

**Figure 3. Flat grating vs blazed grating.** Far-field diffraction patterns for a 1D flat grating (left) and a 1D blazed grating (right) for an input angle of *α*â€„=â€„−20^{âˆ˜}, a filling fraction of 95% (corresponding to a 2D filling fraction of â€„≈â€„90%), a pixel tilt angle of *θ*_{B}â€„=â€„5^{âˆ˜}, and a wavelength to pixel pitch ratio 0.05. Vertical lines represent the angles of the diffraction orders and the black dashed curve represents the amplitude of the field.

To analyze more precisely the effect of diffraction in a DMD, one needs to consider the 2D surface of the modulator. We can establish a Cartesian coordinate system on the plane of the DMD, with axes *x* and *y* aligned with the pixel sides (refer to Fig. 4a). Pixels are uniformly repeated along these axes. However, a technical challenge arises in that the axis of rotation of the pixels aligns with the pixel diagonals, resulting in a rotation by 45 degrees with respect to the *x* and *y* axes. For the convenience of alignment and manipulation of the optical setup, it is preferable to work with the incident and outgoing beams which have the optical axis contained in the horizontal plane, i.e. a plane parallel to the table surface. A straightforward and prevalent solution is to rotate the chip by 45 degrees relative to the horizontal plane, which aligns the pixel’s axis of rotation to be vertical. This configuration is depicted in Fig. 4b.