photo sensor and arduino

i'm trying to hook up a photo sensor to the arduino ( yes photo sensor, not photo interupter like before )
and i was guesing if you apply 5v to it, it will let 5v pass through it with full light, and 0v if there is no light ( or the other way around ) but it doesent seem to be working..

and it is just a regular 2 pin photo sensor. and yes i googled it, and searched the playground, and tutorial part of the arduino forum site.... if anybody has a how to link, that would be great, thanks alot!!
-big93

hey, pleae i need this to get my project going, pls answer me :slight_smile:

if you mean a photo resistor (LDR) then you need to hook it up as a voltage divider with the help of an extra resistor an use it with an analog in pin onte Arduino board.

This site (scroll down quite a bit) shows how to do it

Lots of other good Arduino stuff there as well

thanks!!

I think you can only add a link (within those img tags) to a picture on some other site. Its a real pain in the &^%. But if you have a site, you can include a link to pictures there.

what was that second thing u posted?

adn his link to the code doesent work, and when i try my own code, its just ranging between 350-410, and light doesent seem to be affecting it...

Sorry the link i posted was for another thread, thats what you get for having too many tabs open i IE

quote :
adn his link to the code doesent work, and when i try my own code, its just ranging between 350-410, and light doesent seem to be affecting it...

Remember that LDR's do not work like switches, they have a certain resistance in total darknes, and a certain resistance in "very bright light". They do not have infinite resistance in total darkness, so you will probably not get the total 0 - 1023 range when you read the analog pin it's connected to.

but when i put my hand over it to block any light, and i take off my hand, to show it light, there is no diffrence...

like it'll be on 406, and i quickyl cover i with my hand, and the next reading will be 402, and then i take my hand off and point it at a light, and i get 404, and then when i put it back down for a while it randomly changes to 358... there is no affect at all...

got it to work using this tut:

http://webzone.k3.mah.se/projects/arduino-workshop/projects/arduino_meets_processing/instructions/ldr.html

seems like the same as b4, i dont know why it dident work...

Cool you got it working.

One thing to have in mind too, is thar LDR's have "memory" when exposed to light the resistance drops, but when covered up again the resistance takes some time to go back to the previously high level. It doesen't change instantly.

i got a video of me using the sensor on youtube, go to my exhibition post on the exhibition place in this forum to check it out!