This is a very small light sensor. A photocell changes (also called a photodetector, photo resistor, CdS or photoconductive cell) resistance depending on the amount of light it is exposed to. These little sensors make great ambient light triggers (when light in the room turns on, do something).
If it requires power, you need to know how much, what all the pins do, and how to hook it up. You may need to reference datasheets, schematics, and know the ins and outs of electronics.
Skill Level: Noob - You don't need to reference a datasheet, but you will need to know basic power requirements.
See all skill levels
Based on 7 ratings:
1 of 1 found this helpful:
Works as expected, no problems.
3 of 3 found this helpful:
Used with a 10K fixed resistor in a voltage divider and it provides a very good dynamic range through a normal room lighting range.
1 of 1 found this helpful:
Using it with an arduino uno for measuring ambient light level. Works great.
1 of 1 found this helpful:
I have used many of these because I often want to adjust what happens when the lights are on vs. off. I have checked several and they seem to be fairly consistant.
1 of 1 found this helpful:
Cheap way to make light activated things...ok, sounded quite dumb, but that's it, polarity doesn't matter.
I used this product on my object avoiding robot car to keep it from running under couches and getting stuck or other low ledges that would knock off components. Worked great!
Looking for answers to technical questions?
We welcome your comments and suggestions below. However, if you are looking for solutions to technical questions please see our Technical Assistance page.
Log in or register to post comments.
Is it possible to increase R2 to save power. I need to consume a few micro amps. Do you think it is possible ?
How many Mini Photocell I'll get for 1.50$ ???
Here's a tutorial on using this sensor with the Arduino.
Thanks for posting the link!
Remember that the response time on these is very long, somewhere in the 50-100ms range, so it's difficult to use them for transient events (like, say, laser triplines).
I've used one in my youth to make a light based sound transmitter using only an LED conncted to a radio's headphone jack and a CDs cell connected to an earphone and battery. it worked just fine.
I think the response is shorter (< 10ms). I drove a laser with tone() and pointed it at a photoresistor*, and (via ascii-art graph from analogRead()) can clearly see a 200Hz signal, implying < 2.5ms until a detectable response. Note however that at 32Hz the rise and falloff are much more visible; clearly at 200Hz the photoresistor (or some part of the system) doesn't fully stabilize. However at 32Hz, that's still ~15ms response time.
*I actually got impatient and picked up RadioShack's bagged assortment of 5, and am testing with one of the larger ones. I assume SparkFun's are similar.
It depends on what the trip wire is connected to. If all you want is a siren to go off a 100ms delay isn't bad given the simplicity of a photocell; If you're making a trap door or some other time sensitive device then yeah every millisecond counts!
I'm not so sure- I'm using these for a laser tag project, and they work excellently for transient lasers.
I use these on several projects and they are lots of fun. Of course, SparkFun.com just started selling them so I couldn't get them here yet. I'm glad to see them available.
I first used them for an automatic blinds project to detect when morning comes. I've also used them to detect lines on a line following robot. I know that the combo IR emitter detectors work better but at this price it is worth paying for just to see if it will work for your purposes. I was able to simply connect this with a 10k resistor as a resistor divider to an ADC pin. I then was able to reliably use it to detect a 1/2" solid black line pretty reliably.
Hey Tinkerish, I was checking out your blog and would love to see the documentation for that blinds project if you get a chance.
Hi! I was going to measure my mechanical camera's shutter speed with this and a laser and a 555 timer. I was wondering how practical that is. The response time and the decay time are within 10 ms of each other (not sure how accurate and how repeatable that is) according to a random web datasheet for the GL5528. If I subtract 10 ms from all my results, I should be fine, I guess?
You might just want to do the standard thing for removing scientific error... Do it fifty times and average! Or do it like ten times and you'll be good.
I used a bunch of these (20K ohm, I think) to measure boxes; see http://www.weasure.com
Hi. I use this sensor to determine if the lights are on or off in a small storage. If the values get below a certain point, it means the lights are off. And vice versa. When lights are turned on/off during the night, a mail is sent. Sometimes the value from the sensors drops even thou the lights are the same. Triggering a mail alert. This happens about every minute or so. Typically when the lights are on, the value should be 110-115. Dark is below 15. I started to log the values, and I get this: 114-113-115-9-114-113..... Why is the value dropping every now and then?
Hi. I was wanting to make an IR LED light source that will turn on at night when it gets dark and turn off during the day when its light. Would that be possible with just this sensor? Or would I need a microcontroller or something similar to program it as well? Thanks.
Hi guys, quick question. In picture 3 for this component, there's a wiring diagram that shows R2 with a value of 10K. I used this on a circuit where VCC was 5V and it worked great. Now I want to use it in a 3.3V circuit. Do I need to change the value of R2, or can it stay at 10K? If it needs to change, is there a formula I can use to calculate what that value should be?
I made a little calculator that works out the minimum and maximum voltage range for an LDR plus resistor voltage divider circuit. Useful in case you don't have the exact value calculated by squareroot(Rmin * Rmax). You can just fill in the various values of resistors you have.
You can find the calculator here: http://codepen.io/lerouxb/pen/ofyLc
I suppose it would work for any kind of variable resistor used as a sensor.
What would be the lightest microcontroller to control this? I want some night time light activation. Need super light weight.
If you're willing to go AVR, attiny85 might fit your bill. I remember it having an ADC/ADMUX, but always check the datasheet.
Are they polarity sensitive?
They are resistors, so no.
I just used one to automatically adjust the backlight on an LCD module connected to an Arduino. Made a voltage divider, connected the center to an analog input, scaled the value based on empirical observations, and used a PWM output pin connected to the LCD backlight. Cheap, easy, works like a charm. When ambient light is bright, the backlight is full-on, and in the dark, the backlight is (almost) full-off.
FYI: The resistance values posted above do not reflect the values of the device I received. On my photocell Light ~ 9.76K Ohms and Dark ~ 64.2K Ohms. Other than that it works like a champ.
Is this the same photocell used in the Terror-Min?
Yes, it is the same we use now on the Terror-Min. Hope that helps!
Hi! Is it possible to "invert" the sensor: as in when there is little light, something turns on, and while there is light, nothing happens. I want to use the sensor to turn on LEDs when it starts to get dark outside.
You could implement that easily in the code for your microcontroller. The light sensor itself can't be 'inverted', but you could simply code it so as the amount of light sensed decreases, the number of LEDs turned on increases.
Thanks for the reply Toni. As I want to utilize the photocell in a garment, can the photocell be washed? And will the photocell's detection of light/lack of light be affected by being covered in a transparent or bright material? As I am a newbeginner, the specifications in the datasheet do not lead my to any conclusion on those matters. Thanks.
If you are looking to use this in a garment, I would recommend you check out the Lilypad Light Sensor. These boards are designed specifically for e-textile applications. Covering the sensor will affect the detection of light, though if you are using a transparent material, it shouldn't affect it too strongly.
For anyone wondering how low these can go, I put one right on the light in my desk(it's super bright) and it went down to ~120 ohms
Also, I put one in my mouth(only place I could think of where I'm positive there no light being produced, I hope these are RoHS compliant) and it got up to ~1.7 MOhms
For your next test, use a better testing area like... where the sun.. err... does not shine?..... I bet theres not light there either.
Only then we will know how low you can go.... (Pun? ... yeah, 100%)
(sorry... it was to easy to let it go)
Works perfectly for black on white line sensing. on the one i got the light resistance was about 1K and the dark was about 40K. i had a idea for these awhile back, if you take three of these and cover them in color filters so one only senses either red, blue, or green, you could make a real cheap analog color sensor. What does everyone think of this idea?
It sounds pretty darn cool, mon! Do it! Worth the money even if it doesn't work, 'cause you'll learn something either way. It wouldn't be very accurate, but you could write some code that would print "Red" or "Yellow" to a serial monitor.
I just had a brilliant idea that would let me dump all the AVRs and stuff out of my line-following robot!!
So I would have two motors for moving, right? Then I could use 2 power transistors such as TIP20s with a pair of these, and when the bot veered right enough that the left CdS detected black, the transistor would limit the current to the left motor and the bot would turn left back onto the line!
I really wanna know if this would work! Thanks!
If you look at the datasheet, the peak sensitivity is in the green region (540nm), so I don't think these are well suited for RGB. However you can actually get colored LEDs to respond to light input, that might be worth a shot.
I meant, would my idea work. Thanks for tossing out an answer though, because other people probably want to know.
Since you were responding to Klone38's RGB idea, that's what I was responding to as well. But in response to your idea, sure, people were making robots long before computers with these kind of sensor-feedback systems. You might need to throw an op-amp or two in there to tune the photocell response to what your transistors want to see, but yes it can be done. Google Mark Tilden for lots of clever ideas.
I did that as a high school project a while back and it did work but was a a bit sluggish when the difference in light levels were comparable. I didn't use any op-amps and it seemed to work fine but in retrospect they seem to a good idea.
These things aren't too good at detecting blue light, but its worth a shot.
Anyone know the solderability of this component?
Could someone please comment on the time delay? How repeatable//stable/linear is the resistance?