# 3.3V digital PWM to 5W analog signal

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.)

• Does this answer your question? 3.3V Digital to 5V Analog Output Commented Dec 23, 2020 at 9:31
• 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. Commented Dec 23, 2020 at 16:14
• 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 Commented Dec 23, 2020 at 16:17
• What do you mean by a 5 watt analog signal? did you mean 5 volt? Commented Dec 23, 2020 at 16:24

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.