I did some testing on reading a PWM signal on an arduino. It’s doable setting interrupts on the input pin, then measuring the pulse. It seems to be fast enough so that there would only be a delay of one cycle. So at 500Hz, the delay would be around 2ms. If the MPCNC is traveling at 20mm/s, that’s 0.04mm or 0.0015in. I don’t think that would have any noticeable effect in the quality of the output. I was burning images at 250DPI, and that is less than that.
In order to change the voltage of the output, that’s a little trickier. I think if I took the PWM output through a voltage divider, than back to an arduino pin, I could change the non-PWM pin from input mode (basically floating) to output mode and drive it low. This would effectively give me a PWM output I could change the peak voltage of with another pin. This isn’t tested as I really need a scope to see it. I have a DAQC2plate for the Pi that can act as a scope, but the software is a little lacking (but the hardware is great). I don’t feel like fighting it today. I keep telling my wife I need an oscilloscope. Seems like I need one to verify everything
But that got me to thinking - why not just put a small capacitor and a pull down resistor on the PWM output and basically convert it to analog? It’s been a while since I took an EE class, but at 5V a 0.01uF capacitor and a 10k resistor should give a discharge rate around 0.001 sec. (OK I cheated and used an online calculator I found).
I need to do some tests, but that will probably wait until next weekend. I have a few jobs to crank out on the laser before I tear it apart.