3

What's the best way to control (turn on and off) a low-power 35mA 3V laser from a Raspberry PI GPIO pin?

The RPi GPIO pins support the right voltage but each can supply only a maximum of about 16mA, so it would be dangerous of me to try connecting the laser's +V line directly to a GPIO pin.

This post recommends I buffer the GPIO pin an NPN transistor, with current coming from the RPi's 5V rail, although I'd have to incorporate a voltage divider to ensure it supplies 3V. Does that seem right?

Cerin
  • 2,291
  • 8
  • 33
  • 49

3 Answers3

4

The RPi GPIO pins support the right voltage but each can supply only a maximum of about 16mA, so it would be dangerous of me to try connecting the laser's +V line directly to a GPIO pin.

Yes, you can't supply the laser directly from a GPIO pin.

I'd have to incorporate a voltage divider to ensure it supplies 3V

I don't think a voltage divider is a good solution, I suggest using a voltage regulator. Check LM317.

As @goldilocks suggested, you can use the 3.3V rail since it can supply up to 50mA. You can use a 10ohm resistor (8.2ohm would be better) in series with the laser to drop the excess 0.3V.

This post recommends I buffer the GPIO pin an NPN transistor, with current coming from the RPi's 5V rail

Yes, thats the way to go, but instead of the 5V rail, you will have to connect to the output of the regulator 3.3V rail in series with the resistor suggested above. The Vce of the BJT transistor would be around 0.2V, so you wouldn't really need a resistor since the voltage around the laser would be 3.1V.

DrenImeraj
  • 71
  • 6
2

I'd just use multiple GPIO, probably 4, and use a resistor per GPIO to limit the current from each GPIO to 9 mA. Then just switch all the GPIO on or off.

That would give a little control of brightness, even though it's not needed in your application.

You could also use PWM to control the intensity, it's just a little more complicated with 4 GPIO.

I have a spot red laser which is rated at 20 mA. I just connect that directly to a single GPIO.

I have measured the current flowing through my 20 mA red laser. I used two meters one not so inexpensive, one inexpensive.

Range   Meter 1  Meter 2 
200 mA  13.9 mA  13.5 mA
20 mA   12.89 mA 12.51 mA

I'm not sure if it's possible to work out the actual current from that pair of readings.

joan
  • 71,852
  • 5
  • 76
  • 108
1

How about an NPN common-collector amp sourced from the 5V supply? You can get lots of current out at about 3V. Note that the emitter will a slightly lower voltage than the 3.3V output and the transistor will drop the remainder from 5V. Add a 100 ohm resistor between the RPi output and the base, to protect the RPi from mishaps.

Lee
  • 11
  • 2