Go Down

Topic: Please review - Turn green laser module on/off with arduino (Read 5035 times) previous topic - next topic



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:

Code: [Select]

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...



Feb 21, 2011, 07:49 am Last Edit: Feb 21, 2011, 07:50 am by Graynomad Reason: 1
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.
Rob Gray aka the GRAYnomad www.robgray.com


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 http://www.sparkfun.com/products/9906 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 http://itp.nyu.edu/physcomp/Tutorials/HighCurrentLoads 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.
"Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent di


I wonder why the examples in this page http://itp.nyu.edu/physcomp/Tutorials/HighCurrentLoads 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.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131