Please review - Turn green laser module on/off with arduino


This is the only way I was able to control (turn on/off) my green laser module with my Arduino board. I made the same mistake other people have made connecting the laser module directly to the board, which, for some reason does not work.

I am using:

One NPN-type transistor called a TIP120. One 5mw green laser module My Arduino Uno board

My code:

const int transistorPin = 9;    // connected to the base of the transistor

void setup() {
   // set  the transistor pin as output:
   pinMode(transistorPin, OUTPUT);

 void loop() {
   digitalWrite(transistorPin, HIGH);
   digitalWrite(transistorPin, LOW);

If you see something wrong with my schema please let me know...


Off the top of my head I don't know the pinout for the TIP120 but assuming you have the transistor in correctly you should have a resistor from the Arduino to the base (no resistor is shown). Collector to the laser and emitter to GND.

Also, how much current does the laser draw? Maybe the Arduino regulator is objecting.


This is the pinout for the TIP120

About the resistor, where exactly do I have to put it? From pin 9 to Ground? From Base to ground? Between pin 9 and Base? Sorry I ask but I am new to electronics.

The laser module is this one according to the description the max current is 300 mA.

Between pin 9 and Base, 200-1k ohms should be fine.


I have a bunch of 330 Ohm - 1/2 watt resistor. Can I use one of these?

Just to understand, what is the purpose of having a resistor between pin 9 and Base?

Thanks for all the help.

To limit current flow to the base of the transistor, as it has low resistance.

h(fe) = 1000, for this transistor. I(c) = 300 mA in your case, than base current has to be more than: 300 / 1000 = 0.3 mA By Ohm law, R = V / I ; so, R = ( 5 V (pin 9) - 2.5 (base emitter tip120) ) / 0.3 mA = 8.33 kOhm ;

Resistor should be less than 8.33 kOhm, anything in range 1 to 8 kOhm is o'key.

ok thanks a lot. I think I have a 1K Ohm resistor that I can use.

I wonder why the examples in this page don't show any resistor between pin 9 and the base?

There is a ambiguity, on picture they install IRF510 or IRF520 MOSFET, as you can see marking "FET" on the body of the transistor. And FET doesn't require resistor, as no DC current. It bad practice, IMHO resistor has to be any way, to limit charging gate-source capacitor current. On low frequencies arduino will survive such mistreatment at least.

But in description to the picture: "Connect the base to an output pin of the microcontroller, and the emitter to ground like so: "

That is WRONG., If transistor is MOSFET, description must be: "Connect the GATE to an output pin of the microcontroller, and the SOURCE to ground like so: "

if transistor TIP120, you already know what to do -):

Also you may have burnt out the laser unit if you are not using a laser diode driver circuit.

I wonder why the examples in this page don't show any resistor between pin 9 and the base?

Because that is a very lame web site written by people who don't know what they are doing. Most of their projects contain errors like this.