How to Connect Laser Modules with Arduino

Hi everybody !

I've just received my parts (laser modules and cds photoresistors) for building a laser harp.
Can anyone help me on how to connect the laser modules with arduino and see them working ?
The lasers i have are the following :
Laser Module - Green - SparkFun Electronics
and the photoresistors
Mini Photocell - SparkFun Electronics

As you understand i will use 6-7 laser modules and not just one with a splitter.
Thanks in advance and sorry if i posted this new topic in the wrong section

You will need a driver for each module consisting of a transistor or a FET, just like any other load.
Simply wire the LDRs between the analogue input and ground with a 100K resistor from each input to the +5V line.

Because i m completely amateur and my english is not quite well can you tell me the instructions with a simplier way or if that is easy,a schematic.

I know that i m asking a lot but after i connect one laser module to arduino ,what will be the source code just to set the laser module to on.

Thanks again !

what will be the source code just to set the laser module to on.

Connected to pin 4 through a transistor it would be:-
digitalWrite(4,HIGH);

If you do not know this how are you going to cope with the rest of your project?
A laser module is just like any other load like a motor. For schematics see:-
http://www.thebox.myzen.co.uk/Workshop/Motors_1.html

I've decided that it is not necessary to have the laser modules connected to arduino.
All i have to do is to power the laser modules with a PSU that i have like the picture below

Next step is to connect the photoresistors to arduino.
I think that might be the schematic

Is it correct ??

Can anyone suggest me a source code for testing if a photoresistor works when hitting it with a laser ?

To test this LCD circuit connect it to an analog input of the arduino and read that to see what values you are getting. It might be that there is not enough voltage swing to switch between digital levels.
I would start with a 10K resistor.

These are the specs of the photoresistors i have.

and these are the laser modules

You might have to put a diffuser over the sensor as the light from the laser might be too small to affect this bulk sensor.
How are you going to cope with ambient light changes?
Previous advice on resistor value still valid.

You might have to put a diffuser over the sensor as the light from the laser might be too small to affect this bulk sensor.
How are you going to cope with ambient light changes?
Previous advice on resistor value still valid.

Sorry Mike but i don't understand what you mean...
What exactly is a diffuser and why needed to put one on the photoresistor ?

To test this LCD circuit connect it to an analog input of the arduino and read that to see what values you are getting. It might be that there is not enough voltage swing to switch between digital levels.
I would start with a 10K resistor

And also here don't understand what you mean.
Sorry for not understanding some things (many things) but i m completely amateur.

I also found this schematic from another laser harp project and i am confused.As you see they have put the resistor on gnd and the 5v connected it directly to the photoresistor.

They made something like this unless i understand it wrong.

I've just tried the following source code with the schematic above using a 220 ohm resistance.

int lightPin = 0;  //define a pin for Photo resistor
int ledPin=11;     //define a pin for LED

void setup()
{
    Serial.begin(9600);  //Begin serial communcation
    pinMode( ledPin, OUTPUT );
}

void loop()
{
    Serial.println(analogRead(lightPin)); //Write the value of the photoresistor to the serial monitor.
    analogWrite(ledPin, analogRead(lightPin)/4);  //send the value to the ledPin. Depending on value of resistor 
                                                //you have  to divide the value. for example, 
                                                //with a 10k resistor divide the value by 2, for 100k resistor divide by 4.
   delay(10); //short delay for faster response to light.
}

and when i was hitting the phototresistor with the laser , at the serial monitor it was showing me some numbers from 15-17 and when hiitng with the laser was showing 280.What are these numbers ???
Can i use them in the source code ( for example if cds<280 play this note )

// Duelling Tones - Simultaneous tone generation.
// To mix the output of the signals to output to a small speaker (i.e. 8 Ohms or higher),
// simply use 1K Ohm resistors from each output pin and tie them together at the speaker.
// Don't forget to connect the other side of the speaker to ground!

// This example plays notes 'a' through 'g' sent over the Serial Monitor.
// 's' stops the current playing tone.  Use uppercase letters for the second.

#include <Tone.h>

int notes[] = { NOTE_A3,
                NOTE_B3,
                NOTE_C4,
                NOTE_D4,
                NOTE_E4,
                NOTE_F4,
                NOTE_G4 };
int lightPin1 = 5;  //define a pin for Photo resistor
int lightPin2 = 3;  //define a pin for Photo resistor
int lightPin3 = 1;  //define a pin for Photo resistor
int reading;
// You can declare the tones as an array
Tone speaker;

void setup(void)
{
  Serial.begin(9600);
  speaker.begin(8);
}

void loop(void)
{
  reading = analogRead(lightPin1);
  if(reading < 50) speaker.play(220,500);
  else speaker.stop();   

  reading = analogRead(lightPin2);
  if(reading < 50) speaker.play(240,500);
  else speaker.stop(); 
 
  reading = analogRead(lightPin3);
  if(reading < 50) speaker.play(280,500);
  else speaker.stop(); 
}

Hello guys !!
I've just tried the source code above with 3 lasers and 3 photoresistors and one speaker and works great !
I just have one question....
How can i make the notes fade away (i hope that's the correct word).For example if i interupt one of the laser beams i want a note to be played and when i remove my hand from the laser beam i want the note to stop slowly and not directly(something like the acoustic guitar).Is that possible to make it ?