This 100mW laser module emits a small intense focused beam of visible red light. The example provided below shows how the module can be used with an Arduino and photo resistor module (available here) to perform basic remote signaling.
Warning: This is a low power laser device, however as with all laser devices care should be taken when in use. You should never look directly in to its beam or point the laser at another person. Doing so may cause permanent eye damage. This item is not suitable for children.
Item Code: HCMODU0104
Operating voltage: 5V
Max Current (Laser on): ~30mA
PINOUT
Please note: Current shipped modules have a screenprint error. Please see pinout below for correct connections.
Pin 1 (-) 5V
Pin 2 Not connected
Pin 3 (S) GND
This module can be purchased here.
Receive Sketch
Code: Select all
/* Laser receive sketch */
/* Sets the threshold level.
If the 'L' LED stays on when the laser is not on then increase this value.
If the 'L' doesn't light up when the laser is on then reduce this value */
#define THRESHOLD 100
/* Used to control the 'L' LED on your Arduino */
#define LED_PIN 13
/* Connect the 'S' pin of your LDR module to analogue pin A0 */
#define LDR_PIN A0
void setup()
{
pinMode(LED_PIN, OUTPUT); // Set the LED pin as an output
}
void loop()
{
/* Has the laser been detected? */
if(analogRead(LDR_PIN) < THRESHOLD)
{
digitalWrite(LED_PIN, HIGH); //If so then turn the 'L' LED on.
}else
{
digitalWrite(LED_PIN, LOW); //If not then turn the 'L' LED off.
}
}
Transmit Sketch
Code: Select all
/* Laser transmit sketch. */
/* Connect the 'S' pin of the laser to pin 13 on your Arduino. */
#define LASER_PIN 13
void setup()
{
pinMode(LASER_PIN, OUTPUT); //Set laser pin as an output
}
void loop()
{
digitalWrite(LASER_PIN, HIGH); //Turn laser on for 1 second
delay(1000);
digitalWrite(LASER_PIN, LOW); //Turnlaser off for 1 second
delay(1000);
}