Help calculate Rb for controlling laser using transistor

I am trying to use a BC547B NPN transistor as a switch to control a 5mW red laser, but I can't get it to work.

I believe it is because I have the wrong resistor to control the current on the base.

Does anyone here know how I can calculate R1 in the sketch below?
Please ignore the laser component name (QED123), it is just a side effect of picking a random LED component to symbolize my laser.

I am unfortunately stuck. Have tried random values for R1, but no luck.


Is that a 5V-ready laser module?

What's the 5V for the circuit, the Arduino "5V"?

BC547, looking at its datasheet, pinout is "unusual" - looking at the face with the leads pointing down it's C-B-E (not E-B-C). Could that be the problem?

I suppose RB = 220? to 1K ought to do it.

yes, the laser module is 5V compatible (says 4.5V typical) and it lights up when connected directly over the 5V source.
It is one of these: Seeed Studio Bazaar, The IoT Hardware enabler.

The 5V comes from a breadboard power supply.

It is very strange, I too noticed the pinout and I am pretty sure I have it right.
I also guesstimated the same range as you, but I have had no luck. Tried the following values for R1
39 Ohm
175 Ohm
1K Ohm
10K Ohm

Maybe I managed to blow the transistor... need to switch to another one to double check.

Can't figure out why it's not working. Must be something silly.


First, figure out how much Ic you will need.

That figure divided by 10 gives you Ib. From there, you calculate Rb.

so the datasheet for the laser module says
Working current: Min 10mA, Typical 20mA, Max 25mA

This gives me:

  • Ic = 20mA = 0.020A
  • Ib = Ic/10 = 0.002A
  • Rb = Vs/Ib = 5/0.002 = 2500 Ohm

Tried with a 2.7k Ohm and nothing happened.

Then I put in a fresh transistor, figuring I might have blown the old one after all the experimentation and it WORKS!

Where did you the magic number 10?
The datasheet for the transistor says hFE DC current gain 200 (minimum).

Many thanks!


The working circuit: