what do people use to sense light these days - Page 1
Forum section: electronics / projects

author: Simon
author_rank: Unknown
timestamp: September 28, 2020, 12:41:20 pm
content: When I was a boy we just used an LDR - Light dependent resistor. But from what I can see they are right out of fashion and did not make it into SMD form what few are still around.So what do I use? I have seen the nice complicated chips that talk serial and tell you the colour and all that but really I just want that simplicity of an analogue voltage readout.

author: nikodem
author_rank: Regular Contributor
timestamp: September 28, 2020, 12:46:03 pm
content: Quote from: Simon on September 28, 2020, 12:41:20 pmUsually a photodiode, but there are plenty applications, where LDR is good enough. There are also other sensors - avalanche diodes, silicon photomultipliers... depends on your aplication

author: Simon
author_rank: Unknown
timestamp: September 28, 2020, 12:51:30 pm
content: I just need to detect ambient light levels so that I can adjust the brightness of LED's on a control panel. So bright sun turn them up, night, turn them down. Just some voltage output that has some predictable relationship to the light that can be used to manipulate the dimming control. Simple really.

author: Alex Eisenhut
author_rank: Super Contributor
timestamp: September 28, 2020, 12:57:21 pm
content: Last time I noticed one was almost 20 years ago..http://ww1.microchip.com/downloads/en/DeviceDoc/doc4249.pdf

author: T3sl4co1l
author_rank: Super Contributor
timestamp: September 28, 2020, 01:12:51 pm
content: If this already has a micro I'd probably reach for one of the I2C ones. Internal signal conditioning, well characterized. You have a good measure of actual brightness, without having to do all the log amp, and uh temp compensation or whatever, that a raw photodiode would.That said, you can use a raw photodiode in a simple way: use its leakage current to discharge a capacitor, and periodically sense that voltage dropping below a threshold, which force charges the capacitor. In other words a relaxation oscillator. You can get integrated sensors of this type as well, or build it with an MCU pin (preferably using an analog comparator block, but it can still be done with plain GPIO) and a little software. Then, measure frequency with a timer and you have a measure of light.This can even be done with plain LEDs (which aren't very good photodiodes, but good enough so it seems!), and if you monitor the frequency for subtle changes, you can detect modulated signals at surprisingly great distances. Which you can turn around and light the LED, transmitting as well. Low bandwidth MCU+LED wireless transceivers have been demonstrated in exactly this way.Tim

author: Simon
author_rank: Unknown
timestamp: September 28, 2020, 01:15:19 pm
content: I does not need to be too clever, it's just so we don't blind em at night and so that they can still see it by day.

author: fcb
author_rank: Super Contributor
timestamp: September 28, 2020, 01:24:10 pm
content: BP104 photodiode and an opamp configured as a transimpedance amplifier (tia).

author: T3sl4co1l
author_rank: Super Contributor
timestamp: September 28, 2020, 01:27:43 pm
content: Heh, even just a pullup on a photodiode would get you a literal night-and-day difference. Won't have any subtlety, but if you just want two or three levels, there are worse things you could do.Tim

author: Simon
author_rank: Unknown
timestamp: September 28, 2020, 01:30:36 pm
content: Well obviously more levels the better but I don't want to get carried away and over design.

author: Gyro
author_rank: Super Contributor
timestamp: September 28, 2020, 02:02:49 pm
content: Watch out for the spectral response of your sensor - LDRs have a reasonable visible light spectral response, photodiodes are far more biased into the IR region.I remember working on a military manpack radio years ago. We used a photodiode behind the display filter for light level control. It worked fine outside in sunlight, but in the lab under florescent lighting, we had to rig up an IR led 'streetlight' so that we could actually see the display. Those things were designed to go down toverylow brightness levels (for obvious reasons!) at night though.

author: Simon
author_rank: Unknown
timestamp: September 28, 2020, 02:09:47 pm
content: Yes I see some are quite broader than the human eye. I expect the problem is when they are more sensitive outside the human range than in.

author: Simon
author_rank: Unknown
timestamp: September 28, 2020, 02:22:35 pm
content: most seem to be more UV sensitive with some starting at 700nm which is where human sensitivity ends. But I guess UV is proportional to visible sunlight?

author: Simon
author_rank: Unknown
timestamp: September 28, 2020, 03:25:44 pm
content: This one looks promising. Actual photo diodes seem a bit week, photo transistors seem to put out more current.

author: DrG
author_rank: Super Contributor
timestamp: September 28, 2020, 03:35:20 pm
content: https://www.digikey.com/en/articles/ambient-light-sensors-mimic-the-human-eyeMay be helpful.

author: Simon
author_rank: Unknown
timestamp: September 28, 2020, 03:46:01 pm
content: It kinda states the obvious but thanks, the last port they suggest is very similar to the one I am considering. My only confusion is that the sensor groph stops at 1'000 lux, with far less current than what the part can handle. Does that therefore mean that the graph is just a small part of the characteristic and they are demonstrating that it's a straight line so I can extrapolate the rest for myself or does it actually saturate at 1'000 lux which is piss poor and any light sensing application would need 10'000-100'000 lux of range.

author: Kleinstein
author_rank: Super Contributor
timestamp: September 28, 2020, 04:00:20 pm
content: Photodiodes itself are quite linear over a very large range, well beyound 1000 Lx. However the detection circuit I/V converter may saturate at some point. The large dynamic range from low light (e.g. 10 Lx) to full sun (some 100 kLx) can be demanding for the detection circuit.For a simple µC solution it can be interesting to use a capacitor and variable integration time to get additional control over the gain. So use a capacitor in the 10 nF range and photo-diode to charge or discharge and than measure the charge after some 0.1 - 100 ms. This way one may get a large dynamic range even with only a 8 Bit ADC.

author: Simon
author_rank: Unknown
timestamp: September 28, 2020, 04:11:40 pm
content: At the moment I am just trying to work out what the range is on the parts. Reading between the lines it's 0.5µA/lx and a maximum of 20mA, that is 40'000lx, that's OK as a range.

author: Kleinstein
author_rank: Super Contributor
timestamp: September 28, 2020, 04:15:55 pm
content: If mounted inside a case, one may have an optical filter or limited aperture to reduce the light actually coming to the sensor. So the sensor may see less than the brightness outside.

author: DrG
author_rank: Super Contributor
timestamp: September 28, 2020, 04:17:27 pm
content: Quote from: Simon on September 28, 2020, 03:46:01 pmI don't see where the Vishay part addresses that?The Rohm part therehttp://rohmfs.rohm.com/en/products/databook/datasheet/ic/sensor/light/bh1603fvc-e.pdfshows current out at ~100,000 lx at low gain (fig 3) - maybe a better choice?

author: Simon
author_rank: Unknown
timestamp: September 28, 2020, 04:18:09 pm
content: Quote from: Kleinstein on September 28, 2020, 04:15:55 pmIt will be at the bottom of a 5mm diameter hole about 20mm deep so lower maximum levels is not an issue really but I am trying to understand as I have as always one shot at it.

author: Simon
author_rank: Unknown
timestamp: September 28, 2020, 04:20:05 pm
content: Quote from: DrG on September 28, 2020, 04:17:27 pmYes it may well be as if anything they actually tell you stuff.

author: Kleinstein
author_rank: Super Contributor
timestamp: September 28, 2020, 04:39:35 pm
content: Quote from: Simon on September 28, 2020, 04:18:09 pmThis would be a rather directional optical setup. Light from the right direction would come in at 100%. Light from another angle would be scattered first, so depends on the color of the sides, but can well be much less effective.For a more isotropic sensitivity it would need need something like a highly scattering cover - up to some thin white paper. 5 mm diameter at 20 mm distance would be some0.250.06SR covered and thus about some20.5% (0.25 / 4*pi) of the light coming through with a highly scattering, but not absorbing cover and a black "tube" or no scattering back from the sides.

author: madires
author_rank: Super Contributor
timestamp: September 28, 2020, 05:07:47 pm
content: LDR in 0805 package:https://www.aliexpress.com/item/840516741.html

author: coppice
author_rank: Super Contributor
timestamp: September 28, 2020, 05:08:20 pm
content: eyes

author: madires
author_rank: Super Contributor
timestamp: September 28, 2020, 05:30:13 pm
content: Too simple! 50 Mpixel cam plus cloud based AI, at least.

author: Benta
author_rank: Super Contributor
timestamp: September 28, 2020, 05:58:22 pm
content: Quote from: fcb on September 28, 2020, 01:24:10 pmThe BP104 is for IR sensing and has a "daylight blocking filter". Completely useless for this application.A BPW34 would be more to the point.Otherwise look here:https://www.vishay.com/photo-detectors/ambient-light-sensor/LDRs are a no-go in the EU due to the Cadmium content (RoHS).

author: Simon
author_rank: Unknown
timestamp: September 28, 2020, 06:10:47 pm
content: Quote from: madires on September 28, 2020, 05:30:13 pmhahahahahahahahaha, I have more sense

author: Simon
author_rank: Unknown
timestamp: September 28, 2020, 06:12:50 pm
content: Quote from: Kleinstein on September 28, 2020, 04:39:35 pmit's what happens when the employer wants it all on a budget. The position will be fixed so once setup for that location no problem.

author: madires
author_rank: Super Contributor
timestamp: September 28, 2020, 06:53:47 pm
content: Quote from: Simon on September 28, 2020, 06:10:47 pmIt will make perfectly sense when you consider that you can sell that as a subscription service which generates a nice MRR, and that it also includes buzzwords. Marketing and sales will love you.

author: Simon
author_rank: Unknown
timestamp: September 28, 2020, 06:57:30 pm
content: Quote from: madires on September 28, 2020, 06:53:47 pmNot when they have to ask the enemy to stop the war because their driver got blinded when they knocked the satellite dish for the internet connection off the vehicle

author: bson
author_rank: Unknown
timestamp: September 28, 2020, 06:57:49 pm
content: Ambient light sensors are popular. As if they were made for the purpose! Imagine that.https://www.mouser.com/ProductDetail/Broadcom-Avago/APDS-9005-020?qs=xnajaXqBF9%252BoOepjPhtFXQ%3D%3D

author: Simon
author_rank: Unknown
timestamp: September 29, 2020, 07:35:31 am
content: Quote from: bson on September 28, 2020, 06:57:49 pmAnother one that only goes to 1000 lux, direct sunlight is 100'000 lux, even lower levels of sun light is 10'000 lux

author: Gyro
author_rank: Super Contributor
timestamp: September 29, 2020, 09:02:32 am
content: Quote from: Simon on September 29, 2020, 07:35:31 amYes, the sensor will probably saturate (you could give it a hand by putting it behind a dark filter - it's mounted internally anyway). I think you really need to start considering the dynamic range of your LED display current control though. If you're trying to compete directly with the Sun over that range, you're probably going to end up with magic smoking stains on the inside of your display!You probably want to invest in anti-reflective high contrast polarizing display filters.

author: Simon
author_rank: Unknown
timestamp: September 29, 2020, 09:06:15 am
content: Fact is have no clue what is going to happen. The unit goes inside a vehicle and I would not expect anyone to be looking at it whilst looking at the sun but as I have been given 0 information I want to design in such a way that I can correct issues in code rather than with a whole new hardware design.With the royal ohm port hopefully I have covered the whole range so can play later.

author: Gyro
author_rank: Super Contributor
timestamp: September 29, 2020, 09:14:46 am
content: Don't forget to be prepared to factor in some costings for decent display filters then - they ain't cheap.... and they're something that you can substitute without messing with the PCB.

author: Simon
author_rank: Unknown
timestamp: September 29, 2020, 09:16:21 am
content: It's LED's, we just want to avoid blinding them

author: Kleinstein
author_rank: Super Contributor
timestamp: September 29, 2020, 10:51:52 am
content: For adjusting the LED intensity the range is likely much smaller than the ambient light range. It is not about measuring to full sun light, but only to the point were the LEDs would get there full current. This may be well before the sun hit's it directly. The position on the board would already reduce the intensity quite a bit. So an upper limit of 1000 Lx may be OK.

author: Simon
author_rank: Unknown
timestamp: September 29, 2020, 10:54:51 am
content: Quote from: Kleinstein on September 29, 2020, 10:51:52 amOh it might, fact is i have no flipping clue and even if I made one and tested it and got it working to what I thought was right there is nothing to say that once mounted into it's desired location that is all wrong. If I have to design something 10x more costly to cover my arse I will as the arsage to be covered when you have no clue of the user environment is near infinite.

author: Kleinstein
author_rank: Super Contributor
timestamp: September 29, 2020, 11:27:22 am
content: It would be a good Idea to build up a prototype before deciding on the final gain settings / resistors. Also getting the correct response to light from different angles may need some testing. A calculation is possible be complicated and one would still need to know all the parameters like scattering properties, which are often not well known.A good thing is that the eye is sensing light on a kind of log scale and is not very sensitive to small changes. So it is not about 1% tolerances, more like +-50% errors could be acceptable. The window from well visible to blinding bright is quite large. Many products get away with just fixed intensity. It is not that many parameters to adjust: mainly the intensity when in the controlled middle range. The LEDs and sensors are linear enough in the relevant range and min or max intensity can still cover a few orders of magnitude with no regulation. The other point is not getting the sensor fooled to much (e.g. more than a factor of 3 to 10) with light from an angle.

author: nali
author_rank: Frequent Contributor
timestamp: September 29, 2020, 11:53:07 am
content: Just an out-of-the-box thought: If you're driving LEDs directly from a MCU have you considered using the LEDs themselves as photodetectors? e.g.https://www.merl.com/publications/docs/TR2003-35.pdfNot tried it myself, just have read about it. Obviously limits you to MCU's drive current although in these days of high intensity LEDs not so much of a limitation.Also saves the cost of the sensor & mounting

author: Simon
author_rank: Unknown
timestamp: September 29, 2020, 12:03:26 pm
content: Quote from: nali on September 29, 2020, 11:53:07 amAs I said within reason money is no object, I spend £5 on a chip and the thing works, boss is happy. I try some half arsed stunt to save a fiver and it fails, boss will be unhappy.

author: Simon
author_rank: Unknown
timestamp: September 29, 2020, 12:08:22 pm
content: Quote from: Kleinstein on September 29, 2020, 11:27:22 amThis is totally the problem. The human eye can cover such a range that a fixed brightness light in the sun does not appear to be on but in the dark is blinding.The sensor is down a hole 4 times longer than it's diameter so no angular issues, the LED's are also down there. the walls will be natural aluminium.

author: Kleinstein
author_rank: Super Contributor
timestamp: September 29, 2020, 12:41:03 pm
content: For the LED and sensor down in a hole, it makes a difference if there is a front cover / filter. It also makes a difference at which angle the observer is to the LED. Just a hole and looking from an angle may not work very well. So I would assume some kind of scattering film / front panel to cover the surface. Like with LED displays it would likely be a good idea to have the front also as a filter (e.g. red for red LEDs) and the surface off the holes in a dark color.The tricky part is more in optics, not so much finding a sensor.With a scattering surface and the hole the sensor would not get full light. So saturation of the sensor should not be a problem. One would not need to measure beyond the point where the LED is on full power.The sensor only has to cover the dynamic range of the LED - hardly more than a factor of 100.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: September 29, 2020, 12:48:17 pm
content: If you open up some el-cheapo PIR sensor (with day / night detection) they often have some silicon based sensor in a clear plastic housing, and these are often linearized current sinks and may also have filters to better resemble Human visible wavelengths. These are made by the masses, as PIR sensors are common, and therefore probably the cheapest parts if you can find the right source.

author: Zero999
author_rank: Super Contributor
timestamp: September 29, 2020, 01:07:28 pm
content: Quote from: Simon on September 29, 2020, 09:16:21 amOne importan thing which helps a lot is to use diffused LEDs. It makes them visible over a wide range of angles and increases performance in daylight too.A photodiode is a sensible enough solution. Photovoltaic mode is better at high intensities. Don't worry about it being more sensitive to IR. The dominant wavelength of sunlight is around 800nm and matches photodiodes quite well.

author: Simon
author_rank: Unknown
timestamp: September 29, 2020, 01:15:26 pm
content: Quote from: Kleinstein on September 29, 2020, 12:41:03 pmI have a decal over the holes. The sensor would have a clear window as the base material is clear. The LED spots would be white, this allows them to go the colour of the LED so it's clear that the LED is on. I don't think having the cover/scatter the same colour is a good idea as this makes it more difficult to see against the light.For sure the sensor will never see full sun light but I want to have options so have picked the widest dynamic range possible.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: September 30, 2020, 01:21:14 am
content: When working with infra red, the concept of "transparent" changes significicantly.Ordinary window glass is not very transparent for IR light. If you go stand outside with your IR tv remote, it probably won't work through the glass.I've seen IR pictures of a sowing machine in which the black rubber timingbelt was transparent to IR, and you could see the wires in it.Lenses for thermal camera's are made out of ... weird shiny materials.

author: Simon
author_rank: Unknown
timestamp: September 30, 2020, 06:30:20 am
content: Yes If I point my thermal camera at a window it's like a mirror, instead of seeing outside I see my own thermal reflection.

author: Zero999
author_rank: Super Contributor
timestamp: September 30, 2020, 08:28:32 am
content: Quote from: Doctorandus_P on September 30, 2020, 01:21:14 amYes, visible light can pass through things, which IR can't and vice versa, but you're wrong about window glass and IR remote controls. Ordinary window glass is very transparent to the shorter IR wavelengths, used in remote systems.https://en.wikipedia.org/wiki/Soda%E2%80%93lime_glassIR covers a large band from 800nm to 1mm, with the shorter wavelengths having similar properties to visible light and the longer ones are more like microwaves.

author: fcb
author_rank: Super Contributor
timestamp: October 07, 2020, 04:08:12 pm
content: Quote from: Benta on September 28, 2020, 05:58:22 pmBP104SR is sensitive down to 400nm (UV), ~40% relative output at 500nm. It was low cost, and gave a fairly OK response for setting the intensity of LED's.BPW34 (Vishay: VBPW34SR) typically is broadly similar (slightly worse) than BP104SR.As you point out Cd based devices are outlawed in most applications.

author: SiliconWizard
author_rank: Super Contributor
timestamp: October 07, 2020, 04:56:04 pm
content: Depends on the application really - but these days I tend to use dedicated light sensors, possibly with a digital interface (if I'm going to interface them with some digital circuits anyway). You can find them in various packages, with various spectral responses.Even if you just need a cheap way of sensing ambient light with no accuracy requirement, you can find digital light sensors for dirt cheap these days, as those are now ubiquitous in mobile devices. So I wouldn't bother with an analog solution, unless I had an extremely good reason for doing so.

author: Simon
author_rank: Unknown
timestamp: October 07, 2020, 04:57:36 pm
content: Quote from: SiliconWizard on October 07, 2020, 04:56:04 pmEMC!

author: SiliconWizard
author_rank: Super Contributor
timestamp: October 07, 2020, 05:02:54 pm
content: Quote from: Simon on October 07, 2020, 04:57:36 pmUnless you had extremely strict requirements (far exceeding the levels allowed in current standards), EMC would be absolutely a non-issue here. Or we would never design any digital circuit.If you're particularly concerned, just choose one with an I2C interface and configure I2C for low freq (100 kHz or slower) and controlled slew rate (many MCUs have this feature). EMI in this case would be completely negligible, and if you're going to use digital circuits in your design anyway (even just an MCU), this will then even be the least of your concerns.Now obviously, a good reason would be if your design doesn't include any MCU or programmable logic able to deal with a digital sensor (at least in a sensible way). That's another story.

author: Simon
author_rank: Unknown
timestamp: October 07, 2020, 05:52:27 pm
content: EMC is kinda critical, an un-shielded and unfiltered AVR held in reset fails this one.

author: SiliconWizard
author_rank: Super Contributor
timestamp: October 08, 2020, 04:48:22 pm
content: Quote from: Simon on October 07, 2020, 05:52:27 pmI would definitely question the design of your PCB and possibly of your power supplies then.By "failing EMC", I suppose it failed meeting one of the applicable EMC standards? Certainly an MCU, all the more held in reset, shouldn't need shielding. Looks like something is seriously wrong.

author: Simon
author_rank: Unknown
timestamp: October 08, 2020, 04:55:44 pm
content: Quote from: SiliconWizard on October 08, 2020, 04:48:22 pmYes with your understanding of how sensitive some tests are....

author: bson
author_rank: Unknown
timestamp: October 08, 2020, 05:18:34 pm
content: You don't have to compete with the sunlight that illuminates outdoors, only the portion that reflects into your eyes - assuming you're not staring into the sun. But the userislooking directly into your device's illumination, which once again only has to compete with reflected light. Lux also isn't the unit of interest since you don't care about illumination per area; you care about the amount of light emitted by both the device and its ambient surroundings. I'd start by turning the panel light (or whatever it is) up all the way and expose is to sunlight. See in what ambient lighting it tops out. Take the light sensor and add enough ND filtering to bring just below saturation. There's no point extending the scale beyond this when your light can't get any brighter. Then take it to a dark environment and see at what level you can get a useable signal. Low pass filter it to reduce the bandwidth and noise.Did you do this? What were the results (quantitatively, not blatheratively).

author: Simon
author_rank: Unknown
timestamp: October 08, 2020, 06:39:36 pm
content: Quote from: bson on October 08, 2020, 05:18:34 pmNo, because until I complete the PCB I can't complete the housing and by the time I have a PCB, housing and decal i will be shipping it.... So i have taken the most pragmatic and simple solution of being prepared for anything. Whatever I need to do i can do as I will have the brightest LED's I can get and a sensor that will cover the entire possible range. Why have i got to guess and do tests that are not representative when I don't have to as I have a solution?

author: pwlps
author_rank: Frequent Contributor
timestamp: October 10, 2020, 11:32:37 pm
content: Many years ago I was using a sensor from TI (I forgot the part number) featuring an integrated photocurrent-to-frequency converter, so that it could be interfaced directly to a microcontroller without any other components. And it had a fantastic dynamic range (frequency changing from Hz to ~MHz). I don't find anything like this in the TI catalog anymore but there are other brands e.g.https://ams.com/light-to-frequency, also found plenty of these herehttps://eu.mouser.com/Sensors/Optical-Sensors/Light-To-Frequency-Light-To-Voltage/_/N-8zn66. If you want high resolution especially at low light levels these are probably hard to beat.

author: Kjelt
author_rank: Super Contributor
timestamp: October 11, 2020, 08:57:00 am
content: If I may be so blunt, DON'T!If there is something personal taste it is lighting level, people over 50 have far more need for light than young twentiers.Don't decide for the operators which light level they need, let them please decide it for them selves and give them a manual potmeter or something they can regulate it themselves.Even carmanufacturers reached this conclusion years ago that the day/night dashboard lighting should always be manually adjustable.

author: RJSV
author_rank: Super Contributor
timestamp: October 14, 2020, 05:16:58 am
content: I like to take apart various TOYS, often drug store toy shelf has most often using a photo-transistor (3 wires,) but also with attached 'smokey' tinted plastic window cover. So, as per other folk's posts here, I'm not sure about UV issues and nighttime issues. (I need to read and study those posts, in more depth.)Also I still see LDR type Cds (cadmium construction) and thought there was EU ban in place (toxic). BUT, the toy store still carries one toy type, a motion sending toy singing bird. It appears some clever software involved, as the TOY senses motion in ways that seem erratic / unpredictable, but other times the TOY seems to work well, using the CDs type.