My end goal is trying to get something rendered using lasers and a MEMS scanning mirror. There are not that many resources online for this, but it seems like the basic idea is pretty applicable to general embedded systems principles. I am building the driver from scratch and having trouble with part of it, and hopefully can get some direction on what to learn and make sure my thought process/approach is correct? The idea is straight forward:

  1. Render a element and generate a ppm file to define each pixel value
  2. Convert that to a set of voltages for the DAC
  3. Based on the data sheet I can generate a look up table for voltage -> angles for the mirror

My main question is figuring out how to generate those sets of voltages. Is that even the correct approach? It seems like it will be a very similar approach to how LCD screens work with refresh rates.

HV_A (X+)
HV_B (X-)
HV_C (Y-)
HV_D (Y+)

HV_A = ((x_in / 8) + 1.25) * 56
HV_B = 140 - (((x_in / 8) + 1.25) * 56)
HV_C = ((y_in / 8) + 1.25) * 56
HV_D = 140 - (((y_in / 8) + 1.25) * 56)
  • \$\begingroup\$ Are you planning to only have the mirror illuminate a subset of pixels in your image? Otherwise, you would generally have it sequentially step through all possible angles at a constant rate (raster scanning). \$\endgroup\$ Jul 27, 2020 at 4:23
  • \$\begingroup\$ Are you asking how to generate the physical voltages from the digital data (how to build a DAC), or are you asking what the voltages should be (and for that we would need to know about your mirror)? \$\endgroup\$
    – user4574
    Jul 27, 2020 at 4:28
  • \$\begingroup\$ @user1850479 I am planning on performing a raster scan \$\endgroup\$
    – joethemow
    Jul 27, 2020 at 4:33
  • \$\begingroup\$ @user4574 question is how to go from pixel -> voltages for the DAC. I provided the equations in the data sheet for the positional outputs on each axis, but that's for the 2nd step after I have the voltage values. It seems like I may have to convert positional data to voltages and not necessarily the pixel data? \$\endgroup\$
    – joethemow
    Jul 27, 2020 at 4:37
  • \$\begingroup\$ @joethemow In a raster scan the pixel values are not used to generate the mirror voltages. Instead, the mirror moves at a constant velocity, and would do so even if the image was completely blank. \$\endgroup\$ Jul 27, 2020 at 4:38

2 Answers 2


So, the conversion from rectangular coordinates to angles is really just a bunch of trigonometric functions; that's not hard to do on paper (if your mirror is x meters from the wall, and you want to light up a point y meters right of the perpendicular, that angle is arcsin(y/x); do a drawing to clarify for yourself).


Your approach isn't great. The mirror is an object with a mass and thus, hysteresis. Accelerating and breaking it is complicated, takes time and energy.

Your laser on the other hand can nearly arbitrarily fast be pulsed.

So, assuming you have one voice coil to deflect the mirror in vertical direction, and one in horizontal:

  • Let the mirror do a full row scan as one continuous swipe. It's very possible that the easiest way of doing so is a simple current DAC, which you also find in cameras to control optical elements (stabilizers, autofocus), for example the AD5398A.
  • Then, advance one row with the other coil, and do the swipe (hint: might be clever to do it in the opposite direction)
  • all the while, you turn on your laser at the right time instants – not at inidividual "discrete" angles, but based on knowing that mirror travels continuously, at the right time.

That gives you a simple three-DAC system: One DAC for row slides, one DAC to define the vertical deflection, and one fast DAC for the laser. Your horizontal resolution is only defined by how quickly you can control the laser, your vertical by how many individual rows you can do.

  • \$\begingroup\$ This makes sense, I have a 2D mems mirror. The principle seems like it would transfer over in this case as well. Is there a good resource on syncing the laser pulses with the position of the mirror? \$\endgroup\$
    – joethemow
    Jul 28, 2020 at 19:48

question is how to go from pixel -> voltages for the DAC.

Short answer: You don't!

In a raster scanning system, the voltages are fixed ahead of time by the area of the raster scan. For example, if 1 volt input causes your mirror to deflect 1 degree on each axis, and you want to do a +/-1 degree image, you would start at [-1, -1] then [-1,-.999], then [-1,-.998] ... [-1,+1]. At that point you have finished one fast axis line and go to the next. Usually you do a so-called "triangle" scan, which just means you now turn around and scan the next line backwards: [-0.999,+1], [-0.999,+.0999], ... When you get to the end of the last line, you have finished your image, and you loop around back to the start and draw the next frame.

Usually this is implemented by loading a circular buffer into your DAC that just continuously feeds however many voltages are necessary to draw one frame. You can also significantly subsample your data since your mirror will have a lot of inertia and doesn't actually need to have the voltage updated for each pixel.

  • \$\begingroup\$ I think you mean triangle wave rather than sawtooth if you are doing a back and forth. The sawtooth would do all scans in the same direction as on analogue TV. \$\endgroup\$
    – Transistor
    Jul 27, 2020 at 8:07
  • \$\begingroup\$ @Transistor yes thanks! \$\endgroup\$ Jul 27, 2020 at 12:36
  • \$\begingroup\$ Ah ok this makes sense, any recommendation on some good resources to learn more about subsampling? \$\endgroup\$
    – joethemow
    Jul 28, 2020 at 23:39
  • \$\begingroup\$ @ joethemow Datasheet for your MEMS mirror should have information about the step response and/or magnitude spectrum of the mirror. From that you can get a good idea how to sample the mirror waveform. \$\endgroup\$ Jul 29, 2020 at 0:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.