Shop OBEX P1 Docs P2 Docs Learn Events
Turning a laser on and off — Parallax Forums

Turning a laser on and off

jason777jason777 Posts: 11
edited 2007-08-18 17:37 in BASIC Stamp
I have a laser pointer that runs on 3 small (1.5 volt) batteries.· Right now, I turn the laser on and off with a relay, and·a basic stamp·IO pin.

Is there a more solid state way I can operate the laser?· I'd like·to use a transistor, but wouldnt the laser need to be powered by the basic stamp supply for that?· I want to keep the laser using its own power source, if possible.

Thanks.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-08-01 19:13
    You could use an optoisolator, but there's always a little voltage drop (0.3V typically) across any transistor and that would reduce the supply voltage for the laser pointer a little. A relay is actually quite good for this. A small reed relay would provide fairly fast switching and wouldn't take much power (5V @ 20ma). This is only twice what an optoisolator would take.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-08-01 19:24
    Depending on the laser's current draw, you could also use an NMOSFET transistor, such as a 2N7000. Connect it as follows:

    ····Gate: Stamp pin.
    ····Source: Ground (both Stamp ground and battery minus terminal).
    ····Drain: Laser's negative supply lead.

    Leave the battery positive terminal connected to the laser's positive supply lead. For safety, also connect a 10K resistor between the gate and source. This will keep the laser off until the Stamp pin forces the gate high.

    -Phil

    Post Edited (Phil Pilgrim (PhiPi)) : 8/1/2007 7:30:42 PM GMT
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-08-01 20:14
    Jason,

    It sounds like you could just use a simple 2N3904 or 2N2222 transistor for this. It doesn’t have to be powered by the BASIC Stamp to use it. They just have to have a common ground. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • jason777jason777 Posts: 11
    edited 2007-08-01 20:57
    So let me clarify. To use the transistor, I must power the laser off the stamps supply? The laser needs 4.5v, but the stamp sends 5v. How do I handle that?

    Thanks for the help.· I'm a software engineer by day, and am starting to learn electronics as a hobby.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-08-01 21:02
    No, you can still use the batteries to power the laser. You just need to make sure that the Stamp and the laser share a common ground (negative supply).

    -Phil

    Addendum: Attached is a sample schematic...

    Post Edited (Phil Pilgrim (PhiPi)) : 8/1/2007 9:12:39 PM GMT
    320 x 247 - 2K
  • jason777jason777 Posts: 11
    edited 2007-08-01 21:08
    So I hook the laser ground to the stamp ground. Then connect the laser + lead to the source of the transistor, and drain to +5v?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-08-01 21:12
    No. See the schematic I posted above.

    -Phil
  • jason777jason777 Posts: 11
    edited 2007-08-01 21:19
    Ah, I see. Thanks alot guys, this was helpful.

    Off topic, what are you guys using to create those great looking schematic diagrams?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-08-01 22:20
    I use DesignWorks Lite from Capilano Computing.

    -Phil
  • MightorMightor Posts: 338
    edited 2007-08-02 06:08
    dr.evil.laser.jpg
    "You know, I have one simple request. And that is to have sharks with frickin' laser beams attached to their heads!"
    Powered by BasicStamp2, naturally.

    Parallax - the best a mad genius hell-bent on world domination can get.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    | What the world needs is more geniuses with humility, there are so few of us left.
    | "Wait...if that was a compliment, why is my fist of death tingling?"
    | - Alice from Dilbert
  • jason777jason777 Posts: 11
    edited 2007-08-18 04:07
    Sorry to bring up an old thread, but I couldnt get that particular transistor, but I did get a 2N3904.· Can someone show me how to wire this similar to the circuit posted above where the laser would use a common ground.· The whats a microcontroller book had a circuit that almost what I need (attached).
    267 x 241 - 5K
  • Mike GreenMike Green Posts: 23,101
    edited 2007-08-18 04:42
    The circuit you showed is the equivalent to the one Phil showed, just using an NPN junction transistor instead of an MOSFET. Vdd is the diode power source. You'll need to adjust the base resistor for the amount of current needed by the laser diode. These switching transistors have a minimum current gain of maybe 20-30. Assuming a diode current of maybe 40ma, you'll need about 2ma of base drive. At 5V, that calls for approximately a 2.2K base resistor. The two parallel resistors from What's a Microcontroller? were used because that's what was in the parts kit for other uses.
  • jason777jason777 Posts: 11
    edited 2007-08-18 05:46
    Would the attached circuit be closer to what I want?· I'm a little confused as to why i need to adjust the current to the transistor.· I want full power once the transistor is switched on.· Realize that the laser has a separate power supply (2 batteries).· I still dont completely understand why I need the common ground.· I'm not an electrical engineer, but rather a software engineer.· I just started learning the basics of electronics a couple months ago.·· I need specific details here, so I dont fry something. Thanks guys!
    431 x 274 - 7K
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2007-08-18 12:25
    That's like what I've done for a project recently.· In my application I didn't want to control the·laser current, I just wanted to switch it on/off and that's what you're showing.· That's a good circuit.· If the 10K works that's fine, I needed less (1K).

    Update -- You're now showing the "laser" connected to 6V, but you originally described it as a 3V hand-held.· That voltage still needs to be 3V.

    Post Edited (PJ Allen) : 8/18/2007 12:36:30 PM GMT
    422 x 287 - 8K
  • Mike GreenMike Green Posts: 23,101
    edited 2007-08-18 13:26
    You need the common ground because a transistor is a 3 terminal device. The base is (in this circuit) the control terminal. The collector is the output terminal. The emitter is the common terminal for the current into the base and into the collector, so has to be common to the input circuit and the output circuit.

    The base current has to be high enough so the transistor will saturate (switch completely on), yet not waste too much current. Most microcontrollers can provide around 20ma per I/O pin without becoming overloaded. As I mentioned, the minimum current gain (hFE) of most switching transistors is around 20-30.
  • jason777jason777 Posts: 11
    edited 2007-08-18 16:32
    Ok, I was wrong....the laser uses 2 1.5v batteries...so it is 3v. So what resistor should I use? 200k? How do I know? I'm using the BS2.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2007-08-18 17:31
    My circuit switches a "50mW" unit.· RB = 330ohms to 1K is OK.

    Update -- If minimising base current is essential then plug in (increasing) values till it starts going dim or non-op.· Experiment.· 300ohms to 1K is, I think, a good range to start with.· Don't go less than 220ohms.· Experiment.


    Post Edited (PJ Allen) : 8/18/2007 5:38:13 PM GMT
  • Mike GreenMike Green Posts: 23,101
    edited 2007-08-18 17:37
    The BS2 puts out 4.7V. The transistor base takes 0.6V of that. The resistor has to drop the remainder of that (you figure out the difference!) at the current you want. If you don't know how much current you want, at least limit it to what the BS2 can put out (What did I say that was? ... or look it up in the manual).

    Ohm's Law: E = I R.

    Solve for R, substitute the values for E (voltage) and I (current) and what do you get?

    Choose the nearest standard value (20% accuracy): 10, 12, 15, 18, 22, 27, 33, 39, 47, 56, 68, 82 and multiples of 10 of these.
Sign In or Register to comment.