Laser PWM using Arduino

Hello all,

Fist of all I must say I'm new to Arduino and have no idea what I'm doing. Here's what I'm trying to do.

I have 3 laser diodes RGB that I need to modulate using PWM at around ~10kHz. I will be feeding the PWM signal into the enable pins of my laser drivers. I would like to be able to change the duty cycle from at least 5%-95% or better. How would I do this with the Arduino? I know there are many Arduino chips and I need one that is as small as possible.

Also, can the Arduino be powered using a single Li-ion battery? If possible I would also like to be able to display the duty cycle of each laser on a display.

Any pointers would be great,

Thanks!

Hi and welcome.

Your 10KHz PWM frequency will be a problem. The analogWrite() Arduino function has a PWM frequency of only around 500Hz. There may be a way around this, but I don't know how.

Duty cycles of between 5% and 95% are no problem, but what degree of precision do you need? Again, the standard analogWrite() function only has 8-bit or 256 steps.

An 8MHz Arduino Pro Mini may be a good choice, it is small, has more than 3 PWM outputs, and enough pins to control a 16x2 or 20x4 character LCD.

Battery power is fine for the 8MHz Mini, but supply it through its Vcc rather than vRaw input, bypassing its regulator.

How will you change the duty cycles? Through the serial port of a PC?

Paul

Hey Paul,

Thanks so much for the help! I found a function to change the frequency here do you think it will work? Also, I want to change the PWM duty cycle of each diode or pins on the Arduino using something physical so either a potentiometer or some physical buttons. Is this possible?

Thanks!

Apocalypse:
I want to change the PWM duty cycle of each diode or pins on the Arduino using something physical so either a potentiometer or some physical buttons. Is this possible?

Yes.

Just making sure. So I can use the Arduino Board Pro Mini 3.3V run it with a Li-ion battery 4.2-3.5V. I can then output 3 different PWM signals simultaneously on 3 different pins and adjust them with 3 different potentiometers to adjust the red green and blue PWM outputs separately? Are there enough pins on the board to do this? Any tips on how to do that?

Thanks!

I can then output 3 different PWM signals simultaneously on 3 different pins and adjust them with 3 different potentiometers to adjust the red green and blue PWM outputs separately?

Yes.

Are there enough pins on the board to do this?

Yes.

Any tips on how to do that?

http://owenmundy.com/blog/2010/05/fading-an-led-with-pwm-and-a-potentiometer/

However a Laser is not an LED, do you know how to drive lasers?
http://www.repairfaq.org/sam/laserdps.htm

Grumpy_Mike:
However a Laser is not an LED, do you know how to drive lasers?

Apocalypse:
I will be feeding the PWM signal into the enable pins of my laser drivers.

Might be a good idea to post a link to these drivers so that G-Mike can check them.

Apocalypse:
I found a function to change the frequency here do you think it will work?

Never seen that before, sounds worth a try.

Note that to upload your sketch to a Pro Mini, you will need a USB to serial adaptor. You can get these cheap on eBay, Amazon etc. This is one of the things that makes Pro Mini smaller, lower power and cheaper. Other Arduino's have the USB to serial adaptor built-in.
m7HKhREpd0r8huSnjwTEyIA.jpg
mqC8NHufLMdOd_VydVbI0Ng.jpg

Apocalypse:
I want to change the PWM duty cycle of each diode or pins on the Arduino using something physical so either a potentiometer or some physical buttons.

Three pushbuttons could be a more compact alternative to 3 pots. They could be up, down & enter/next colour. Or one pot and one button. You could also have a small menu system that could allow you to save colour settings in a number of memory slots and recall them later.

Smaller even than the 16x2 lcd are the 128x64 graphic OLED screens. Just as cheap and come with either i2c or spi interfaces. I would recommend the i2c interface version for your project, only two Arduino pins needed.
mHiq4x390jcer4X1fh2NMRQ.jpg

Thank you all so much for the help!

I'll go into more details about my project. I have 3 laser diodes, red, green, and blue as listed below. The model, current needed, voltage needed, and expected output are also listed below. I will then be combining the three lasers into one single beam using dichroic mirrors. The goal is to make a handheld laser pointer that I can adjust to any color I want including white. I will be using a single Li-ion or Lipo battery with the output voltage from 4.2V to 3.5V. I'll make the unit turn off when the battery voltage falls below 3.5V.

Red (HL63603TG) - 300mA, 3.2V, 210mW
Green (PL520) - 200mA, 6.7V, 80mW
Blue (PL250B) - 300mA, 4.5V, 200mW

I will be using a boost driver found here with schematic found here. The only change to the schematic is removing C3 and replacing C1 and C2 with 22uF capacitors since apparently C3 caused some problems with output ripple. Also, the resistor between pins 4 and 5 will be removed and the Arduino PWM signal will be fed into the DIM pin for PWM control at ideally ~10kHz.

The driver is based on the IC here the LM3410 in boost mode. This driver will be used to drive the green and blue diodes at 6.7V and 4.5V respectively.

However, the red diode needs 3.2V and the boost driver cannot accomplish this with an input voltage of 4.2-3.5V. I'm trying to figure out whether or not I can use the LM3410 in SEPIC mode to drive the red diode and then modulate it using PWM with the enable pin.

Do you think I can use the LM3410 in SEPIC mode on page 32 to power the red diode at 300mA?

Regarding the physical inputs I'll have to learn how to configure the Arduino to use push buttons. I think using 3 push buttons, one to cycle through the colors and two up an down to change the duty cycle would be ideal.

Those boost chips are not designed for running a laser, they are designed for LEDs. Did you not read that link I posted?

Are you using a PCB for that regulator, you don't stand a chance of getting anything stable if you don't and then if you do you have to be skilled at layout. I have not supervised a professional engineer who specializes in switch mode supplies that got it right first time.

Grumpy_Mike:
Those boost chips are not designed for running a laser, they are designed for LEDs. Did you not read that link I posted?

Are you using a PCB for that regulator, you don't stand a chance of getting anything stable if you don't and then if you do you have to be skilled at layout. I have not supervised a professional engineer who specializes in switch mode supplies that got it right first time.

That regulator has been tested and it works for laser diodes. You can see it in this link along with the PCB design.

Please yourself, that link just points to a generic page, nothing relevant to the discussion here.
I could ask what tests you have done to prove the design because some people's idea of testing equals "it is not broken yet", but it looks like you are not receptive to ideas.

Good luck.

Apocalypse:
That regulator has been tested and it works for laser diodes. You can see it in this link along with the PCB design.

I can't see the specific SEPIC design on that page which as Mike points out, seems to be excessively colourful but poor on the detail.

I'm not sure precisely what Mike's concerns are here (apart from the cantankerousness of switchmode regulator designs). The design of the regulator circuit includes an output capacitor whose function is to average out the current so that it does not follow the switching of the regulator but stabilises to whatever short-term value causes the laser to pass the desired current. This will work - and result in an average current defined by the PWM value as long as the laser exhibits no "negative resistance" characteristic and I am not aware that they do.

Mike's general concern is that the voltage-current characteristic of LEDs and laser is highly temperature-dependent, but this would be on a time-scale well beyond the retention of the 10 µF capacitor.

The remaining concern mentioned in the "laserfaq" is that there be no switch-on surge and I cannot see that this regulator would have a problem in that respect.

Grumpy_Mike:
Please yourself, that link just points to a generic page, nothing relevant to the discussion here.
I could ask what tests you have done to prove the design because some people's idea of testing equals "it is not broken yet", but it looks like you are not receptive to ideas.

Good luck.

Sorry if I have offended you Mike. I know you're worried about the driver as a current spike or a startup spike may kill the laser and I am extremely grateful for that. However, more than a hundred of these drivers have been made and used on laser diodes on the other forum. For me, that is good enough testing since I'm using 50$ laser diodes as opposed to thousand dollar DPSS lasers. If I break one, though not ideal, I can live with it.

Paul__B:
I can't see the specific SEPIC design on that page which as Mike points out, seems to be excessively colourful but poor on the detail.

I'm not sure precisely what Mike's concerns are here (apart from the cantankerousness of switchmode regulator designs). The design of the regulator circuit includes an output capacitor whose function is to average out the current so that it does not follow the switching of the regulator but stabilises to whatever short-term value causes the laser to pass the desired current. This will work - and result in an average current defined by the PWM value as long as the laser exhibits no "negative resistance" characteristic and I am not aware that they do.

Mike's general concern is that the voltage-current characteristic of LEDs and laser is highly temperature-dependent, but this would be on a time-scale well beyond the retention of the 10 µF capacitor.

The remaining concern mentioned in the "laserfaq" is that there be no switch-on surge and I cannot see that this regulator would have a problem in that respect.

Paul, the SEPIC design is in the LM3410 data sheet found Page 25-33 here. Is this the one poor in detail? I'm not sure which SEPIC design to use.

Also, wouldn't the driver regulator keep the current constant or near constant as the voltage changes with the temperature?

I was also worried about the switch-on surge that can potentially kill the diode but since this design has been use many times with the same diodes, I'm not very worried about this aspect.

Apocalypse:
Paul, the SEPIC design is in the LM3410 data sheet found Page 25-33 here. Is this the one poor in detail? I'm not sure which SEPIC design to use.

No, what seemed to be poor in detail was the laserpointerforums.com page - the SEPIC design requires two inductors and I could only see one in the pictures there.

Apocalypse:
Also, wouldn't the driver regulator keep the current constant or near constant as the voltage changes with the temperature?

That's what I said. The capacitor is enough to smooth out the current pulses from the regulator, but will follow variations in the laser performance over millisecond intervals.

Apocalypse:
I was also worried about the switch-on surge that can potentially kill the diode but since this design has been use many times with the same diodes, I'm not very worried about this aspect.

As best I can see, there is nothing about the regulator design that would cause a switch-on surge.