I am new to arduino or for that matter any phisical computing environment. That said this may sound like a stupid question but I have a laser module that runs on 3.5-4.5 VDC at 5mw and a photocell from radioshack. How would I connect the two so that when the beam is broken the photocell would relay this to the analog input? Also how do I know how strong a resistor to use to bring the +5VDC from the arduino down to the required 4 yet retain 5mw current? Any help would be greatly appreciated.
here is your answer
http://www.instructables.com/id/Arduino_Laser_Tripwire/
ok wow I feel stupid thank you that was really helpful for the wiring. I just have a few questions.
1.) Why do you need to use a resistor between the analog 0 and the ground?
2.) How do you know which resistor to use?
3.) Which resistor should I use for my laser to bring down the voltage? (actually I should be able to figure this out after #2 is answered)
download the pdf and has all that info.
about pulldown resistor, witch is a 10K I do not have a clear idea myself, but maybe some one will asnwer that question for me too.
The 5mW rating on the laser is the intensity of the light output, not the supply rating. Unfortunately I can't tell you much more than that. The spec sheet on the laser should tell you how many mA it needs. Or it may already have a resistor and you just need to supply the right voltage.
Why do you need to use a resistor between the analog 0 and the ground?
The light cell changes it's resistance with light. The analogue input measures voltage. Therefore you have to turn a change in resistance into a change in voltage. If you just put a voltage across a light cell you will get a change in current with changing light, to turn that change in current into a change in voltage you have to pass the current through a resistor. That's why you need one.
I would recommend having a voltage regulator to supply the power to your laser rather than a resistor because a resistor will only drop a constant voltage if it has a constant current through it. The current of the laser is likely to change with temperature both ambient and as the laser warms up.
How do you know which resistor to use?
You want to have the change in voltage span the largest range you can get. To do this the resistor has to be large in comparison to the dark resistance of the cell. Coupled with the fact that if the analogue input "sees" a resistance of much over 10K it will pick up noise. Therefore you use a 10K but it is not critical and anything from 3K to 30K would work almost just as well.
I would recommend having a voltage regulator to supply the power to your laser rather than a resistor because a resistor will only drop a constant voltage if it has a constant current through it. The current of the laser is likely to change with temperature both ambient and as the laser warms up.