Arduino Forum

Using Arduino => Motors, Mechanics, Power and CNC => Topic started by: JonathanCR on Feb 21, 2011, 06:31 am

Title: Please review - Turn green laser module on/off with arduino
Post by: JonathanCR on Feb 21, 2011, 06:31 am
Hi,

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.

(http://acodea.org/galeria/d/6295-1/schema.JPG)

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);
   delay(500);
   digitalWrite(transistorPin, LOW);
   delay(15000);
}





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

Thanks




Title: Re: Please review - Turn green laser module on/off with arduino
Post by: graynomad on Feb 21, 2011, 07:49 am
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
Title: Re: Please review - Turn green laser module on/off with arduino
Post by: JonathanCR on Feb 21, 2011, 09:11 am
This is the pinout for the TIP120 (http://itp.nyu.edu/physcomp/images/labs/tip120_pinout.png)

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.



Title: Re: Please review - Turn green laser module on/off with arduino
Post by: retrolefty on Feb 21, 2011, 09:14 am
Between pin 9 and Base, 200-1k ohms should be fine.

Lefty
Title: Re: Please review - Turn green laser module on/off with arduino
Post by: JonathanCR on Feb 21, 2011, 04:19 pm
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.
Title: Re: Please review - Turn green laser module on/off with arduino
Post by: Magician on Feb 21, 2011, 04:55 pm
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.
Title: Re: Please review - Turn green laser module on/off with arduino
Post by: JonathanCR on Feb 21, 2011, 07:31 pm
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?

Title: Re: Please review - Turn green laser module on/off with arduino
Post by: Magician on Feb 21, 2011, 09:42 pm
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 -):
Title: Re: Please review - Turn green laser module on/off with arduino
Post by: fliggygeek on Feb 22, 2011, 01:11 pm
Also you may have burnt out the laser unit if you are not using a laser diode driver circuit.
Title: Re: Please review - Turn green laser module on/off with arduino
Post by: Grumpy_Mike on Feb 24, 2011, 12:06 am
Quote
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.