# How to build a light sensor for PWM dimmed light (for comparison against CC dimmed light)?

I am working on a project in which I need to find a PWM duty cycle to dim an LED to the same brightness level as an LED being dimmed with CCR. Initially, I was considering using a camera for this: I would take a picture of each LED, and compare the intensity with photo-editing software. I am not sure how accurate this would be, though. I was wondering if there were any devices out there (light sensors, etc.) that could help me achieve this.

• An LDR is probably slow enough to average out the PWM'd LED. Otherwise a low pass filter will do wonders. – jippie Feb 4 '17 at 21:41
• I do not know very much about cameras, which is why I am hesitant to use one. Would a camera work, though? – dts Feb 4 '17 at 21:43
• If the LEDs have the same brand, model and bin code then measuring ref LED's forward current is enough. Otherwise, it will get complicated but not impossible. Using a camera may not be practical, btw. – Rohat Kılıç Feb 4 '17 at 21:45
• Thank you for the response! The LEDs are the same. I am just confused as to how the current would be enough. Isn't the current in the PWM LED changing? And don't LEDs have different efficiencies at different current levels? – dts Feb 4 '17 at 21:47
• Do a search on using a cell phone as a light meter, see if that would meet your need. – rioraxe Feb 5 '17 at 0:42

I'd suggest that the Intersil ISL29125 might be suitable for your application. Available on a breakout board from either Digikey or Sparkfun for under $8. These are I2C devices with very high resolution and integration times that are adjustable to reject 50/60 Hz and above modulation effects, so they should reject your PWM frequency very well. You could calibrate 2 individual sensors or use just a single one in a strict comparison mode. There are multiple solid state light sensors available, but this is the only one I've seen with such good calibration control. Depending on how professional a solution you are developing there are Arduino libraries for this device from Sparkfun, though they lack much in the way of calibration capability. I was wondering if there were any devices out there (light sensors, etc.) that could help me achieve this. there are definitive light sensors that can do that. But they all suffer from wide tolerance. Two (major) categories of approaches to try: 1) single sensor: no tolerance to worry about. But you have to have a way, often mechanical, to expose the sensor to the two light sources, separately. Can be challening, expensive and not terribly reliable. 2) two sensors: one for each light source. Most certainly requires calibration. Can be tough to deal with there. I have done #2 myself and in my case, it was building a light box and place the two sensors in the light box. Alter the light intensity and record the output from the two sensors so you know that when the light intensity is the same even when the two sensors give differing output. Tedious to calibrate, tough to program, and no good for mass production. But it can work very well with sensors even if they have wildly differing characteristics. Get a tiny 5V LDO and optically filtered detector that matches eye response in a 5mm case <$5. Choose R for sensitivity and test in darkness as ambient light will cause errors unless you make a flat black tube to aim at source.

Use a pot, set location , adjust light threshold measure,replace with fixed R load.

5V + precise 5mm "Light sensor", pot or Select on Test R+ logic gate or comparator or 555. It doesn't get much simpler.

I found these very accurate and repeatable for LED brightness to << 1% using DVM.

http://www.digikey.ca/product-detail/en/panasonic-electronic-components/AMS302/255-2655-ND/2125641

• A discontinued sensor does not make a lot of sense. And why post a link where the datasheet is available then post the whole datasheet as an image? – Jack Creasey Feb 5 '17 at 0:15
• The THT package is not obsolete. I think you confused discontinued package notice and it is the best part. – Tony Stewart Sunnyskyguy EE75 Feb 5 '17 at 0:24
• Ah ok on the part @Tony. Though I disagree on what's the best part. The Intersil part can be directly hooked to any MCU via I2C, your part needs an ADC channel. – Jack Creasey Feb 5 '17 at 0:36
• There's much to be said for KISS approaches. – Jack Creasey Feb 5 '17 at 3:51
• So not exactly KISS then. – Jack Creasey Feb 5 '17 at 16:57