HOW TO – Make a color sensor from a reversed LED and Op amp

HOW TO – Make a color sensor from a reversed LED and Op amp

David writes –

One of the first lessons that an electronics student learns is that an LED provides light from current flow. But, did you know that an LED put in backwards provides current flow from light? Yes! It’s true.

HOW TO – Make a color sensor from a reversed LED and Op amp – Link.

18 thoughts on “HOW TO – Make a color sensor from a reversed LED and Op amp

  1. Don Hersey says:

    Good, classic circuit. The guy could improve it greatly by using an attenuator in the feedback loop. This would bring up his parts count slightly, but would not require the large value resistor.

  2. Don Hersey says:

    Another way, less precise, but a not-too-bad way to ‘goose’ the gain, is to put the diode across the base-collector junction of an NPN BJT and tap the emmiter for the current. It is interesting that in the original version of this circuit, it is basically an indifference whether the photodiode is connected forward or backwards.

  3. grouchaux says:

    Could you then wire an array of LEDs to make a pseudo-solar cell to generate current?

  4. Greg says:

    ^^^ Or could I lay 20 V across one of my solar cells and light that baby up?

  5. Dylan says:

    Cool, I’ve got a few RGB LEDs laying around… full-spectrum color sensor!

  6. Adam says:

    I don’t think you could make am all-purpose full-spectrum colour sensor like this; if you have an RGB LED, it’ll respond to yellow that’s made of a mixture of red and green (like that emitted by a TV, an LCD monitor, or, indeed, another RGB diode), but not to the monochromatic yellow of a sodium lamp, or whatever. A yellow object illuminated with natural light is likely to be of the second sort.

  7. Don Hersey says:

    Solar cells are diodes, indeed. Typically they sandwich them in layers by bandgap. This way, different frequencies of radiation can penetrate the stack and excite the appropriate layer. The solid-state op-amp was developed by Fairchild Camera and Instrument to operate the photosensor on a camera. They were using a CdS sensor at the time. Soon this device went to the ‘top-of -the-pops.’
    It would be impractical to attempt to use LEDs as power generators. That the circuit specifies feedback resistance on the order of megs implies that only microamperes of current are generated. No current, in theory, flows into the input of the op-amp. The Norton summation of currents must be zero, making the current through the feedback R equal to that of the photo diode. It takes proportionally more output potential to cancel the photo current (thusly maintaining ‘virtual ground’) if the feedback resistor is larger. Really big resistors are hard to obtain, so a T-pad attenuator can be made to sample a portion of the output potential, effectively upping the gain without the use of oddball resistors. Deviations from the ideal include the fact that leakage current does indeed flow into the amplifier, so a low-bias type, especially if trimmed for offset null, is a good choice. Another problem is ‘dark current.’ Even un-excited, the diode is going to admit some current, much of which is going to be noisy. Another problem at high sensitivities, is ‘shot noise.’ Shunting the feedback resistor with a capacitor, among other ways, can limit the response time of the amplifier, which can be desired if one is sampling a low-bandwidth event such as sunrise. A similar scheme, usually with some Schmidt triggering can be used to buffer an opto-isolator.

  8. Don Hersey says:

    Nah, Leds aren’t that narrow spectrum, they gotta sorta Gaussian curve on emission, and if I recall correctly, will respond with to any photons whose energies are equal or higher (wavelengths are shorter) than their ‘color,’ upon detection, provided that the plastic they are encased in doesn’t screen out those frequencies. They are used in photometry, for example in mixing paint, where they are considered more sensitive to hue than human eyes. The brain uses a lot of post-processing to make up for rather poor color sensitivity of the eye, I think.
    You’d want to start with an individual transresistance amplifiers like this guy describes, probably with an attenuator in the feedback loop, probably some kind of potentiometric adjustment for gain. Then, maybe a buffer amp. Then, I’d say, an anti-logarithmic amp to compensate for the natural transfer characteristic of the sensors. From here feed three independent A/D converters, I wouldn’t get too fussy about resolution. Use a uP so ya’ can fool around with the math. It might be useful, in some cases, to also use a more broadband type of sensor, such as CdS to get a grip on the general illumination level. Some photometric setups work it the other way, illuminating the target with different color LEDs in turn, and measuring return with a broadband sensor. Typically, the longer wavelength sensors will exhibit more sensitivity, so relative gain will have to be tweaked. A grey test card from the photo store may be of service here. Sunlight has a pretty even spectrum on a sunny day around noon. Artificial sources have their individual quirks, which may have to be considered. If simple sensing of gross intermediates of the sense frequencies is all that is desired, I suppose a few summing amps could be configured that would yield adequate results.

Comments are closed.

Discuss this article with the rest of the community on our Discord server!

current: @adafruit - previous: MAKE, popular science, hackaday, engadget, fallon, braincraft ... howtoons, 2600...

View more articles by Phillip Torrone


Ready to dive into the realm of hands-on innovation? This collection serves as your passport to an exhilarating journey of cutting-edge tinkering and technological marvels, encompassing 15 indispensable books tailored for budding creators.

Escape to an island of imagination + innovation as Maker Faire Bay Area returns for its 15th iteration!

Buy Tickets today! SAVE 15% and lock-in your preferred date(s).