Arduino Forum

Using Arduino => General Electronics => Topic started by: nickgammon on Apr 14, 2015, 04:07 am

Title: Does anyone know how to wire up the KY-008 Laser Transmitter Module?
Post by: nickgammon on Apr 14, 2015, 04:07 am
I got a batch of these "KY-008 Laser Transmitter Module" (for Arduino, heh) from eBay.

The wiring information is sparse, and after extensive searching I've read that you put +5V to the "-" pin and Gnd to the "S" pin, and vice-versa. I've also found that the middle pin is "the middle pin".

Here are a couple of them (from the same batch):

(http://www.gammon.com.au/images/Arduino/P1080984.JPG)

(http://www.gammon.com.au/images/Arduino/P1080986.JPG)

You will note that the "-" and "S" pins are reversed. Also one has a 1k resistor and one has a 10k resistor (R1).

The resistor, whose purpose is not totally clear, seems to connect the middle pin to the upper pin.

It's almost as if some are wired on the underside of the board, however that doesn't totally make sense (the other side is not marked "S" and "-").

They appear to work if you apply Gnd to the lower pin (in the photo) and +5V to the upper pin. However if you apply +5V to the middle pin they are much duller (presumably the resistor is in series).

They appear to consume around 30 mA.

Does anyone have any suggestions about wiring? The 10k series resistor seems a bit much, presumably a smaller resistor would be required for current limiting…
Title: Re: Does anyone know how to wire up the KY-008 Laser Transmitter Module?
Post by: Paul__B on Apr 14, 2015, 01:59 pm
I do not have one but have looked at the pictures before.

This is part of the three terminal "sensor shield" series - uses standard servo cables for connection.  The actual current limiting resistor for the laser is about 91 ohms, and mounted on the PCB chip that is in the laser cartridge proper.  The 1k/ 10k is a "pull-up" resistor provided for no particular reason.

If you connect it to an Arduino pin using the pins actually connected to the laser, it will operate.  That's about it. :)

Oh yes, the brass part is always positive.
Title: Re: Does anyone know how to wire up the KY-008 Laser Transmitter Module?
Post by: nickgammon on Apr 14, 2015, 11:22 pm
OK, thanks. I didn't spot the 91R resistor on the laser body. I see it now:

(http://www.gammon.com.au/images/Arduino/P1080996.JPG)
Title: Re: Does anyone know how to wire up the KY-008 Laser Transmitter Module?
Post by: Wawa on Apr 14, 2015, 11:36 pm
I have seen someone mention in a review that the 1k/10k connection is for PWM.
Leo..
Title: Re: Does anyone know how to wire up the KY-008 Laser Transmitter Module?
Post by: nickgammon on Apr 14, 2015, 11:59 pm
I measured a VF of 1.96V, so with a 91R resistor you would expect 33.4 mA from 5V, which agrees with what I saw.

With 1.091k it would be 2.78 mA so maybe that is designed to go directly to an Arduino output pin.
Title: Re: Does anyone know how to wire up the KY-008 Laser Transmitter Module?
Post by: Paul__B on Apr 15, 2015, 09:08 am
Maybe not.

This is a laser!

It has a threshold for amplification, below which it becomes a common LED.  Lasers can only be amplitude modulated over a limited range. PWM, yes - generally PCM.  There just might be a reason for a "keep-alive" current - I am not sure, but I suspect the extra resistor is just someone's idea of making it match other "sensor shield" devices.

Enjoying the twilight down there? :smiley-lol:
Title: Re: Does anyone know how to wire up the KY-008 Laser Transmitter Module?
Post by: nickgammon on Apr 15, 2015, 09:21 am
Since you asked ... this morning there was a loud "hiss" then a flash of lightning, then a loud clap of thunder almost immediately.

Various gadgets around the house went into spasms. The router had to be rebooted. My son's Minecraft server had to be rebooted. I had to be rebooted (just kidding).
Title: Re: Does anyone know how to wire up the KY-008 Laser Transmitter Module?
Post by: Paul__B on Apr 15, 2015, 03:53 pm
Hmmm.  How close was it exactly?
Title: Re: Does anyone know how to wire up the KY-008 Laser Transmitter Module?
Post by: nickgammon on Apr 15, 2015, 11:01 pm
I didn't see any trees on fire, so I'm not sure.
Title: Re: Does anyone know how to wire up the KY-008 Laser Transmitter Module?
Post by: rydepier on Apr 18, 2015, 11:40 pm
It seems that some boards were screen printed incorrectly and the manufacturers page simply recommended reversing the connections. I have had a number of these lasers from Chinese sources and found none of the incorrectly marked ones. With the laser pointing away from you the right hand pin, normally marked with a '-' is connected to ground. Ignore the middle pin and the left hand pin, normally marked 'S' should be taken HIGH to turn the laser ON. The simple Blink sketch can be used to check the laser and it responds well to PWM.
Title: Re: Does anyone know how to wire up the KY-008 Laser Transmitter Module?
Post by: nickgammon on Apr 19, 2015, 12:02 am
Yes, thanks, that seems to match what I've found.
Title: Re: Does anyone know how to wire up the KY-008 Laser Transmitter Module?
Post by: Paul__B on Apr 19, 2015, 12:30 pm
There cannot be terribly many exceptions to the brass shell being the positive.

Not to say that whilst most laser pointers are - therefore - configured so that the positive of the battery goes first in the battery sleeve, I have two of them (purple) whose batteries must actually be fitted the other way around.  This initially caused me much angst!
Title: Re: Does anyone know how to wire up the KY-008 Laser Transmitter Module?
Post by: jgrina on Aug 16, 2015, 05:22 am
I spent two evenings searching for information on the Keyes KY-008 laser module. The search included two reads through the information in the forum. I recognize some of the names on the list, and started with teir info, then searched the Internet for more info.

The module appears in the Keyes sensor shield group, as Paul_B pointed out. However there is little or no information about connections or usage. I went through eBay listings for the rest of the first evening, trying to find out more, but nothing was useful. I did encounter on sketch which had PWM working, I think, but it was late, or early, depending on your time zone, and I lost track of the sketch.

On day two, I decided to try the marginal information that I had.  It was no big deal, I bought two modules for ~$2.00, so I decided to keep working with one until it stopped working. There was one other clue. One of the listings had a module plugged into an Arduino board, no jumpers.  I could see that the "-" and "S" pins were plugged into GND and 5V, but could not see the middle pin. So I connected "-" and GND; pin 13 (LED) to "S" and ran the classic Blink example from the library. AHah! The laser and pin 13 LED blinked at exactly the same time. I added in the "middle" pin to the the connections, just in case there was a need for a full 5V source.

I called the new sketch Wink, not Blink, and played with it a bit. Seemed to work fine.

So then I used the AnalogWrite program from Tom Igoe to fade the laser in and out, switching to pin 11 because pin 13 does not support AnalogWrite PWM.

Several listings indicated that the "middle" pin had no function, and it appears they are right. Connecting gnd to "-" and the pwm pin (11), to the "S" pin works just as well, whether the "middle" pin is connected or not.

So, does this help to use the mysterious module?

I'm not happy about so many vendors selling this module with no idea of how it works, but the price is right. Even the Youtube tutorials were not very helpful about using it.

-------------------------------------------------------------------------------------------

 
Code: [Select]
/*
 _Wink

 This example code is in the public domain.

 Originally Mega analogWrite() test

 This sketch fades LEDs up and down one at a time on digital pins 2 through 13.
 This sketch was written for the Arduino Mega, and will not work on previous boards.

 The circuit and sketch were written by Tom Igoe for the Arduino Mega, but I changed it
 to an Arduino Uno as a single Laser.

 created 8 Feb 2009
 by Tom Igoe
 modified 15 Aug 2015
 by Jim Grina
*/

int laserPin = 11;// a pmw pin connected to the S pin
                   // the 3 pin Laser board has - connected to Arduino ground
                   // and 5V power to the "middle" pin

// the setup function runs once when you press reset or power the board
void setup()
{
 // initialize digital pin 11 as an output.
 pinMode(laserPin, OUTPUT);
}

// the loop function runs over and over again forever
void loop()
{

  for (int brightness = 0; brightness < 255; brightness++)
  {
    analogWrite(laserPin, brightness);
    delay(2);
  }
  for (int brightness = 255; brightness >= 0; brightness--) {
     analogWrite(laserPin, brightness);
     delay(2);
   }
   // pause off between cycles of Laser:
   delay(200);
}


Moderator edit: [code] ... [/code] tags added. (Nick Gammon)
Title: Re: Does anyone know how to wire up the KY-008 Laser Transmitter Module?
Post by: TomGeorge on Aug 16, 2015, 06:53 am
Hi,
Found this, read the review.

http://www.icstation.com/laser-transmitter-module-arduino-p-2768.html

Tom.... :)
Title: Re: Does anyone know how to wire up the KY-008 Laser Transmitter Module?
Post by: nickgammon on Aug 16, 2015, 07:18 am
Thanks for the extra info.
Title: Re: Does anyone know how to wire up the KY-008 Laser Transmitter Module?
Post by: Paul__B on Aug 16, 2015, 10:46 am
Yes, well as I explained before, this module is configured to match the "sensor shield" or model vehicle servo connection standard so if you connect it to such a shield, the 10k ("103") pull-up resistor will simply be providing some sort of "keep-alive" current to the laser diode via the centre "+" pin.  For a laser, this will be nowhere sufficient for it to amplify and  without such "laser-ing"action, it would not be particularly focused either with what little light it generates.

It is a bit of a mystery as to why this resistor was added at all (the "901" - 91 ohm resistor on the back of the laser module itself controls the current), but it will automatically match the standard shields if you use them.
Title: Re: Does anyone know how to wire up the KY-008 Laser Transmitter Module?
Post by: rshinks on Jan 27, 2016, 02:53 am
I just received my $0.85 KY-008 from a Chinese vendor (with shipping).  I had the same concerns about no directions, very glad to find this thread.  I tested the laser with a PWM routine (fade up / fade down) and it worked fine.  There does appear to be a minimum turn-on intensity, I did not bother to test where it was turning on yet.  I also put a small amount of non-water based glue between the brass body and the circuit board - just the thin little wires holding it on.  Should be much more secure now.
Title: Re: Does anyone know how to wire up the KY-008 Laser Transmitter Module?
Post by: Paul__B on Jan 27, 2016, 12:32 pm
Well, this laser should work with PWM, and indeed should probably function down to a PWM value of 1.  But this is of course, not a "minimum intensity", it is a laser and either on or off at any given moment.  As best I know, the turn-on time in the absence of capacitance should be in the microsecond or sub-microsecond range.

I am not short of lasers by any means, but I will buy a couple of these modules just for giggles.

Note that they appear to be focusable.
Title: Re: Does anyone know how to wire up the KY-008 Laser Transmitter Module?
Post by: Riva on Jan 27, 2016, 02:00 pm
They have gone down in price since I bought a bag of 30 (http://www.ebay.co.uk/itm/30pcs-per-lot-650nm-6mm-3V-5mW-Laser-Dot-Diode-Module-Red-Copper-Head-/140963232227?hash=item20d21039e3:g:GXwAAOxygPtSrS5s) about 14 months ago.
Title: Re: Does anyone know how to wire up the KY-008 Laser Transmitter Module?
Post by: Paul__B on Jan 27, 2016, 09:53 pm
Like many things on eBay, the price is very variable!

We are paying an awful lot for the PCB on the Keyes modules; I would not normally do that but I like to have specimens of things we discuss here. :smiley-lol:
Title: Re: Does anyone know how to wire up the KY-008 Laser Transmitter Module?
Post by: Riva on Jan 28, 2016, 08:07 am
I would not normally do that but I like to have specimens of things we discuss here. :smiley-lol:
Ha-ha, well put. I also have several bags and boxes of specimens that I hope to tinker with in more detail when I have time/retired.