Pages: [1]   Go Down
Author Topic: Please review - Turn green laser module on/off with arduino  (Read 3406 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.



I am using:

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

My code:

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




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

Thanks




Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8474
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: February 21, 2011, 01:50:49 am by Graynomad » Logged

Rob Gray aka the GRAYnomad www.robgray.com

0
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.



Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17263
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Lefty
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Montreal
Offline Offline
Faraday Member
**
Karma: 27
Posts: 2569
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

0
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?

Logged

Montreal
Offline Offline
Faraday Member
**
Karma: 27
Posts: 2569
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 -):
Logged

Australia
Offline Offline
Full Member
***
Karma: 8
Posts: 161
You dont have to touch powerlines for them to kill you, even looking at them for too long will make them angry.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

"Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent di

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 603
Posts: 33408
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Jump to: