# How to power and switch a laser diode?

I am quite new to the Arduino business and up until now managed to create a Hexapod robot from a kit based on the Arduino Mega 2560, add Computer Vision and let him crawl around to find target objects. Now I want to destroy the target (in this case... Clover). So I just bought a laser diode with 200mW optical power, 3-5V input voltage and the additional info "<300mA" current (which would mean an overall consumption of 900mW at 3V?). It has its own build in current regulator as it seems. The robot is powered by 2x3,7V in series (=7,4V) batteries. Assuming I measured the actual power consumption and total current of the laser, I have trouble determining:

• which transistor to use for switching the laser with an Arduino pin (40mA max current)
• how to regulate the Collector voltage to 5V from the 7,4V source

I understand that I first have to measure the current of the laser to determine the Ic for the transistor. After that, I select the transistor and calcuate the needed Ib (<40mA). The result would be the right Base resistor put between the Pin and the Base. If this is the right way to do it, switching is now possible. Now the laser power suplly: - Should I use a voltage regulator for 5V output? I am not realy familiar how these parts work. Do I only select one which has an input voltage rating around 7,4V, outputs 5V and is sufficient for the desired Ic current? Do I need a heat sink?

If the voltage redulator is the right choice, I would

• connect 7,4V to the Input of the regulator
• connect GND to GND of the regulator
• connect Output of the regulator to the laser Input
• connect the Output of the laser to the collector of the transistor
• the emitter of the transistor will connect to GND again

Is this the right way? How do I calculate the resistor, transistor and regulator rating right for the expected voltage decrease when the batteries run low over time? As I understand it, Ib will decrease and so will Ic. I should calcuate Ib in reference to Ic, so that Ic is >= the laser current drain even on 6,5V power supply and pin voltage of what? 4,5V?

• 1. "destroy the target" - Please only use a laser that strong, if you really know exactly, what you are doing! Use laser safety glasses for the used wavelength! That laser can easily make you blind. Not only when directly shining in your eyes, but also via reflections. 2. Your reasoning seems good to me, though this question is better fit for Electrical Stackexchange, since the Arduino is not really important in your question.
– chrisl
Commented Jun 9, 2020 at 7:15
• 3. As of sharing my own experience: A bit ago I used a logic level MOSFET transistor to switch the driver of a 500mW laser diode for engraving. I did it similar to what you plan, but only with a MOSFET instead of a bipolar transistor.
– chrisl
Commented Jun 9, 2020 at 7:15
• thank you chrisl for your answer. The Electrical Stackexchange would indeed be better. But since you answered: I must admit, MOSFETs and especially the different types are a bit unknown to me. I did a quick read-through, and I understood that MOSFETs act similar to transistors but without the current multiplier? Is there a voltage drop from Gate to Source? Which type of MOSFET is right for my application. I also understood your concerns regarding safety. I have these too and do plan safety measures.
– seb2010
Commented Jun 9, 2020 at 7:43
• Do you have a datasheet or product designator? Commented Jun 9, 2020 at 9:52
• MOSFETs are a type of transistor. They are optimized for acting as low resistance digital switches. You drive them to saturation using a CMOS input, and their "ON" resistance is tiny. As a result they cause a very low voltage drop and very little heat dissipation. Choose a logic level MOSFET with high enough power for your application, and you should be able to all but ignore the resistance. Commented Jun 9, 2020 at 18:40

I would second the safety aspect. Lasers are not toys. There is a departmental story that a student a few years ahead of us permanently lost vision in both eyes because he happened to walk into a lab whose laser was on. The laser wasn't even pointed at him, just him glancing at the reflected light was enough to cause serious eye damage (the eye does get drawn naturally to bright spots).

An important principle in laser safety is that you can control variables associated with where the beam is pointed, that it is enclosed and that you can control access while the beam is on. A robot moving around with a non-eye safe laser sounds like a recipe for trouble, unless you can control all the above variables, such as doing the tests in a locked room.

• thank you for the concern. I am already reluctant to use this setup and I am not taking it as a toy. Commented Jun 9, 2020 at 9:46

There are strict regulations in several country how to deal with laser with different output classes. Your falls mostlikely under https://en.wikipedia.org/wiki/Laser_safety#Class_3B - those are no toys at all and nothing you put onto an unrestricted actuator outside of a laser safety workspace! Most people forget that they do not put only their safety and wellbeing at risks but others as well.

Optical devices like LEDs and LDs normally come with "typical" I-Pout and I-U plots. Reason is that the output power depends on the flowing current and not the voltage (at least not directly). So what you need is actually a controlled current source or sink. One can use a setup like https://en.wikipedia.org/wiki/Current_source#/media/File:Op-amp_current_source_with_pass_transistor.svg although I typically use a n MOSFET and place the load between supply and drain. So the OPAMP does not has to ramp up the voltage all the way above LD + LOAD + threshold. A MOSFET has the advantage that one "only" needs to provide enough current to (dis)charge the gate fast enought. BJTs have their merrits as well as but here one would require a rather stable and high beta factor which is not easy to get as far as i know. One has to note that the circuit is without filtering which can lead to instabilities etc. There are more sophisticated version available as well with filters included. One can use dedicated LD drivers as well. Using an "unregulated" like you suggest might work but normally one is expected to pulse the LDs for the maximum power output as else the thermal stress will be to high and LDs are more efficient the higher the current. The calculation you suggest is in theory the right way but the actual characteristics of LD and transistor depends e.g. strongly on the temperature so without stabilization the circuit is not really precise. Using an LDO in front of the LD might work or fail depending on the type of LDO. The chosen one needs to be able to deal with "open circuit/no load" and with high enough current peaks. If you need a current sink/source approach there is no need for an LDO as the current source circuit will take care of the "burn excess voltage away" part.

• ok now, in the second part you lost me. I believe, that the diode ordered comes with its own current regulating circuit. Commented Jun 9, 2020 at 9:49
• @seb2010 Well if that LD really comes with a built in regulation circuit you just need a "turn off/on". I find it hard to belief someone would build a regulator without control pin, as turning the whole circuit regulator on/off asks for trouble. Anyhow then a MOSFET should be enough to turn on the voltage. No need to calculate any current stuff then. Commented Jun 9, 2020 at 9:56

Use a MOSFET to switch the laser. (A logic-level eg. 2N7000 is not enough because it has a high on-resistance that will impede the current to the laser and overheat the transistor.) Use something like an IRF540N. You probably don't need a heatsink.

Note: Do not buy power transistors on Amazon or EBay! They are some of the most counterfeited items. Get them from a reputable dealer like Mouser or Digikey.