Close

Testing PWM with green laser

A project log for Laser Projector

Laser projector with 3 lasers (RGB) incident on an x-cube(dichroic) with galvanomirror

shoaib-mustafaShoaib Mustafa 08/09/2024 at 21:542 Comments

I tested the PWM with a green laser using a 2N2222 transistor between it and the microcontroller. At 1 kHz, the laser did not turn on, but it did at higher frequencies. When I tested it at 10 kHz, it worked, so I guess my theory that frequency wouldn't make a difference was wrong. I wonder if a MOSFET would behave differently—I'll give it a try.

Green Laser:

For further testing, I need an easier way to control the PWM signal. Right now, I'm re-uploading the program repeatedly with different values. I think using a potentiometer to map to the ARR value might work.

P.S.: Although this laser is common and weak, I still feel my eyes straining when working near it. It seems that 6V at 350mA equals 2W, which is not exactly common. Never mind—I found some glasses and will wear them from now on. Haha!

A Question: Can I set the CCR to a value between 0 and 100 to correspond to the duty cycle?

No, the CCR can be set from 0 to the value of ARR. In the case of an ARR value of 1000, CCR can range from 0 to 1000. The CCR is used to control the duty cycle, and this value is compared with the ARR value to generate a certain duty cycle DD.

Discussions

Ken Yap wrote 08/09/2024 at 23:53 point

I don't know what the operating voltage of the laser is, but while 350 mA is within the limits of the 2N2222 collector current, you will also have a large C-E drop of up to 2V according to the datasheet. In addition the gain of the transistor may be lower at higher currents so you need more base current. I'd check with a scope that the transistor is actually driven into saturation, and to account for the voltage loss across the transistor. Maybe a MOSFET is a better switch for your use case.

  Are you sure? yes | no

Shoaib Mustafa wrote 08/10/2024 at 07:00 point

Thanks for pointing it out. i've been meaning to use a MOSFET. will definitely switch to it. 

  Are you sure? yes | no