Welcome to Laser Pointer Forums - discuss green laser pointers, blue laser pointers, and all types of lasers



Question about intensity control with PWM

odysseus42

New member
Joined
Oct 25, 2020
Messages
6
Points
3
I'm new to this forum and recently gained interest in laser shows, and I'm currently in the middle of experimenting with modulation circuitry with an arduino. A while back I got one of those 20kpps galvo scanner sets from ebay and an RGB laser module capable of analog modulation.

Since the arduino is not capable of a 0-5V true analog output, I was thinking about using PWM for intensity modulation. I was planning to use an RC low pass filter on the PWM pin, with a transistor used to control the blanking signal connected to another digital pin, since the settling time for the filter would be way too slow in comparison with the blanking times.

But I thought, what if its possible to control both blanking and intensity on the same pin? I know that the PWM frequency would need to be much higher than the scanning speeds, so that the lines drawn in the image won't appear dotted, but I'm not sure by how much. After having read many informative posts (threads listed below), I have an idea that it must be in the MHz range.

I'm almost certain that this is not practical, as there are plenty of ways to generate an analog voltage signal (such as a DAC), but I was trying to be conservative about how many pins on the arduino I was using, since a lot of them are already being used for the DAC circuit for the galvo signals. And I'm also curious if its possible to get more than 7 colors with PWM intensity control if I had a TTL modulated laser. Since DPSS lasers usually can't modulate with MHz frequencies, I would probably have to use an AOM, as per LSRFAQ's posts.

But assuming I have all the necessary equipment for MHz modulation (and a microcontroller that's capable of generating PWM frequencies that high, so not an arduino), what's the relationship between the galvo scanning speeds and modulation frequency for intensity control so that the lines drawn in an image don't appeared dotted, if there is any such relationship?

I did a rough order of magnitude estimation, assuming 30kpps so the time from one point to the next is 1/30000s (I'm still a bit uncertain about this), and assuming that the PWM frequency would need to occur 90Hz within that amount of time so the line appears smooth, which comes out to be (1/30000)/90 = 2.7 MHz. But this would obviously depend on the throw distance and the distance between the points to be drawn. Any advice is appreciated, as I probably have many misconceptions about this topic.

Referenced threads:
laserpointerforums.com/threads/question-about-galvo-speed.71998/
laserpointerforums.com/threads/maximum-modulation-frequency.73401/
laserpointerforums.com/threads/modulation-frequency-for-green.53107/
 



hakzaw1

Well-known member
Joined
Apr 2, 2009
Messages
10,461
Points
113
here is a link

 

Cyparagon

Well-known member
Joined
Sep 12, 2007
Messages
9,837
Points
113
I think I get what you're trying to do, but it simply amounts to a 2-bit DAC. The price and complexity required for MHz PWM exceeds the price and complexity for a superior DAC.
 

odysseus42

New member
Joined
Oct 25, 2020
Messages
6
Points
3
I think I get what you're trying to do, but it simply amounts to a 2-bit DAC. The price and complexity required for MHz PWM exceeds the price and complexity for a superior DAC.
Could you explain this in a bit more detail? I'm not sure how a 2 bit DAC would help in TTL modulation, which is only digital.

But since I have an analog modulated laser, I'll probably just use a DAC that uses the I2C pins on the arduino, since those are not being used at the moment. (The other DAC that generates the galvo signals uses SPI communication).

I could also use the RC filter and transistor method I mentioned earlier (for analog voltage and blanking, respectively), but I figured a proper DAC would be more accurate.
 

Cyparagon

Well-known member
Joined
Sep 12, 2007
Messages
9,837
Points
113
Apologies, I meant to say 1-bit DAC. PWM with RC filter is just a 1-bit DAC
 

odysseus42

New member
Joined
Oct 25, 2020
Messages
6
Points
3
Apologies, I meant to say 1-bit DAC. PWM with RC filter is just a 1-bit DAC
No worries, but my main question is still not answered. Basically if the galvo mirrors move a laser from point A to point B in X amount of time, how fast would the laser (TTL, not analog) need to be modulated with PWM so that the resulting line appears continuous and changes brightness, instead of appearing as a dotted line?

This is really just a side thought that came to mind when I was trying to control blanking and intensity on the same arduino pin. The RC filter would need to be removed since it would introduce a relatively long delay, which means that everything would be back to digital signals.

So this got me thinking if it's possible to create more than 7 colors with a TTL laser. The second thread I referenced in my original post has a post by LSRFAQ (and you posted in that thread as well), where he mentions that it may be possible to achieve a kind of "grayscale" with a single color laser by using an AOM, which got me curious about this topic.
 

Cyparagon

Well-known member
Joined
Sep 12, 2007
Messages
9,837
Points
113
That's all relative. It depends on your RC time constant, the number of bits you're trying to emulate, and your threshold for "meeting" the setpoint you've set.

But if you're looking for a ballpark figure, 40kpps (thousand points per second) is a common scanner speed. nyquist sample theorem multiplied by 8 'bits' plus maybe 10x fudge factor to account for a slow RC response puts you well into the MHz range. This is all arbitrary though.

Also, it won't work with a TTL laser because the input response time is typically rated for a few tens of KHz at most.
 

kecked

Active member
Joined
Jun 18, 2012
Messages
573
Points
43
Are you just tying to fake an analog signal? Ie pulse width plus rc smoothingto make an analog modulation signal? Be much better to use an 8 bit dac. Just drive the dac with 4 lines. I agree fb3 andquickshow is a good solution. If you really want to diy for fun don’t expect glorious results. A lot goes into optimization. Plus you need 5 dacs. Rgb xy.
 

odysseus42

New member
Joined
Oct 25, 2020
Messages
6
Points
3
That's all relative. It depends on your RC time constant, the number of bits you're trying to emulate, and your threshold for "meeting" the setpoint you've set.

But if you're looking for a ballpark figure, 40kpps (thousand points per second) is a common scanner speed. nyquist sample theorem multiplied by 8 'bits' plus maybe 10x fudge factor to account for a slow RC response puts you well into the MHz range. This is all arbitrary though.

Also, it won't work with a TTL laser because the input response time is typically rated for a few tens of KHz at most.
The modulation would be done without the RC filter to remove the factor of the slow settling time, and just use digital signals entirely. But this would probably still require a MHz range PWM signal, as I have gathered from your inputs.

Also, I'm aware that DPSS lasers can't be modulated that fast anyway, but I was just curious about the theoretical modulation speeds to achieve intensity control.
 

odysseus42

New member
Joined
Oct 25, 2020
Messages
6
Points
3
Are you just tying to fake an analog signal? Ie pulse width plus rc smoothingto make an analog modulation signal? Be much better to use an 8 bit dac. Just drive the dac with 4 lines. I agree fb3 andquickshow is a good solution. If you really want to diy for fun don’t expect glorious results. A lot goes into optimization. Plus you need 5 dacs. Rgb xy.
I'm already using an MCP4922 dual channel DAC for the galvo signals, and planning to use an MCP4728 quad channel DAC for RGB. I was wondering if it's possible to modulate the laser fast enough with PWM to get some kind of variable brightness, but that has mostly been answered by the above posts.

Also could you further explain the optimization you mentioned? I ran the ILDA test file and noticed the pattern was a little off, so I presume I need to start adjusting the damping, gain, etc., with the trimpots on the galvo drivers themselves, as per the test pattern documentation. Blanking seemed fine but can be adjusted through the software on the Arduino if necessary.
 

kecked

Active member
Joined
Jun 18, 2012
Messages
573
Points
43
I wonder if the signal is in the MHz range if the rc time constant of the input might smooth it so it looks continuous Ie analog to the driver Anyway.
 

odysseus42

New member
Joined
Oct 25, 2020
Messages
6
Points
3
I wonder if the signal is in the MHz range if the rc time constant of the input might smooth it so it looks continuous Ie analog to the driver Anyway.
I've been using the low pass filter calculator at the site below below with various RC values and PWM frequencies. For example, a filter with R=1 ohm, C=1uF, and f=10 MHz varying from 0 to 5v has a settling time of 2.3 us which should be fast enough, but the peak to peak ripple is 0.12V which might be noticeable at lower duty cycles.

Reducing the ripple by a factor of 10 would mean increasing R or C by that factor, but the settling time increases to 23 us. I'm not sure if that's fast enough for the blanking times, or the laser will appear to have trailing "fade in/fade out" effects as it moves from one point to the next in a blanking line.

Increasing the PWM frequency is also another solution, but I'm not certain if there are microcontrollers that can produced these high frequencies while still maintaining a good duty cycle resolution, as the number of available duty cycles tends to drop with higher frequencies.

sim.okawa-denshi.jp/en/PWMtool.php
 

kecked

Active member
Joined
Jun 18, 2012
Messages
573
Points
43
I’d try it and see. That sounds reasonable. You might have to delay the blanking signals compared to the color signals but that’s easy to introduce. Also a ripple at 1mhz is not in anyway going to be visible. I think most control signals are 20-50khz max and more likely below 20khz.
 

Cyparagon

Well-known member
Joined
Sep 12, 2007
Messages
9,837
Points
113
Good point: the laser diode driver input and corresponding current control will act as an RC filter in this context. In that case, it may be as simple as finding the response spectrum and setting your PWM frequency a fair bit above whatever that may be. This is still far more complex and expensive than just using a DAC, but interesting thought.
 




Top