turn laser on and off using PWM

Hi,

I got a project where I'm thinking about using 5 laser pointers turned on/off by arduino. I'm having a problem that I can't turn it on through PWM messages. When I connect the laser (that has 300mW) directly to the 3.3V and GND it works, but when I send the same voltage using one PWM pin (connecting only the pin and the GND to the pointer) it doens't work.
Does anyone knows what´s the problem?
Is there any other way of connection that it would work?

Thanks,
Henrique

Maybe the laser module doesn't work at just short of 500Hz.

and is there any other way to turn it on and off using arduino?
i tried passing through a button (+3 - laser - button - GND) and it worked, but I need to control it directly by the board.

Connect the wire that currently goes to +V to a digital pin, instead, and remove the switch.

Set the pin as an output pin using pinMode, then turn the pin on or off using digitalWrite.

PaulS, I'd already done this, but it didn´t work.

Could it be a current issue?
I saw that the pins send 40mA and the 3.3V pin sends 50mA. Could this be the problem that it works directly in the 3.3V and doesn't work with the digital pins?

I had tried the PWM pins and the digital and none of them worked.

Could it be a current issue?

Without knowing what laser you are trying to turn on/off, any response would only be a guess.

If it runs directly from the 3.3V pin, but not from a digital pin, it might be a current issue, although the 10mA difference shouldn't be that critical. It would make the laser a little dimmer, perhaps.

If the laser is dim on 3.3V, and doesn't come on at all when powered from a digital pin, then current is an issue, and you shouldn't be powering it from the Arduino pins at all.

The best thing for you to do is to post a link to the laser that you have (not a link to an e-bay auction, if that's where you got it), and the code that you are using to try to trigger the laser. A picture of how it is wired when the code posted is running would not be a bad thing.

I don't know what Arduino you have, so no idea of the current capability of the 3.3V supply itself. 300mW LEDS can require about 400mA to operate properly. Many Arduino versions cannot deliver this on 3.3V( I love winter projects with the smell of roasting FTDI chips !).

Certainly an arduino output cannot deliver this current, you need an external driver from a suitable PSU.

When I connect it to the 3.3 or 5V and GND it works and when I connect to the pin I got no output at all from the laser. no dimming.
I'm testing with the most simple code:

void setup() {
pinMode(12, OUTPUT);
}

void loop() {
digitalWrite(12, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(12, LOW); // set the LED off
delay(1000); // wait for a second
}

About the connections, I just connected the '+' from the laser to 3.3V (or to pin 12) and the '-' to the GND.

This is a link for a picture of the laser. unfortunatly, where I bought it they give no specifications and in the box it only says that it´s got 300mW and works with 2 AAA batteries.
http://1mpar.com/1542_1.jpg

i-bot, I´m using an arduino mega.

the box it only says that it´s got 300mW

Have you measured the current drawn by the laser?
I make that 100mA at 3V.

Looks like you are in the market for a transistor...

Pick up a transistor or a mosfet for it. Then you can drive it with whatever voltage it needs and try to see how well it will work when using PWM.

You'll need some resistors. They will depend on what device you pick.

I is not clear why the OP is connecting the laser supply to a PWM output. If the idea is to actually modulate the laser this way, there may be a problem.

I once wanted to modulate the beam from a dollar-store laser module by switching the power on and off. It worked okay up to about 10 Hz, but after that the circuit seemed unable to turn on. I didn't look carefully, but my bet is that there is a capacitor in the current source circuit somewhere and it just flat out won't modulate any faster than the RC time for that.

Agree with gardner - I got a laser pointer module up to maybe 100Hz, but no higher.
If you want to go faster, you'll have to interface directly to the diode.

all i need to do is turn on and off the laser. I was using the PWM pin only to send on /off messages.

I have had a laser pointer running @5V for the last 5-6 years , I bridged the switch with solder, that's after I ran it continuously for months with a cloths peg holding the switch "on".
From your photo it looks like mine, I ripped it out of the case and just hooked it up to a 5V supply, switched with the first transistor I found in my junk box.
If it ran on 3 "button" cells you might not have enough current and voltage to get the laser control circuit to "come up".

It's only REALLY cheap laser pointers that don't have the whole feedback circuit from the actual laser diode.

Don't feed current straight into the laser package, if it's got 3 pins it WILL need the feedback circuit, or the device will not last very long.

3V probably isn't enough to power the laser AND it's control circuit, if it had 3 "button" cells that's at least 4.5V, a bit more if they are fresh cells.

This is a link for a picture of the laser. unfortunatly, where I bought it they give no specifications and in the box it only says that it´s got 300mW and works with 2 AAA batteries.

Something or someone is very mixed up here. Laser pointers are very low power devices, typically 5mw or less by law. A 300mw laser would be much much larger and of course could not possibly be powered by two aaa batteries. It would also be a very costly laser module. Now 300mw LEDS are very common these days but 300mw lasers are not. A 300mw laser is not a safe or even legal hobbyist device.

As far as driving a small pointer laser via PWM, is suspect that won't work as the pointer has it's own driver built in and probably not compatible with a PWM input signal. Just turn it on and off via a digital output pin (I have done this with a small laser module I have, it drew about 13 ma as I recall at 5vdc.).

Lefty

The pictured 300mW unit probably is real and these days that is relatively "low" powered.
There are plenty of 100mW+ laser articles on Hack A Day.

The guy on Hack A Day that posted video of his Star Trek "Phasor" bursting balloons across the room states his 350mW blue laser diode only draws 450-500mW.

Some of the blue laser diodes from Blue Ray Burners push upwards of 1W!
But I'm not about to take my BDROM burner to bits to complete my RGB laser scanner!
(Yes, I stupidly bought a Blue Ray burner and I'm still the only person I know with one! BUT I can back up 25G or 50G, @ AUS$1/G, sigh)

That idiot Kip Kay from Make had a stupidly dangerous tutorial about putting blue laser diodes in Bic lighter casings AND lighting cigarettes right in front of his face, with no eye protection, but that's Kip Kay for ya!

I just bought a 10mW red laser diode and a 10mW green laser pointer, but I won't be operating that version of my laser "wobbler/scanner" indoors without a low power setting!

So far the most powerful laser diode I have is a 250mW and an older 100mW Infra-red module from laser printers.

The higher resolution the laser printer or bromide/film printer is, the higher the laser diode output is, probably because the scanning mirror is spinning faster.

The Linotronic 4000 dpi film printer I used to work with had a HUGE laser diode module, that one was rated at 500mW and it got really hot, especially when you printed out full A0 film or bromide.

I've used the infra red diodes behind diffusers, turned right down as "night shot" illumination for my Sony camcorder.

The upshot of all this is, they might not be safe or legal, but there a plenty of ridiculously high powered laser diodes and pointers for sale!

You can change a power supply source and see if it's back to normal.