Hacked pulsed laser driver using Arduino

  • #1
neanderthalphysics
53
6
TL;DR Summary
Want to be able to hack a laser pointer to pulse according to an input signal from an Arduino. Have transistors, stepper motor drivers, oscilloscope and other basic electronics to play with.
Hey all, I am trying to hack a 5mW laser pointer to be pulsed according to a driver signal from an Arduino. The laser pointer itself has an internal forward bias resistance of 22k and is driven by 2x AAA batteries.

An oscilloscope says that the output voltage from the Arduino is a +5V continuous square wave function as intended.

I tried at first driving a NPN transistor directly from the Arduino (emitter - base loop), with the collector-base loop containing the 2x AAA batteries in series to the laser but for some reason it is not powering the laser.

Any ideas why? Happy to test and provide pictures/diagrams if necessary.

What about driving the laser pointer using a stepper motor driver (like an A4988 chip) instead? I will need to have voltage and current dividers to protect the laser.

Also, one final question about safety. If the laser pointer is overdriven by voltage or current, do I risk the laser becoming a hazard to the eyes?
 

Answers and Replies

  • #2
resurgance2001
185
5
Try driving the laser with the transistor circuit on its own without the Arduino first and get that working. Lasers are dangerous to eyes period. No? Overdriving an diode is likely just to burn the thing out. Unless you are already staring at the laser I don’t see how this could be a danger to eyes.
 
  • Like
Likes sysprog and neanderthalphysics
  • #3
sysprog
2,613
1,783
Why do you want to do this? If I wanted to do this I'd use a 555 timer IC. Depending on your especial purposes, something else might be a preferable option -- and please understand that, even though some people use laser pointers as feline amusement devices (cat toys), lasers are seriously not toys.
 
  • Like
Likes neanderthalphysics
  • #4
neanderthalphysics
53
6
Hey sysprog, thanks for the advice. Because I don't have this IC in the lab at the moment and I would have to order it and it would take a few days to arrive. Thought I could get quick results with just a transistor.
Understood about lasers not being toys, I use safety googles.
 
  • #5
sysprog
2,613
1,783
I'm shocked to learn that you don't have any 555s lying around! What are you? NOT Radio Shack? What's up with THAT? You probably don't have a DTMF decoder either!
:rolleyes:
 
  • #6
Borek
Mentor
29,167
3,843
NPN transistor "eats" some of the voltage (something like 0.6 V give or take), I would try MOSFET.

It doesn't have to be THE reason, but trying won't hurt.
 
  • #7
berkeman
Mentor
64,147
15,360
Understood about lasers not being toys, I use safety googles

I don't think you've said what wavelength/color your laser pointer is. What laser safety rating do your goggles have (not googles)?
 
  • #8
sysprog
2,613
1,783
I don't think you've said what wavelength/color your laser pointer is. What laser safety rating do your goggles have (not googles)?
Thanks for those good words of warning.

Even a welder's helmet may not be secure enough against strong coherent light, but the power rating specified (5mW ) is such that stopping looking when you feel discomfort during a 'less than half a second' glance will probably not hurt (or seriously and permanently eff up) the retina -- "and don't let lasers get pointed into eyes!".

Regarding visible light laser spectra: blue is great for computer network channels because of the bandwidth, and green is great for firearm-aiming optical devices because we have for that range of frequencies more of the right variety of cones in our retinas, but I suppose almost everyone reading here on PF already knew all that. :wink:
 
  • #9
neanderthalphysics
53
6
Firstly thank you everyone for your input :smile: I am eager to learn new things.

One question I had for you all was whether transistors are the solid state analogues of flashtubes? In flashtubes you need a trigger pulse across a smaller spark gap (analogous to the base-emitter junction) to turn the thing to a conducting state.

I'm shocked to learn that you don't have any 555s lying around! What are you? NOT Radio Shack? What's up with THAT? You probably don't have a DTMF decoder either!
:rolleyes:
Hey, you forget this is Stone Age physics. In my cave I have my club, bearskin, fire pit and a few other goodies. 555s appeared only a few thousand years later :wink:


NPN transistor "eats" some of the voltage (something like 0.6 V give or take), I would try MOSFET.



It doesn't have to be THE reason, but trying won't hurt.

Thanks, that explains some of the voltage drop. Why do transistors have a voltage drop but not MOSFETs?

I don't think you've said what wavelength/color your laser pointer is. What laser safety rating do your goggles have (not googles)?

Green laser pointer. I am using orange goggles with a 5 log reduction in the wavelength range.


Thanks for those good words of warning.

Even a welder's helmet may not be secure enough against strong coherent light, but the power rating specified (5mW ) is such that stopping looking when you feel discomfort during a 'less than half a second' glance will probably not hurt (or seriously and permanently eff up) the retina -- "and don't let lasers get pointed into eyes!".

Regarding visible light laser spectra: blue is great for computer network channels because of the bandwidth, and green is great for firearm-aiming optical devices because we have for that range of frequencies more of the right variety of cones in our retinas, but I suppose almost everyone reading here on PF already knew all that. :wink:

Yeah but we have to still be careful about the stated powers of laser pointers. I read some warnings that some laser pointers true powers exceeded the declared ones, at great hazard to the user's eyes.

By the same token from a safety perspective green lasers are best at causing lasting retinal damage...
I could switch to red but I also don't happen to have one lying around ATM.

I don't understand why the bandwidth is greater for blue (because of the higher frequencies?) If data is transmitted by on/off states then the bandwidth for IR should be the same as UV.
 
  • #10
Tom.G
Science Advisor
Gold Member
4,691
3,447
I tried at first driving a NPN transistor directly from the Arduino (emitter - base loop), with the collector-base loop containing the 2x AAA batteries in series to the laser but for some reason it is not powering the laser.

Aiie, there be a problem! The LASER and battery should connect to Collector and Emitter. Negative to Emitter and Positive to Collector.

And maybe another one -- are those AAA batteries perhaps Lithium batteries. A quick web search shows at least some Green LASERs have a threshold volatge around 6V, not the apparent 3V you may be using... but you don't say.

The Emitter should also be connected to the Arduino Ground (Common), and the Arduino output to the Base.

There should also be a series resistor between the Base and the Arduino output to limit Base current. You didn't give a part number so YOU look up the transistor data sheet for the maximum base current and select the resistor accordingly.

Oh, by the way, 5mW of laser power Will cause eye damage, even by reflection from a surface. If I recall correctly, here in the US, anything above 2mW must generally be enclosed with interlocks to shut it off if the enclosure is opened. Eye discomfort is assuredly NOT a means of detecting damage, the eye retina does not have any pain receptors. The first indication of damage is you have a blind spot; for life.

Cheers,
Tom
 
Last edited:
  • #11
trurle
508
206
Summary: Want to be able to hack a laser pointer to pulse according to an input signal from an Arduino. Have transistors, stepper motor drivers, oscilloscope and other basic electronics to play with.

Hey all, I am trying to hack a 5mW laser pointer to be pulsed according to a driver signal from an Arduino. The laser pointer itself has an internal forward bias resistance of 22k and is driven by 2x AAA batteries.
Edit: your circuit is incorrect. Laser and batteries must be connected in emitter-collector loop, not collector-base.
Also, 2xAAA may have a problem driving blue lasers with NPN driver. Either add third AAA cell or use MOSFET drivers.
 
Last edited:
  • #12
neanderthalphysics
53
6
Hi everyone.
Attached are my circuit diagrams and oscilloscope traces. The legend on the graph corresponds to the locations marked in the circuit diagram.
The voltage of the two AAA batteries is 2.74V. By themselves they run the laser pointer fine.
The driving signal is a +5V/0V, 2 second period, square wave.
Will read the latest responses now.
Any other readings/info you need I will be happy to provide.
 

Attachments

  • voltage_time_history.png
    voltage_time_history.png
    6.8 KB · Views: 186
  • circuit_diagram.png
    circuit_diagram.png
    13.6 KB · Views: 182
  • #13
Borek
Mentor
29,167
3,843
Why do transistors have a voltage drop but not MOSFETs?

I am afraid I am not qualified to answer that in more details than "these are different devices with different principle of operation, no wonder they behave differently". Precise answer needs to dissect how the np junction works.
 
  • Like
Likes neanderthalphysics
  • #14
neanderthalphysics
53
6
Thanks guys. How does this circuit look?
I note that the maximum base current of a TIP117 transistor is 50mA, which is more than the maximum current per GPIO of 40mA.
 

Attachments

  • circuit_diagram_v2.png
    circuit_diagram_v2.png
    16.7 KB · Views: 175
  • #15
neanderthalphysics
53
6
I am afraid I am not qualified to answer that in more details than "these are different devices with different principle of operation, no wonder they behave differently". Precise answer needs to dissect how the np junction works.

Thanks, I like it that you know the limits of your knowledge and are not afraid to say it :smile:

But let's hazard a guess for the sake of discussion. Could it be because MOSFETs are voltage operated devices, which means near zero current flow through the gate (hence 0-current x Resistance = 0 voltage drop) while transistors have a small base current which means a small voltage drop?
 
  • #16
sysprog
2,613
1,783
Tom.G said:
Oh, by the way, 5mW of laser power Will cause eye damage, even by reflection from a surface. If I recall correctly, here in the US, anything above 2mW must generally be enclosed with interlocks to shut it off if the enclosure is opened. Eye discomfort is assuredly NOT a means of detecting damage, the eye retina does not have any pain receptors. The first indication of damage is you have a blind spot; for life.
Pain is not the only kind of discomfort we can experience. Even reflected laser light from a cat-toy pointer off non-shiny surfaces is irritating to me and causes me to turn my gaze. Laser pointer beams inadvertently cast briefly across audiences can cause discomfort without causing pain or ocular damage.

From: https://www.ehs.uci.edu/programs/radiation/Laser%20Pointer%20Safety%20Factsheet.pdf
Possible optical hazards include startle effects, flash-blindness, glare, and after-images if a person is struck in the eye. Reports of those exposed include automobile drivers, airplane and helicopter pilots, sports figures, and the police. This is very dangerous since such exposures can cause serious accidents. Longer eye exposures can cause more permanent eye damage including retinal burns.
But when I just now asked myself, what would Safety Joe do, the answer was always be heedful of the advice of such advisors as @Tom.G
 
  • #17
neanderthalphysics
53
6
Here are the oscilloscope readings for the circuit with the laser + battery put across the emitter-collector terminals. The laser remains unactivated.
 

Attachments

  • voltage_time_history.png
    voltage_time_history.png
    7.3 KB · Views: 163
  • #18
neanderthalphysics
53
6
Here are the oscilloscope readings with 3xAAA batteries in series instead of 2. The laser is still inactive.
I tested the laser again with 2x AA batteries directly connected to it. It works.
 

Attachments

  • voltage_time_history.png
    voltage_time_history.png
    7.2 KB · Views: 166
  • #19
1,483
440
Hey, it's early and all but isn't the battery in the schematic in #14 upside down? If not it could explain why my stuff never works.

[note added in proof] upside down relative to the transistor. Seems like the laser diode should be flipped around as well.
 
  • #20
neanderthalphysics
53
6
I thought it is +ve terminal of the battery to +ve terminal of the diode and vice versa?
 
  • #21
1,483
440
I thought it is +ve terminal of the battery to +ve terminal of the diode and vice versa?
The current by convention flows from the + terminal to the - terminal of the battery. What has me confused is that the current flow for a saturated NPN is down through the collector and out through the emitter. In your diagram the current is flowing up through the emitter and out the collector.
 
  • #22
Tom.G
Science Advisor
Gold Member
4,691
3,447
Hey, it's early and all but isn't the battery in the schematic in #14 upside down? If not it could explain why my stuff never works.

[note added in proof] upside down relative to the transistor. Seems like the laser diode should be flipped around as well.
Yes! Most definitely.
 
  • #23
neanderthalphysics
53
6
Thank you for your advice.
I implemented the changes you suggested but it is still not working.
 

Attachments

  • circuit_diagram_v2.png
    circuit_diagram_v2.png
    17.4 KB · Views: 151
  • voltage_time_history.png
    voltage_time_history.png
    7.2 KB · Views: 159
  • #24
davenn
Science Advisor
Gold Member
9,651
9,180
Thank you for your advice.
I implemented the changes you suggested but it is still not working.


you DIDNT change it ... the battery terminals are still incorrect relative to the transistor
 
  • #25
1,483
440
I also suggest replacing the laser with a 1k dummy load resistor. The laser is a diode which permits current flow only in one direction so getting it in wrong is a show stopper. Check the voltages across the the resister and make certain the transistor is switching as expected before substituting the laser.
 
  • #26
neanderthalphysics
53
6
OK thanks for your input.
I replaced the laser diode with a resistor, and the battery with a lab PSU set at 3V.
I am still getting a flatline of voltage across the resistor. The PSU reports no current flowing through it.
Think all my experimentation has killed the transistor?
 

Attachments

  • voltage_time_history.png
    voltage_time_history.png
    6.8 KB · Views: 123
  • circuit_diagram_v4.png
    circuit_diagram_v4.png
    11.5 KB · Views: 126
  • #28
1,483
440
Okay, one needs a battery. ##V_{BE}## should be about +0.7V for a silicon NPN for it to be saturated. ##V_{CE}## in this state would be zero should the battery be absent. Your scope trace shows a negative ##V_{BE}##. Signs of voltages and currents really matter here. An NPN is like a current control where a small current, ##I_B##, injected -into- the base results in an ##I_{E}## ##\approx \beta I_{B}## where ##\beta\approx 100##. I think the transistor (any NPN transistor) spec sheet would have all these things plotted and would be helpful for you.
 
  • #29
neanderthalphysics
53
6
OK guys, got it working :smile:
Thanks for everyone's help.
The problem was the transistor - it was faulty.
Replacing it with another transistor got the circuit to work.
The circuit without the battery with a PSU instead is attached below.
 

Attachments

  • circuit_diagram_v5.png
    circuit_diagram_v5.png
    10.7 KB · Views: 128
  • voltage_time_history.png
    voltage_time_history.png
    7.8 KB · Views: 130
Last edited:
  • #30
BvU
Science Advisor
Homework Helper
15,268
4,244
Looks as if it only works because the transistor is abused to short-circuit the "voltage" source (the psu)
 
  • #31
neanderthalphysics
53
6
OK, how would you improve it?
 
  • #32
rbelli1
Gold Member
1,047
412
How to use a transistor to drive an LED

Your circuit only works because the series impedance of the battery is high. If you put that on a strong enough battery you would instantly explode the transistor.

BoB
 
  • #33
neanderthalphysics
53
6
Thanks for the article. It is very readable and explains basic concepts which I have forgotten from my mammoth hunting classes.
 
Last edited:

Suggested for: Hacked pulsed laser driver using Arduino

Replies
30
Views
335
  • Last Post
Replies
10
Views
599
  • Last Post
Replies
3
Views
513
Replies
23
Views
3K
  • Last Post
Replies
6
Views
142
Replies
10
Views
2K
Replies
3
Views
421
Replies
0
Views
439
  • Last Post
Replies
7
Views
1K
Replies
8
Views
659
Top