I have a Wemos D1 Mini that has no analog outputs, it only has digital outputs at 3.3V.

I need to power a laser with an analog signal 0-5V to engrave pictures on wood. The laser is moved across the image, and needs to adjust the power pixel by pixel. The time spent on each pixel is about 1ms.

The PWM frequency has not been decided yet so I am somewhat flexible with it.

What options do I have to convert this PWM signal to an analog signal? It has to be fast and relatively precise to avoid differences in pixels, so a RC setup is not an option due to strong fulctuations in the signal. (As far as I understood from reading, happy to find out that it is not the case.)

  • 2
    \$\begingroup\$ Does this answer your question? 3.3V Digital to 5V Analog Output \$\endgroup\$ Commented Dec 23, 2020 at 9:31
  • \$\begingroup\$ logic gate, from the appropriate family ... a version of 74LVC that goes up to 5V for example. Run the buffer from the 5V supply and it will output 5V. Then do the same thing with it that you would do under 3v3. 2 stage RC for example. Very much like the one referenced by the comment above. \$\endgroup\$
    – Pete W
    Commented Dec 23, 2020 at 16:14
  • \$\begingroup\$ PS - if you're doing a 2 stage RC, you can get the corner in the frequency response sharper (i.e. not so overdamped) by using smaller resistor on the first stage. E.g. 1K, 1uF, 10K, 100n \$\endgroup\$
    – Pete W
    Commented Dec 23, 2020 at 16:17
  • \$\begingroup\$ What do you mean by a 5 watt analog signal? did you mean 5 volt? \$\endgroup\$
    – Hearth
    Commented Dec 23, 2020 at 16:24

1 Answer 1


If you just want it to work with zero effort and don't care about spending extra $$, there are "PWM-to-voltage" chips that do the conversion at maximum speed for you. For example LTC2644. If you take that route, it's quite easy, you just need to pick the clock speed.

If the laser spends 1ms on each pixel, you would need the conversion-to-analog to settle in some fraction of 1ms, to produce an acceptable image. 100 us would probably be the bare minimum, 10us would probably be pretty good. But be prepared for surprises -- the eyes are quite sensitive.

A ~200kHz clock speed should be a good place to start -- but only if you're using the method of the LTC chip above.

Now if you want to save some money, you'd increase the clock quite a bit to make room for a cheaper filter. Design a higher order filter to get the "90% rise time" under 10us, or whatever number you picked as "good enough". Then set the clock high enough that the filter attenuates it to a level that wouldn't be visible. Otherwise you can have some moire patterns in your laser printed image from aliasing effects.


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.